diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-12-27 16:59:26 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-12-27 16:59:26 -0700 |
| commit | 886df772f06377df95f867e8b18ee47bbd0fcd8b (patch) | |
| tree | d8224b85c2b1691abf4ce669fce4b0aa0fc9e933 /src/codegen/llvm | |
| parent | 3abe464b06ab7d75954abda18dc41bf7af4a3839 (diff) | |
| download | zig-886df772f06377df95f867e8b18ee47bbd0fcd8b.tar.gz zig-886df772f06377df95f867e8b18ee47bbd0fcd8b.zip | |
stage2: LLVM backend: fix const packed structs
When doing LLVM const bit shifting we must make sure the integer bit
sizes are wide enough or else LLVM gives us a poison result.
Diffstat (limited to 'src/codegen/llvm')
| -rw-r--r-- | src/codegen/llvm/bindings.zig | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/codegen/llvm/bindings.zig b/src/codegen/llvm/bindings.zig index e6a61ca883..3c85524cc1 100644 --- a/src/codegen/llvm/bindings.zig +++ b/src/codegen/llvm/bindings.zig @@ -201,6 +201,11 @@ pub const Value = opaque { pub const addCase = LLVMAddCase; extern fn LLVMAddCase(Switch: *const Value, OnVal: *const Value, Dest: *const BasicBlock) void; + + pub inline fn isPoison(Val: *const Value) bool { + return LLVMIsPoison(Val).toBool(); + } + extern fn LLVMIsPoison(Val: *const Value) Bool; }; pub const Type = opaque { |
