aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorDianQK <dianqk@dianqk.net>2025-03-07 05:46:32 +0800
committerGitHub <noreply@github.com>2025-03-07 05:46:32 +0800
commit462eb7e28ef4507b16a4b45efb356bc6a3523615 (patch)
treeddbcb296e8d709d5d80d379cf9a7b2a49bc3467d /llvm/lib/Analysis/ValueTracking.cpp
parent3492245ac07ca68f434035c6577f55c790270354 (diff)
downloadllvm-462eb7e28ef4507b16a4b45efb356bc6a3523615.zip
llvm-462eb7e28ef4507b16a4b45efb356bc6a3523615.tar.gz
llvm-462eb7e28ef4507b16a4b45efb356bc6a3523615.tar.bz2
[ValueTracking] Skip incoming values that are the same as the phi in `isGuaranteedNotToBeUndefOrPoison` (#130111)
Fixes (keep it open) #130110. If the incoming value is PHI itself, we can skip this. If we can guarantee that the other incoming values are neither undef nor poison, then we can also guarantee that the value isn't either. If we cannot guarantee that, it makes no sense in calculating it.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 31b0cae..08dc34f 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -7849,6 +7849,8 @@ static bool isGuaranteedNotToBeUndefOrPoison(
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)) {