[llvm] [InstCombine] Infer nuw flags for `C-(X+C2)` -> `(C-C2)-X` (PR #72373)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 03:58:18 PST 2023


================
@@ -175,7 +175,7 @@ define i8 @add_nsw_const_const_sub_nsw_ov(i8 %arg) {
 
 define i8 @add_nuw_const_const_sub_nuw(i8 %arg) {
 ; CHECK-LABEL: @add_nuw_const_const_sub_nuw(
-; CHECK-NEXT:    [[T1:%.*]] = sub i8 -128, [[ARG:%.*]]
+; CHECK-NEXT:    [[T1:%.*]] = sub nuw i8 -128, [[ARG:%.*]]
----------------
nikic wrote:

Is there a test that has nuw only on the add? I only see one below with now on the sub.

https://github.com/llvm/llvm-project/pull/72373


More information about the llvm-commits mailing list