diff options
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 58e23e9..b108111 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -6023,7 +6023,11 @@ const SCEV *ScalarEvolution::createNodeForPHI(PHINode *PN) { if (const SCEV *S = createAddRecFromPHI(PN)) return S; - if (Value *V = simplifyInstruction(PN, {getDataLayout(), &TLI, &DT, &AC})) + // We do not allow simplifying phi (undef, X) to X here, to avoid reusing the + // phi node for X. + if (Value *V = simplifyInstruction( + PN, {getDataLayout(), &TLI, &DT, &AC, /*CtxI=*/nullptr, + /*UseInstrInfo=*/true, /*CanUseUndef=*/false})) return getSCEV(V); if (const SCEV *S = createNodeFromSelectLikePHI(PN)) |