about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAntoni Boucher <bouanto@zoho.com>2024-11-18 18:39:41 -0500
committerAntoni Boucher <bouanto@zoho.com>2024-11-18 18:47:11 -0500
commitc2e6d38b8a44f92133c2cc44dace96fccc357d39 (patch)
treec60dd13eaa2626703fcf34c10324cee8595c0a04 /src
parent337a67de4942a0d7b04e0de665304fd0f7729ef6 (diff)
downloadrust-c2e6d38b8a44f92133c2cc44dace96fccc357d39.tar.gz
rust-c2e6d38b8a44f92133c2cc44dace96fccc357d39.zip
Remove unnecessary bitcast
Diffstat (limited to 'src')
-rw-r--r--src/builder.rs12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/builder.rs b/src/builder.rs
index 2839ff302a3..15ebcf42b3f 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -1103,7 +1103,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
 
     fn store_with_flags(
         &mut self,
-        mut val: RValue<'gcc>,
+        val: RValue<'gcc>,
         ptr: RValue<'gcc>,
         align: Align,
         flags: MemFlags,
@@ -1119,16 +1119,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
             modified_destination_type = modified_destination_type.make_volatile();
         }
 
-        // FIXME(antoyo): The type checking in `add_assignment` removes only one
-        // qualifier from each side. So the writes `int → volatile int` and
-        // `int → int __attribute__((aligned(1)))` are considered legal but
-        // `int → volatile int __attribute__((aligned(1)))` is not. This seems
-        // like a bug in libgccjit. The easiest way to work around this is to
-        // bitcast `val` to have the matching qualifiers.
-        val = self.cx.context.new_bitcast(None, val, modified_destination_type);
-
         let modified_ptr =
-            self.cx.context.new_bitcast(None, ptr, modified_destination_type.make_pointer());
+            self.cx.context.new_cast(None, ptr, modified_destination_type.make_pointer());
         let modified_destination = modified_ptr.dereference(None);
         self.llbb().add_assignment(None, modified_destination, val);
         // TODO(antoyo): handle `MemFlags::NONTEMPORAL`.