Skip to content

Commit 7363500

Browse files
committed
[ValueTracking] Address review comments.
1 parent 7e71b3f commit 7363500

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7651,9 +7651,8 @@ static bool isGuaranteedNotToBeUndefOrPoison(
76517651
return true;
76527652
}
76537653

7654-
if (!::canCreateUndefOrPoison(Opr, Kind,
7655-
/*ConsiderFlagsAndMetadata=*/true)) {
7656-
if (const auto *PN = dyn_cast<PHINode>(V)) {
7654+
if (const auto *PN = dyn_cast<PHINode>(V)) {
7655+
if (!includesPoison(Kind) || !PN->hasPoisonGeneratingFlags()) {
76577656
unsigned Num = PN->getNumIncomingValues();
76587657
bool IsWellDefined = true;
76597658
for (unsigned i = 0; i < Num; ++i) {
@@ -7668,9 +7667,11 @@ static bool isGuaranteedNotToBeUndefOrPoison(
76687667
}
76697668
if (IsWellDefined)
76707669
return true;
7671-
} else if (all_of(Opr->operands(), OpCheck))
7672-
return true;
7673-
}
7670+
}
7671+
} else if (!::canCreateUndefOrPoison(Opr, Kind,
7672+
/*ConsiderFlagsAndMetadata=*/true) &&
7673+
all_of(Opr->operands(), OpCheck))
7674+
return true;
76747675
}
76757676

76767677
if (auto *I = dyn_cast<LoadInst>(V))

0 commit comments

Comments
 (0)