[llvm] [InstCombine] Teach foldSelectOpOp about samesign (PR #122723)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 13:58:57 PST 2025


================
@@ -134,6 +158,18 @@ define i1 @icmp_slt_common(i1 %c, i6 %x, i6 %y, i6 %z) {
   ret i1 %r
 }
 
+define i1 @icmp_slt_samesign_common(i1 %c, i6 %x, i6 %y, i6 %z) {
+; CHECK-LABEL: @icmp_slt_samesign_common(
+; CHECK-NEXT:    [[R_V:%.*]] = select i1 [[C:%.*]], i6 [[Y:%.*]], i6 [[Z:%.*]]
+; CHECK-NEXT:    [[R:%.*]] = icmp ult i6 [[X:%.*]], [[R_V]]
----------------
nikic wrote:

The bug is also visible in this test case.

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


More information about the llvm-commits mailing list