Skip to content

Commit bebfdc3

Browse files
committed
llvm: remove some workarounds in loadTruncate()
No longer needed with LLVM 21.
1 parent feb05a7 commit bebfdc3

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

src/codegen/llvm.zig

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11399,16 +11399,6 @@ pub const FuncGen = struct {
1139911399
const payload_llvm_ty = try o.lowerType(pt, payload_ty);
1140011400
const abi_size = payload_ty.abiSize(zcu);
1140111401

11402-
// llvm bug workarounds:
11403-
const workaround_explicit_mask = o.target.cpu.arch == .powerpc and abi_size >= 4;
11404-
const workaround_disable_truncate = o.target.cpu.arch == .wasm32 and abi_size >= 4;
11405-
11406-
if (workaround_disable_truncate) {
11407-
// see https://github.com/llvm/llvm-project/issues/64222
11408-
// disable the truncation codepath for larger than 32bits value - with this heuristic, the backend passes the test suite.
11409-
return try fg.wip.load(access_kind, payload_llvm_ty, payload_ptr, payload_alignment, "");
11410-
}
11411-
1141211402
const load_llvm_ty = if (payload_ty.isAbiInt(zcu))
1141311403
try o.builder.intType(@intCast(abi_size * 8))
1141411404
else
@@ -11422,14 +11412,7 @@ pub const FuncGen = struct {
1142211412
else
1142311413
loaded;
1142411414

11425-
const anded = if (workaround_explicit_mask and payload_llvm_ty != load_llvm_ty) blk: {
11426-
// this is rendundant with llvm.trunc. But without it, llvm17 emits invalid code for powerpc.
11427-
const mask_val = try o.builder.intValue(payload_llvm_ty, -1);
11428-
const zext_mask_val = try fg.wip.cast(.zext, mask_val, load_llvm_ty, "");
11429-
break :blk try fg.wip.bin(.@"and", shifted, zext_mask_val, "");
11430-
} else shifted;
11431-
11432-
return fg.wip.conv(.unneeded, anded, payload_llvm_ty, "");
11415+
return fg.wip.conv(.unneeded, shifted, payload_llvm_ty, "");
1143311416
}
1143411417

1143511418
/// Load a by-ref type by constructing a new alloca and performing a memcpy.

0 commit comments

Comments
 (0)