forked from OSchip/llvm-project
Let isGuaranteedNotToBeUndefOrPoison consider PHINode with constant values
This commit is contained in:
parent
cd14b4a62b
commit
36272d5f00
|
@ -4522,6 +4522,13 @@ bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V) {
|
||||||
if (isa<ConstantInt>(V) || isa<GlobalVariable>(V))
|
if (isa<ConstantInt>(V) || isa<GlobalVariable>(V))
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue