[llvm] [polly] [InstSimplify] Fix incorrect poison propagation when folding phi (PR #96631)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 4 03:09:38 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))
----------------
DianQK wrote:
Maybe this is just my own problem. For me, it's always difficult to understand the negation of may/must semantics.
https://github.com/llvm/llvm-project/pull/96631
More information about the llvm-commits
mailing list