Skip to content

Commit c2e6d38

Browse files
committed
Remove unnecessary bitcast
1 parent 337a67d commit c2e6d38

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/builder.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
11031103

11041104
fn store_with_flags(
11051105
&mut self,
1106-
mut val: RValue<'gcc>,
1106+
val: RValue<'gcc>,
11071107
ptr: RValue<'gcc>,
11081108
align: Align,
11091109
flags: MemFlags,
@@ -1119,16 +1119,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
11191119
modified_destination_type = modified_destination_type.make_volatile();
11201120
}
11211121

1122-
// FIXME(antoyo): The type checking in `add_assignment` removes only one
1123-
// qualifier from each side. So the writes `int → volatile int` and
1124-
// `int → int __attribute__((aligned(1)))` are considered legal but
1125-
// `int → volatile int __attribute__((aligned(1)))` is not. This seems
1126-
// like a bug in libgccjit. The easiest way to work around this is to
1127-
// bitcast `val` to have the matching qualifiers.
1128-
val = self.cx.context.new_bitcast(None, val, modified_destination_type);
1129-
11301122
let modified_ptr =
1131-
self.cx.context.new_bitcast(None, ptr, modified_destination_type.make_pointer());
1123+
self.cx.context.new_cast(None, ptr, modified_destination_type.make_pointer());
11321124
let modified_destination = modified_ptr.dereference(None);
11331125
self.llbb().add_assignment(None, modified_destination, val);
11341126
// TODO(antoyo): handle `MemFlags::NONTEMPORAL`.

0 commit comments

Comments
 (0)