Skip to content

Commit a7c1c47

Browse files
committed
Fix review comments
1 parent 62e9b50 commit a7c1c47

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/builder.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
114114
let after_block = func.new_block("after_while");
115115
self.llbb().end_with_jump(None, while_block);
116116

117-
// NOTE: since jumps were added and compare_exchange doesn't expect this, the current blocks in the
117+
// NOTE: since jumps were added and compare_exchange doesn't expect this, the current block in the
118118
// state need to be updated.
119119
self.switch_to_block(while_block);
120120

@@ -131,7 +131,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
131131

132132
while_block.end_with_conditional(None, cond, while_block, after_block);
133133

134-
// NOTE: since jumps were added in a place rustc does not expect, the current blocks in the
134+
// NOTE: since jumps were added in a place rustc does not expect, the current block in the
135135
// state need to be updated.
136136
self.switch_to_block(after_block);
137137

@@ -906,6 +906,11 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
906906
}
907907

908908
fn inttoptr(&mut self, value: RValue<'gcc>, dest_ty: Type<'gcc>) -> RValue<'gcc> {
909+
assert_eq!(
910+
value.get_type(),
911+
self.cx.type_isize(),
912+
"cg_ssa currently only calls this function with an isize argument",
913+
);
909914
self.cx.const_bitcast(value, dest_ty)
910915
}
911916

@@ -1007,7 +1012,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
10071012
else_block.add_assignment(None, variable, else_val);
10081013
else_block.end_with_jump(None, after_block);
10091014

1010-
// NOTE: since jumps were added in a place rustc does not expect, the current blocks in the
1015+
// NOTE: since jumps were added in a place rustc does not expect, the current block in the
10111016
// state need to be updated.
10121017
self.switch_to_block(after_block);
10131018

src/intrinsic/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
184184
then_block.end_with_jump(None, after_block);
185185

186186
// NOTE: since jumps were added in a place
187-
// count_leading_zeroes() does not expect, the current blocks
187+
// count_leading_zeroes() does not expect, the current block
188188
// in the state need to be updated.
189189
self.switch_to_block(else_block);
190190

@@ -198,7 +198,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
198198
self.llbb().end_with_jump(None, after_block);
199199

200200
// NOTE: since jumps were added in a place rustc does not
201-
// expect, the current blocks in the state need to be updated.
201+
// expect, the current block in the state need to be updated.
202202
self.switch_to_block(after_block);
203203

204204
result.to_rvalue()
@@ -1000,7 +1000,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
10001000
self.llbb().end_with_conditional(None, overflow, then_block, after_block);
10011001

10021002
// NOTE: since jumps were added in a place rustc does not
1003-
// expect, the current blocks in the state need to be updated.
1003+
// expect, the current block in the state need to be updated.
10041004
self.switch_to_block(after_block);
10051005

10061006
res.to_rvalue()
@@ -1070,7 +1070,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
10701070
self.llbb().end_with_conditional(None, overflow, then_block, after_block);
10711071

10721072
// NOTE: since jumps were added in a place rustc does not
1073-
// expect, the current blocks in the state need to be updated.
1073+
// expect, the current block in the state need to be updated.
10741074
self.switch_to_block(after_block);
10751075

10761076
res.to_rvalue()

0 commit comments

Comments
 (0)