aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp7
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp27
2 files changed, 4 insertions, 30 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 45fd623..9fa78f3 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -5360,17 +5360,16 @@ Value *llvm::SimplifyCall(CallBase *Call, const SimplifyQuery &Q) {
}
/// Given operands for a Freeze, see if we can fold the result.
-static Value *SimplifyFreezeInst(Value *Op0, const SimplifyQuery &Q) {
+static Value *SimplifyFreezeInst(Value *Op0) {
// Use a utility function defined in ValueTracking.
- if (llvm::isGuaranteedNotToBeUndefOrPoison(Op0, Q.CxtI, Q.DT))
+ if (llvm::isGuaranteedNotToBeUndefOrPoison(Op0))
return Op0;
-
// We have room for improvement.
return nullptr;
}
Value *llvm::SimplifyFreezeInst(Value *Op0, const SimplifyQuery &Q) {
- return ::SimplifyFreezeInst(Op0, Q);
+ return ::SimplifyFreezeInst(Op0);
}
/// See if we can compute a simplified version of this instruction.
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 34f8abd..e11f5e2 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4525,9 +4525,7 @@ bool llvm::isOverflowIntrinsicNoWrap(const WithOverflowInst *WO,
return llvm::any_of(GuardingBranches, AllUsesGuardedByBranch);
}
-bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V,
- const Instruction *CtxI,
- const DominatorTree *DT) {
+bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V) {
// If the value is a freeze instruction, then it can never
// be undef or poison.
if (isa<FreezeInst>(V))
@@ -4560,29 +4558,6 @@ bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V,
return true;
}
- if (!CtxI || !DT)
- return false;
-
- // If V is used as a branch condition before reaching CtxI, V cannot be
- // undef or poison.
- // br V, BB1, BB2
- // BB1:
- // CtxI ; V cannot be undef or poison here
- auto Dominator = DT->getNode(CtxI->getParent())->getIDom();
- while (Dominator) {
- auto *TI = Dominator->getBlock()->getTerminator();
-
- if (auto BI = dyn_cast<BranchInst>(TI)) {
- if (BI->isConditional() && BI->getCondition() == V)
- return true;
- } else if (auto SI = dyn_cast<SwitchInst>(TI)) {
- if (SI->getCondition() == V)
- return true;
- }
-
- Dominator = Dominator->getIDom();
- }
-
return false;
}