authorgravatar for reserveblue@protonmail.comdrew <reserveblue@protonmail.com> 2021-11-14 19:26:12-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-11-16 16:51:31-07:00
logdffa6dcaf93621ab8bbfdb8effad8bde6d73c20a
tree9cf00541b702a4bae58775bd2925ae05d6e6d811
parentad4627ea3b645e4dd51397fe4a2d92878c2bd9bf

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


1 files changed, 2 insertions(+), 3 deletions(-)

src/codegen/c.zig+2-3
......@@ -1123,15 +1123,14 @@ fn genBody(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutO
11231123 .unreach => try airUnreach(f),
11241124 .fence => try airFence(f, inst),
11251125
1126 .ptr_add => try airPtrAddSub (f, inst, " + "),
1127 .ptr_sub => try airPtrAddSub (f, inst, " - "),
1128
11291126 // TODO use a different strategy for add that communicates to the optimizer
11301127 // that wrapping is UB.
11311128 .add => try airBinOp (f, inst, " + "),
1129 .ptr_add => try airPtrAddSub (f, inst, " + "),
11321130 // TODO use a different strategy for sub that communicates to the optimizer
11331131 // that wrapping is UB.
11341132 .sub => try airBinOp (f, inst, " - "),
1133 .ptr_sub => try airPtrAddSub (f, inst, " - "),
11351134 // TODO use a different strategy for mul that communicates to the optimizer
11361135 // that wrapping is UB.
11371136 .mul => try airBinOp (f, inst, " * "),