aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorJuneyoung Lee <aqjune@gmail.com>2020-03-01 07:22:03 +0900
committeraqjune <aqjune@gmail.com>2020-03-01 07:45:44 +0900
commit644e74768172500e3730811d0fb3e7fba9f1380d (patch)
tree13af0737d8eb5811c270163a81c9a52a66ba5921 /llvm/lib/Analysis/ValueTracking.cpp
parent282ec40504369e6533e03d7690417feb0da8cdd4 (diff)
downloadllvm-644e74768172500e3730811d0fb3e7fba9f1380d.zip
llvm-644e74768172500e3730811d0fb3e7fba9f1380d.tar.gz
llvm-644e74768172500e3730811d0fb3e7fba9f1380d.tar.bz2
[ValueTracking] Let getGuaranteedNonFullPoisonOp consider assume, remove mentioning about br
Summary: This patch helps getGuaranteedNonFullPoisonOp handle llvm.assume call. Also, a comment about the semantics of branch is removed to prevent confusion. As llvm.assume does, branching on poison directly raises UB (as LangRef says), and this allows transformations such as introduction of llvm.assume on branch condition at each successor, or freely replacing values after conditional branch (such as at loop exit). Handling br is not addressed in this patch. It makes SCEV more accurate, causing existing LoopVectorize/IndVar/etc tests to fail. Reviewers: spatel, lebedev.ri, nlopes Reviewed By: nlopes Subscribers: hiraditya, javed.absar, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D75397
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 650990d..e11f5e2 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4708,11 +4708,18 @@ const Value *llvm::getGuaranteedNonFullPoisonOp(const Instruction *I) {
case Instruction::SRem:
return I->getOperand(1);
+ case Instruction::Call:
+ if (auto *II = dyn_cast<IntrinsicInst>(I)) {
+ switch (II->getIntrinsicID()) {
+ case Intrinsic::assume:
+ return II->getArgOperand(0);
+ default:
+ return nullptr;
+ }
+ }
+ return nullptr;
+
default:
- // Note: It's really tempting to think that a conditional branch or
- // switch should be listed here, but that's incorrect. It's not
- // branching off of poison which is UB, it is executing a side effecting
- // instruction which follows the branch.
return nullptr;
}
}