Skip to content

Commit a8d5603

Browse files
authored
Unrolled build for rust-lang#117554
Rollup merge of rust-lang#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
2 parents 3aaa0f5 + f8daa7d commit a8d5603

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

compiler/rustc_codegen_llvm/src/consts.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -374,15 +374,7 @@ impl<'ll> StaticMethods for CodegenCx<'ll, '_> {
374374

375375
let g = self.get_static(def_id);
376376

377-
// boolean SSA values are i1, but they have to be stored in i8 slots,
378-
// otherwise some LLVM optimization passes don't work as expected
379-
let mut val_llty = self.val_ty(v);
380-
let v = if val_llty == self.type_i1() {
381-
val_llty = self.type_i8();
382-
llvm::LLVMConstZExt(v, val_llty)
383-
} else {
384-
v
385-
};
377+
let val_llty = self.val_ty(v);
386378

387379
let instance = Instance::mono(self.tcx, def_id);
388380
let ty = instance.ty(self.tcx, ty::ParamEnv::reveal_all());

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,6 @@ extern "C" {
969969
ConstantIndices: *const &'a Value,
970970
NumIndices: c_uint,
971971
) -> &'a Value;
972-
pub fn LLVMConstZExt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
973972
pub fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
974973
pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
975974
pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;

0 commit comments

Comments
 (0)