diff options
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; } |