[llvm] 8652c3e - [InstSimplify] Pass SimplifyQuery to computePointerICmp (NFC)
Juneyoung Lee via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 10 18:13:57 PST 2021
Author: Juneyoung Lee
Date: 2021-03-11T11:13:46+09:00
New Revision: 8652c3e1a3731052c74c82fe831773fc40b7b17e
URL: https://github.com/llvm/llvm-project/commit/8652c3e1a3731052c74c82fe831773fc40b7b17e
DIFF: https://github.com/llvm/llvm-project/commit/8652c3e1a3731052c74c82fe831773fc40b7b17e.diff
LOG: [InstSimplify] Pass SimplifyQuery to computePointerICmp (NFC)
Added:
Modified:
llvm/lib/Analysis/InstructionSimplify.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index f7b656d88dfa..fe298fd8006a 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -2486,10 +2486,15 @@ static Value *ExtractEquivalentCondition(Value *V, CmpInst::Predicate Pred,
// area, it may be possible to update LLVM's semantics accordingly and reinstate
// this optimization.
static Constant *
-computePointerICmp(const DataLayout &DL, const TargetLibraryInfo *TLI,
- const DominatorTree *DT, CmpInst::Predicate Pred,
- AssumptionCache *AC, const Instruction *CxtI,
- const InstrInfoQuery &IIQ, Value *LHS, Value *RHS) {
+computePointerICmp(CmpInst::Predicate Pred, Value *LHS, Value *RHS,
+ const SimplifyQuery &Q) {
+ const DataLayout &DL = Q.DL;
+ const TargetLibraryInfo *TLI = Q.TLI;
+ const DominatorTree *DT = Q.DT;
+ AssumptionCache *AC = Q.AC;
+ const Instruction *CxtI = Q.CxtI;
+ const InstrInfoQuery &IIQ = Q.IIQ;
+
// First, skip past any trivial no-ops.
LHS = LHS->stripPointerCasts();
RHS = RHS->stripPointerCasts();
@@ -3651,8 +3656,7 @@ static Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
// Simplify comparisons of related pointers using a powerful, recursive
// GEP-walk when we have target data available..
if (LHS->getType()->isPointerTy())
- if (auto *C = computePointerICmp(Q.DL, Q.TLI, Q.DT, Pred, Q.AC, Q.CxtI,
- Q.IIQ, LHS, RHS))
+ if (auto *C = computePointerICmp(Pred, LHS, RHS, Q))
return C;
if (auto *CLHS = dyn_cast<PtrToIntOperator>(LHS))
if (auto *CRHS = dyn_cast<PtrToIntOperator>(RHS))
@@ -3660,9 +3664,8 @@ static Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
Q.DL.getTypeSizeInBits(CLHS->getType()) &&
Q.DL.getTypeSizeInBits(CRHS->getPointerOperandType()) ==
Q.DL.getTypeSizeInBits(CRHS->getType()))
- if (auto *C = computePointerICmp(Q.DL, Q.TLI, Q.DT, Pred, Q.AC, Q.CxtI,
- Q.IIQ, CLHS->getPointerOperand(),
- CRHS->getPointerOperand()))
+ if (auto *C = computePointerICmp(Pred, CLHS->getPointerOperand(),
+ CRHS->getPointerOperand(), Q))
return C;
if (GetElementPtrInst *GLHS = dyn_cast<GetElementPtrInst>(LHS)) {
More information about the llvm-commits
mailing list