diff options
author | Juneyoung Lee <aqjune@gmail.com> | 2020-02-04 16:46:54 +0900 |
---|---|---|
committer | Juneyoung Lee <aqjune@gmail.com> | 2020-02-04 16:46:54 +0900 |
commit | 36272d5f005f85ffa20eb57544865c3da584c4ce (patch) | |
tree | 985f1ddbf95131bc710ae704fa2a7561cdc6f0d2 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | cd14b4a62bdb78ba31d30871c1dfb27517721862 (diff) | |
download | llvm-36272d5f005f85ffa20eb57544865c3da584c4ce.zip llvm-36272d5f005f85ffa20eb57544865c3da584c4ce.tar.gz llvm-36272d5f005f85ffa20eb57544865c3da584c4ce.tar.bz2 |
Let isGuaranteedNotToBeUndefOrPoison consider PHINode with constant values
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index a6bb2bc..6b88cd0 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; } |