[llvm] 36272d5 - Let isGuaranteedNotToBeUndefOrPoison consider PHINode with constant values
Juneyoung Lee via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 3 23:47:16 PST 2020
Author: Juneyoung Lee
Date: 2020-02-04T16:46:54+09:00
New Revision: 36272d5f005f85ffa20eb57544865c3da584c4ce
URL: https://github.com/llvm/llvm-project/commit/36272d5f005f85ffa20eb57544865c3da584c4ce
DIFF: https://github.com/llvm/llvm-project/commit/36272d5f005f85ffa20eb57544865c3da584c4ce.diff
LOG: Let isGuaranteedNotToBeUndefOrPoison consider PHINode with constant values
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index a6bb2bc9d6cf..6b88cd05b2d7 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4522,6 +4522,13 @@ bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V) {
if (isa<ConstantInt>(V) || isa<GlobalVariable>(V))
return true;
+ if (auto PN = dyn_cast<PHINode>(V)) {
+ if (llvm::all_of(PN->incoming_values(), [](const Use &U) {
+ return isa<ConstantInt>(U.get());
+ }))
+ return true;
+ }
+
return false;
}
More information about the llvm-commits
mailing list