about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorTakayuki Maeda <takoyaki0316@gmail.com>2023-11-04 12:44:45 +0900
committerGitHub <noreply@github.com>2023-11-04 12:44:45 +0900
commitc55bf0e72fb51c1333e0552908d6d3f77ddc87b1 (patch)
tree5b63e90f03a2834b47271792ca5b2f2514e9ed1d /compiler/rustc_codegen_llvm/src
parentc9c851387e5ab0217c8c6c183928f52b82cd7be1 (diff)
parentf8daa7d4f6c13ca12f3074ee2ba4f9866a6f8bee (diff)
downloadrust-c55bf0e72fb51c1333e0552908d6d3f77ddc87b1.tar.gz
rust-c55bf0e72fb51c1333e0552908d6d3f77ddc87b1.zip
Rollup merge of #117554 - durin42:llvm-delete-dead-zext-code, r=nikic
consts: remove dead code around `i1` constant values

`LLVMConstZext` recently got deleted, and it turns out (thanks to `@nikic` for knowing!) that this is dead code. Tests all pass for me without this logic, and per nikic:

> We always generate constants in "relocatable bag of bytes"
> representation, so you're never going to get a plain bool.

So this should be a safe thing to do.

r? `@nikic`
`@rustbot` label: +llvm-main
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/consts.rs10
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm/ffi.rs1
2 files changed, 1 insertions, 10 deletions
diff --git a/compiler/rustc_codegen_llvm/src/consts.rs b/compiler/rustc_codegen_llvm/src/consts.rs
index 73821b1685d..307c1264dc1 100644
--- a/compiler/rustc_codegen_llvm/src/consts.rs
+++ b/compiler/rustc_codegen_llvm/src/consts.rs
@@ -374,15 +374,7 @@ impl<'ll> StaticMethods for CodegenCx<'ll, '_> {
 
             let g = self.get_static(def_id);
 
-            // boolean SSA values are i1, but they have to be stored in i8 slots,
-            // otherwise some LLVM optimization passes don't work as expected
-            let mut val_llty = self.val_ty(v);
-            let v = if val_llty == self.type_i1() {
-                val_llty = self.type_i8();
-                llvm::LLVMConstZExt(v, val_llty)
-            } else {
-                v
-            };
+            let val_llty = self.val_ty(v);
 
             let instance = Instance::mono(self.tcx, def_id);
             let ty = instance.ty(self.tcx, ty::ParamEnv::reveal_all());
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
index a038b3af03d..7fc02a95be0 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
@@ -969,7 +969,6 @@ extern "C" {
         ConstantIndices: *const &'a Value,
         NumIndices: c_uint,
     ) -> &'a Value;
-    pub fn LLVMConstZExt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
     pub fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
     pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
     pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;