[llvm] [InstCombine] Allow overflowing selects to work on commutative arguments (PR #90812)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun May 5 20:14:52 PDT 2024
================
@@ -13,6 +13,18 @@ define i32 @uadd(i32 %x, i32 %y) {
ret i32 %s
}
+define i32 @uadd_cumm(i32 %x, i32 %y) {
+; CHECK-LABEL: @uadd_cumm(
+; CHECK-NEXT: [[S:%.*]] = call i32 @llvm.uadd.sat.i32(i32 [[X:%.*]], i32 [[Y:%.*]])
+; CHECK-NEXT: ret i32 [[S]]
+;
+ %ao = tail call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %x, i32 %y)
+ %o = extractvalue { i32, i1 } %ao, 1
+ %a = add i32 %y, %x
----------------
nikic wrote:
Does it? https://llvm.godbolt.org/z/3Wb4ao3e3
https://github.com/llvm/llvm-project/pull/90812
More information about the llvm-commits
mailing list