[llvm] [polly] [InstSimplify] Fix incorrect poison propagation when folding phi (PR #96631)
Ralf Jung via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 4 03:13:46 PDT 2024
================
@@ -5278,7 +5278,14 @@ static Value *simplifyPHINode(PHINode *PN, ArrayRef<Value *> IncomingValues,
// If we have a PHI node like phi(X, undef, X), where X is defined by some
// instruction, we cannot return X as the result of the PHI node unless it
// dominates the PHI block.
- return valueDominatesPHI(CommonValue, PN, Q.DT) ? CommonValue : nullptr;
+ if (!valueDominatesPHI(CommonValue, PN, Q.DT))
+ return nullptr;
+
+ // Make sure we do not replace an undef value with poison.
+ if (HasUndefInput &&
+ !isGuaranteedNotToBePoison(CommonValue, Q.AC, Q.CxtI, Q.DT))
----------------
RalfJung wrote:
This is even a double-negation ("not guaranteed to not be poison"), so it's definitely not just you^^
https://github.com/llvm/llvm-project/pull/96631
More information about the llvm-commits
mailing list