From 6af4194de2e315a680e18d29fc7095d97232856a Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 29 May 2024 01:47:07 +0800 Subject: [PATCH 1/5] [InstCombine] Add pre-commit tests. NFC. --- .../test/Transforms/InstCombine/select-cmp.ll | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/llvm/test/Transforms/InstCombine/select-cmp.ll b/llvm/test/Transforms/InstCombine/select-cmp.ll index 711fac542179f..2d399245c7c70 100644 --- a/llvm/test/Transforms/InstCombine/select-cmp.ll +++ b/llvm/test/Transforms/InstCombine/select-cmp.ll @@ -345,4 +345,95 @@ define i1 @icmp_no_common(i1 %c, i8 %x, i8 %y, i8 %z) { ret i1 %r } +define i1 @test_select_inverse_eq(i64 %x, i1 %y) { +; CHECK-LABEL: @test_select_inverse_eq( +; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i64 [[X:%.*]], 0 +; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i64 [[X]], 0 +; CHECK-NEXT: [[SEL:%.*]] = select i1 [[Y:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: ret i1 [[SEL]] +; + %cmp1 = icmp ne i64 %x, 0 + %cmp2 = icmp eq i64 %x, 0 + %sel = select i1 %y, i1 %cmp1, i1 %cmp2 + ret i1 %sel +} + +define i1 @test_select_inverse_signed(i64 %x, i1 %y) { +; CHECK-LABEL: @test_select_inverse_signed( +; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i64 [[X:%.*]], -1 +; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i64 [[X]], 0 +; CHECK-NEXT: [[SEL:%.*]] = select i1 [[Y:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: ret i1 [[SEL]] +; + %cmp1 = icmp sgt i64 %x, -1 + %cmp2 = icmp slt i64 %x, 0 + %sel = select i1 %y, i1 %cmp1, i1 %cmp2 + ret i1 %sel +} + +define i1 @test_select_inverse_unsigned(i64 %x, i1 %y) { +; CHECK-LABEL: @test_select_inverse_unsigned( +; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i64 [[X:%.*]], 11 +; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i64 [[X]], 10 +; CHECK-NEXT: [[SEL:%.*]] = select i1 [[Y:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: ret i1 [[SEL]] +; + %cmp1 = icmp ult i64 %x, 11 + %cmp2 = icmp ugt i64 %x, 10 + %sel = select i1 %y, i1 %cmp1, i1 %cmp2 + ret i1 %sel +} + +define i1 @test_select_inverse_eq_ptr(ptr %x, i1 %y) { +; CHECK-LABEL: @test_select_inverse_eq_ptr( +; CHECK-NEXT: [[CMP1:%.*]] = icmp eq ptr [[X:%.*]], null +; CHECK-NEXT: [[CMP2:%.*]] = icmp ne ptr [[X]], null +; CHECK-NEXT: [[SEL:%.*]] = select i1 [[Y:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: ret i1 [[SEL]] +; + %cmp1 = icmp eq ptr %x, null + %cmp2 = icmp ne ptr %x, null + %sel = select i1 %y, i1 %cmp1, i1 %cmp2 + ret i1 %sel +} + +define i1 @test_select_inverse_fail(i64 %x, i1 %y) { +; CHECK-LABEL: @test_select_inverse_fail( +; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i64 [[X:%.*]], 0 +; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i64 [[X]], 0 +; CHECK-NEXT: [[SEL:%.*]] = select i1 [[Y:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: ret i1 [[SEL]] +; + %cmp1 = icmp sgt i64 %x, 0 + %cmp2 = icmp slt i64 %x, 0 + %sel = select i1 %y, i1 %cmp1, i1 %cmp2 + ret i1 %sel +} + +define <2 x i1> @test_select_inverse_vec(<2 x i64> %x, <2 x i1> %y) { +; CHECK-LABEL: @test_select_inverse_vec( +; CHECK-NEXT: [[CMP1:%.*]] = icmp ne <2 x i64> [[X:%.*]], zeroinitializer +; CHECK-NEXT: [[CMP2:%.*]] = icmp eq <2 x i64> [[X]], zeroinitializer +; CHECK-NEXT: [[SEL:%.*]] = select <2 x i1> [[Y:%.*]], <2 x i1> [[CMP1]], <2 x i1> [[CMP2]] +; CHECK-NEXT: ret <2 x i1> [[SEL]] +; + %cmp1 = icmp ne <2 x i64> %x, zeroinitializer + %cmp2 = icmp eq <2 x i64> %x, zeroinitializer + %sel = select <2 x i1> %y, <2 x i1> %cmp1, <2 x i1> %cmp2 + ret <2 x i1> %sel +} + +define <2 x i1> @test_select_inverse_vec_fail(<2 x i64> %x, i1 %y) { +; CHECK-LABEL: @test_select_inverse_vec_fail( +; CHECK-NEXT: [[CMP1:%.*]] = icmp ne <2 x i64> [[X:%.*]], zeroinitializer +; CHECK-NEXT: [[CMP2:%.*]] = icmp eq <2 x i64> [[X]], zeroinitializer +; CHECK-NEXT: [[SEL:%.*]] = select i1 [[Y:%.*]], <2 x i1> [[CMP1]], <2 x i1> [[CMP2]] +; CHECK-NEXT: ret <2 x i1> [[SEL]] +; + %cmp1 = icmp ne <2 x i64> %x, zeroinitializer + %cmp2 = icmp eq <2 x i64> %x, zeroinitializer + %sel = select i1 %y, <2 x i1> %cmp1, <2 x i1> %cmp2 + ret <2 x i1> %sel +} + declare void @use(i1) From c7fb076906dff0f140462c093571e7f555d1271e Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 29 May 2024 01:55:40 +0800 Subject: [PATCH 2/5] [InstCombine] Fold `select Cond, not X, X` into `Cond ^ X` --- .../InstCombine/InstCombineSelect.cpp | 34 +++++++++++++++++++ .../test/Transforms/InstCombine/select-cmp.ll | 25 ++++++-------- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index a3ddb402bf662..011b1c2e09c03 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -3502,6 +3502,34 @@ static bool matchFMulByZeroIfResultEqZero(InstCombinerImpl &IC, Value *Cmp0, return false; } +/// Return true iff: +/// 1. X is poison implies Y is poison. +/// 2. X is true implies Y is false. +/// 3. X is false implies Y is true. +/// Otherwise, return false. +static bool isKnownInversion(Value *X, Value *Y) { + // Handle X = icmp pred V, C1, Y = icmp pred V, C2. + Value *V; + Constant *C1, *C2; + ICmpInst::Predicate Pred1, Pred2; + if (!match(X, m_ICmp(Pred1, m_Value(V), m_Constant(C1))) || + !match(Y, m_ICmp(Pred2, m_Specific(V), m_Constant(C2)))) + return false; + + if (C1 == C2) + return Pred1 == ICmpInst::getInversePredicate(Pred2); + + // Try to infer the relationship from constant ranges. + const APInt *RHSC1, *RHSC2; + if (!match(C1, m_APInt(RHSC1)) || !match(C2, m_APInt(RHSC2))) + return false; + + const auto CR1 = ConstantRange::makeExactICmpRegion(Pred1, *RHSC1); + const auto CR2 = ConstantRange::makeExactICmpRegion(Pred2, *RHSC2); + + return CR1.inverse() == CR2; +} + Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) { Value *CondVal = SI.getCondition(); Value *TrueVal = SI.getTrueValue(); @@ -3996,5 +4024,11 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) { } } + // select Cond, !X, X -> xor Cond, X + // Note: We don't fold select Cond, Y, X -> X (iff X->Y & !X->!Y) here as + // it indicates that these two patterns should be canonicalized. + if (CondVal->getType() == SI.getType() && isKnownInversion(FalseVal, TrueVal)) + return BinaryOperator::CreateXor(CondVal, FalseVal); + return nullptr; } diff --git a/llvm/test/Transforms/InstCombine/select-cmp.ll b/llvm/test/Transforms/InstCombine/select-cmp.ll index 2d399245c7c70..8609bc5041ad8 100644 --- a/llvm/test/Transforms/InstCombine/select-cmp.ll +++ b/llvm/test/Transforms/InstCombine/select-cmp.ll @@ -347,9 +347,8 @@ define i1 @icmp_no_common(i1 %c, i8 %x, i8 %y, i8 %z) { define i1 @test_select_inverse_eq(i64 %x, i1 %y) { ; CHECK-LABEL: @test_select_inverse_eq( -; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i64 [[X:%.*]], 0 -; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i64 [[X]], 0 -; CHECK-NEXT: [[SEL:%.*]] = select i1 [[Y:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i64 [[X:%.*]], 0 +; CHECK-NEXT: [[SEL:%.*]] = xor i1 [[CMP2]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[SEL]] ; %cmp1 = icmp ne i64 %x, 0 @@ -360,9 +359,8 @@ define i1 @test_select_inverse_eq(i64 %x, i1 %y) { define i1 @test_select_inverse_signed(i64 %x, i1 %y) { ; CHECK-LABEL: @test_select_inverse_signed( -; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i64 [[X:%.*]], -1 -; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i64 [[X]], 0 -; CHECK-NEXT: [[SEL:%.*]] = select i1 [[Y:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i64 [[X:%.*]], 0 +; CHECK-NEXT: [[SEL:%.*]] = xor i1 [[CMP2]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[SEL]] ; %cmp1 = icmp sgt i64 %x, -1 @@ -373,9 +371,8 @@ define i1 @test_select_inverse_signed(i64 %x, i1 %y) { define i1 @test_select_inverse_unsigned(i64 %x, i1 %y) { ; CHECK-LABEL: @test_select_inverse_unsigned( -; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i64 [[X:%.*]], 11 -; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i64 [[X]], 10 -; CHECK-NEXT: [[SEL:%.*]] = select i1 [[Y:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i64 [[X:%.*]], 10 +; CHECK-NEXT: [[SEL:%.*]] = xor i1 [[CMP2]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[SEL]] ; %cmp1 = icmp ult i64 %x, 11 @@ -386,9 +383,8 @@ define i1 @test_select_inverse_unsigned(i64 %x, i1 %y) { define i1 @test_select_inverse_eq_ptr(ptr %x, i1 %y) { ; CHECK-LABEL: @test_select_inverse_eq_ptr( -; CHECK-NEXT: [[CMP1:%.*]] = icmp eq ptr [[X:%.*]], null -; CHECK-NEXT: [[CMP2:%.*]] = icmp ne ptr [[X]], null -; CHECK-NEXT: [[SEL:%.*]] = select i1 [[Y:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp ne ptr [[X:%.*]], null +; CHECK-NEXT: [[SEL:%.*]] = xor i1 [[CMP2]], [[Y:%.*]] ; CHECK-NEXT: ret i1 [[SEL]] ; %cmp1 = icmp eq ptr %x, null @@ -412,9 +408,8 @@ define i1 @test_select_inverse_fail(i64 %x, i1 %y) { define <2 x i1> @test_select_inverse_vec(<2 x i64> %x, <2 x i1> %y) { ; CHECK-LABEL: @test_select_inverse_vec( -; CHECK-NEXT: [[CMP1:%.*]] = icmp ne <2 x i64> [[X:%.*]], zeroinitializer -; CHECK-NEXT: [[CMP2:%.*]] = icmp eq <2 x i64> [[X]], zeroinitializer -; CHECK-NEXT: [[SEL:%.*]] = select <2 x i1> [[Y:%.*]], <2 x i1> [[CMP1]], <2 x i1> [[CMP2]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp eq <2 x i64> [[X:%.*]], zeroinitializer +; CHECK-NEXT: [[SEL:%.*]] = xor <2 x i1> [[CMP2]], [[Y:%.*]] ; CHECK-NEXT: ret <2 x i1> [[SEL]] ; %cmp1 = icmp ne <2 x i64> %x, zeroinitializer From 6d5cfb7998527d4b62b4a368c1a8c7affae25f74 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 4 Jun 2024 19:53:33 +0800 Subject: [PATCH 3/5] [InstCombine] Add more tests. NFC. --- .../test/Transforms/InstCombine/select-cmp.ll | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/llvm/test/Transforms/InstCombine/select-cmp.ll b/llvm/test/Transforms/InstCombine/select-cmp.ll index 8609bc5041ad8..2d12daca4b143 100644 --- a/llvm/test/Transforms/InstCombine/select-cmp.ll +++ b/llvm/test/Transforms/InstCombine/select-cmp.ll @@ -431,4 +431,56 @@ define <2 x i1> @test_select_inverse_vec_fail(<2 x i64> %x, i1 %y) { ret <2 x i1> %sel } +define i1 @test_select_inverse_nonconst1(i64 %x, i64 %y, i1 %cond) { +; CHECK-LABEL: @test_select_inverse_nonconst1( +; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i64 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i64 [[X]], [[Y]] +; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: ret i1 [[SEL]] +; + %cmp1 = icmp ne i64 %x, %y + %cmp2 = icmp eq i64 %x, %y + %sel = select i1 %cond, i1 %cmp1, i1 %cmp2 + ret i1 %sel +} + +define i1 @test_select_inverse_nonconst2(i64 %x, i64 %y, i1 %cond) { +; CHECK-LABEL: @test_select_inverse_nonconst2( +; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i64 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i64 [[Y]], [[X]] +; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: ret i1 [[SEL]] +; + %cmp1 = icmp ne i64 %x, %y + %cmp2 = icmp eq i64 %y, %x + %sel = select i1 %cond, i1 %cmp1, i1 %cmp2 + ret i1 %sel +} + +define i1 @test_select_inverse_nonconst3(i64 %x, i64 %y, i1 %cond) { +; CHECK-LABEL: @test_select_inverse_nonconst3( +; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i64 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i64 [[X]], [[Y]] +; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: ret i1 [[SEL]] +; + %cmp1 = icmp ult i64 %x, %y + %cmp2 = icmp uge i64 %x, %y + %sel = select i1 %cond, i1 %cmp1, i1 %cmp2 + ret i1 %sel +} + +define i1 @test_select_inverse_nonconst4(i64 %x, i64 %y, i64 %z, i1 %cond) { +; CHECK-LABEL: @test_select_inverse_nonconst4( +; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i64 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i64 [[Z:%.*]], [[Y]] +; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: ret i1 [[SEL]] +; + %cmp1 = icmp ult i64 %x, %y + %cmp2 = icmp uge i64 %z, %y + %sel = select i1 %cond, i1 %cmp1, i1 %cmp2 + ret i1 %sel +} + declare void @use(i1) From dab70ac2f2e4f3d2bac92585c32dc6aeb0200b25 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 4 Jun 2024 20:02:40 +0800 Subject: [PATCH 4/5] [InstCombine] Address review comments. --- .../Transforms/InstCombine/InstCombineSelect.cpp | 13 ++++++------- llvm/test/Transforms/InstCombine/select-cmp.ll | 15 ++++++--------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index 011b1c2e09c03..d62a8ef51923f 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -3508,20 +3508,19 @@ static bool matchFMulByZeroIfResultEqZero(InstCombinerImpl &IC, Value *Cmp0, /// 3. X is false implies Y is true. /// Otherwise, return false. static bool isKnownInversion(Value *X, Value *Y) { - // Handle X = icmp pred V, C1, Y = icmp pred V, C2. - Value *V; - Constant *C1, *C2; + // Handle X = icmp pred A, B, Y = icmp pred A, C. + Value *A, *B, *C; ICmpInst::Predicate Pred1, Pred2; - if (!match(X, m_ICmp(Pred1, m_Value(V), m_Constant(C1))) || - !match(Y, m_ICmp(Pred2, m_Specific(V), m_Constant(C2)))) + if (!match(X, m_ICmp(Pred1, m_Value(A), m_Value(B))) || + !match(Y, m_c_ICmp(Pred2, m_Specific(A), m_Value(C)))) return false; - if (C1 == C2) + if (B == C) return Pred1 == ICmpInst::getInversePredicate(Pred2); // Try to infer the relationship from constant ranges. const APInt *RHSC1, *RHSC2; - if (!match(C1, m_APInt(RHSC1)) || !match(C2, m_APInt(RHSC2))) + if (!match(B, m_APInt(RHSC1)) || !match(C, m_APInt(RHSC2))) return false; const auto CR1 = ConstantRange::makeExactICmpRegion(Pred1, *RHSC1); diff --git a/llvm/test/Transforms/InstCombine/select-cmp.ll b/llvm/test/Transforms/InstCombine/select-cmp.ll index 2d12daca4b143..4f75745643161 100644 --- a/llvm/test/Transforms/InstCombine/select-cmp.ll +++ b/llvm/test/Transforms/InstCombine/select-cmp.ll @@ -433,9 +433,8 @@ define <2 x i1> @test_select_inverse_vec_fail(<2 x i64> %x, i1 %y) { define i1 @test_select_inverse_nonconst1(i64 %x, i64 %y, i1 %cond) { ; CHECK-LABEL: @test_select_inverse_nonconst1( -; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i64 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i64 [[X]], [[Y]] -; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i64 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[SEL:%.*]] = xor i1 [[CMP2]], [[COND:%.*]] ; CHECK-NEXT: ret i1 [[SEL]] ; %cmp1 = icmp ne i64 %x, %y @@ -446,9 +445,8 @@ define i1 @test_select_inverse_nonconst1(i64 %x, i64 %y, i1 %cond) { define i1 @test_select_inverse_nonconst2(i64 %x, i64 %y, i1 %cond) { ; CHECK-LABEL: @test_select_inverse_nonconst2( -; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i64 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i64 [[Y]], [[X]] -; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i64 [[Y:%.*]], [[X:%.*]] +; CHECK-NEXT: [[SEL:%.*]] = xor i1 [[CMP2]], [[COND:%.*]] ; CHECK-NEXT: ret i1 [[SEL]] ; %cmp1 = icmp ne i64 %x, %y @@ -459,9 +457,8 @@ define i1 @test_select_inverse_nonconst2(i64 %x, i64 %y, i1 %cond) { define i1 @test_select_inverse_nonconst3(i64 %x, i64 %y, i1 %cond) { ; CHECK-LABEL: @test_select_inverse_nonconst3( -; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i64 [[X:%.*]], [[Y:%.*]] -; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i64 [[X]], [[Y]] -; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMP1]], i1 [[CMP2]] +; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i64 [[X:%.*]], [[Y:%.*]] +; CHECK-NEXT: [[SEL:%.*]] = xor i1 [[CMP2]], [[COND:%.*]] ; CHECK-NEXT: ret i1 [[SEL]] ; %cmp1 = icmp ult i64 %x, %y From a7cd5477abd57be6df86c8abf3ff25eb72758fb5 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 4 Jun 2024 21:55:00 +0800 Subject: [PATCH 5/5] [InstCombine] Remove misleading comments. NFC. --- llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp index d62a8ef51923f..4d2f2b4c1d268 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp @@ -4024,8 +4024,6 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) { } // select Cond, !X, X -> xor Cond, X - // Note: We don't fold select Cond, Y, X -> X (iff X->Y & !X->!Y) here as - // it indicates that these two patterns should be canonicalized. if (CondVal->getType() == SI.getType() && isKnownInversion(FalseVal, TrueVal)) return BinaryOperator::CreateXor(CondVal, FalseVal);