[llvm] [ConstraintElim] Check if second op implies first for And. (PR #75750)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 12:38:33 PST 2023


================
@@ -128,7 +128,7 @@ define i1 @test_same_cond_for_and_select_form(i8 %x) {
 ; CHECK-LABEL: @test_same_cond_for_and_select_form(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C_1:%.*]] = icmp ugt i8 [[X:%.*]], 10
-; CHECK-NEXT:    [[AND:%.*]] = select i1 [[C_1]], i1 true, i1 false
+; CHECK-NEXT:    [[AND:%.*]] = select i1 [[C_1]], i1 [[C_1]], i1 false
----------------
fhahn wrote:

In this case, both conds are the same, and in the new code we will try `OtherOpIdx = 1` first, which then hits the early-exit condition for selects; Not sure if it is worth avoiding that and complicating the conditions.

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


More information about the llvm-commits mailing list