[llvm] [ValueTracking] Take PHI's poison-generating flags into account (PR #161530)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 1 07:59:23 PDT 2025
================
@@ -7651,25 +7651,26 @@ static bool isGuaranteedNotToBeUndefOrPoison(
return true;
}
- if (const auto *PN = dyn_cast<PHINode>(V)) {
- unsigned Num = PN->getNumIncomingValues();
- bool IsWellDefined = true;
- for (unsigned i = 0; i < Num; ++i) {
- if (PN == PN->getIncomingValue(i))
- continue;
- auto *TI = PN->getIncomingBlock(i)->getTerminator();
- if (!isGuaranteedNotToBeUndefOrPoison(PN->getIncomingValue(i), AC, TI,
- DT, Depth + 1, Kind)) {
- IsWellDefined = false;
- break;
+ if (!::canCreateUndefOrPoison(Opr, Kind,
+ /*ConsiderFlagsAndMetadata=*/true)) {
----------------
nikic wrote:
I think I'd prefer just checking `->hasPoisonGeneratingFlags()` in this case.
https://github.com/llvm/llvm-project/pull/161530
More information about the llvm-commits
mailing list