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...@@ -1123,15 +1123,14 @@ fn genBody(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, OutO
1123 .unreach => try airUnreach(f),1123 .unreach => try airUnreach(f),
1124 .fence => try airFence(f, inst),1124 .fence => try airFence(f, inst),
11251125
1126 .ptr_add => try airPtrAddSub (f, inst, " + "),
1127 .ptr_sub => try airPtrAddSub (f, inst, " - "),
1128
1129 // TODO use a different strategy for add that communicates to the optimizer1126 // TODO use a different strategy for add that communicates to the optimizer
1130 // that wrapping is UB.1127 // that wrapping is UB.
1131 .add => try airBinOp (f, inst, " + "),1128 .add => try airBinOp (f, inst, " + "),
1129 .ptr_add => try airPtrAddSub (f, inst, " + "),
1132 // TODO use a different strategy for sub that communicates to the optimizer1130 // TODO use a different strategy for sub that communicates to the optimizer
1133 // that wrapping is UB.1131 // that wrapping is UB.
1134 .sub => try airBinOp (f, inst, " - "),1132 .sub => try airBinOp (f, inst, " - "),
1133 .ptr_sub => try airPtrAddSub (f, inst, " - "),
1135 // TODO use a different strategy for mul that communicates to the optimizer1134 // TODO use a different strategy for mul that communicates to the optimizer
1136 // that wrapping is UB.1135 // that wrapping is UB.
1137 .mul => try airBinOp (f, inst, " * "),1136 .mul => try airBinOp (f, inst, " * "),