[llvm] 644e747 - [ValueTracking] Let getGuaranteedNonFullPoisonOp consider assume, remove mentioning about br
via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 29 14:45:51 PST 2020
Author: Juneyoung Lee
Date: 2020-03-01T07:45:44+09:00
New Revision: 644e74768172500e3730811d0fb3e7fba9f1380d
URL: https://github.com/llvm/llvm-project/commit/644e74768172500e3730811d0fb3e7fba9f1380d
DIFF: https://github.com/llvm/llvm-project/commit/644e74768172500e3730811d0fb3e7fba9f1380d.diff
LOG: [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
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 650990d22a3f..e11f5e2a8397 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;
}
}
More information about the llvm-commits
mailing list