[llvm] r372654 - [InstCombine] foldOrOfICmps(): Acquire SimplifyQuery with set CxtI
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 23 13:40:48 PDT 2019
Author: lebedevri
Date: Mon Sep 23 13:40:47 2019
New Revision: 372654
URL: http://llvm.org/viewvc/llvm-project?rev=372654&view=rev
Log:
[InstCombine] foldOrOfICmps(): Acquire SimplifyQuery with set CxtI
Extracted from https://reviews.llvm.org/D67849#inline-610377
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=372654&r1=372653&r2=372654&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Mon Sep 23 13:40:47 2019
@@ -2139,6 +2139,8 @@ Value *InstCombiner::matchSelectFromAndO
/// Fold (icmp)|(icmp) if possible.
Value *InstCombiner::foldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS,
Instruction &CxtI) {
+ const SimplifyQuery Q = SQ.getWithInstruction(&CxtI);
+
// Fold (iszero(A & K1) | iszero(A & K2)) -> (A & (K1 | K2)) != (K1 | K2)
// if K1 and K2 are a one-bit mask.
if (Value *V = foldAndOrOfICmpsOfAndWithPow2(LHS, RHS, false, CxtI))
@@ -2265,10 +2267,10 @@ Value *InstCombiner::foldOrOfICmps(ICmpI
return V;
if (Value *X =
- foldUnsignedUnderflowCheck(LHS, RHS, /*IsAnd=*/false, SQ, Builder))
+ foldUnsignedUnderflowCheck(LHS, RHS, /*IsAnd=*/false, Q, Builder))
return X;
if (Value *X =
- foldUnsignedUnderflowCheck(RHS, LHS, /*IsAnd=*/false, SQ, Builder))
+ foldUnsignedUnderflowCheck(RHS, LHS, /*IsAnd=*/false, Q, Builder))
return X;
// This only handles icmp of constants: (icmp1 A, C1) | (icmp2 B, C2).
More information about the llvm-commits
mailing list