aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/llvm.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 0d314aebdf..4af42bfa9b 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -8753,6 +8753,15 @@ pub const FuncGen = struct {
const val_is_undef = if (try self.air.value(bin_op.rhs, mod)) |val| val.isUndefDeep(mod) else false;
if (val_is_undef) {
+ const ptr_info = ptr_ty.ptrInfo(mod);
+ const needs_bitmask = (ptr_info.packed_offset.host_size != 0);
+ if (needs_bitmask) {
+ // TODO: only some bits are to be undef, we cannot write with a simple memset.
+ // meanwhile, ignore the write rather than stomping over valid bits.
+ // https://github.com/ziglang/zig/issues/15337
+ return .none;
+ }
+
// Even if safety is disabled, we still emit a memset to undefined since it conveys
// extra information to LLVM. However, safety makes the difference between using
// 0xaa or actual undefined for the fill byte.