zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit dffa6dcaf93621ab8bbfdb8effad8bde6d73c20a (tree)
parent ad4627ea3b645e4dd51397fe4a2d92878c2bd9bf
Author: drew <reserveblue@protonmail.com>
Date:   Sun, 14 Nov 2021 19:26:12 -0800

make it more clear we should do UB wrapping optimizations for ptr arithmetic

Diffstat:
Msrc/codegen/c.zig | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/codegen/c.zig b/src/codegen/c.zig @@ -1123,15 +1123,14 @@ fn genBody(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutO .unreach => try airUnreach(f), .fence => try airFence(f, inst), - .ptr_add => try airPtrAddSub (f, inst, " + "), - .ptr_sub => try airPtrAddSub (f, inst, " - "), - // TODO use a different strategy for add that communicates to the optimizer // that wrapping is UB. .add => try airBinOp (f, inst, " + "), + .ptr_add => try airPtrAddSub (f, inst, " + "), // TODO use a different strategy for sub that communicates to the optimizer // that wrapping is UB. .sub => try airBinOp (f, inst, " - "), + .ptr_sub => try airPtrAddSub (f, inst, " - "), // TODO use a different strategy for mul that communicates to the optimizer // that wrapping is UB. .mul => try airBinOp (f, inst, " * "),