[PATCH] D71539: [SCEV] Look through trivial PHIs.
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 28 07:09:16 PDT 2020
mkazantsev accepted this revision.
mkazantsev added a comment.
This revision is now accepted and ready to land.
Looks good (with nits).
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:3692
}
-
/// Return an existing SCEV if it exists, otherwise analyze the expression and
----------------
Nit
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:3717
// If V is GetElementPtrInst, don't save Stripped -> {V, offset}
// because it may generate add/sub instead of GEP in SCEV expansion.
if (Offset != nullptr && !isa<SCEVUnknown>(Stripped) &&
----------------
Does this comment need explanation about what do we do for Phis?
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:5120
- // If the PHI has a single incoming value, follow that value, unless the
- // PHI's incoming blocks are in a different loop, in which case doing so
- // risks breaking LCSSA form. Instcombine would normally zap these, but
- // it doesn't have DominatorTree information, so it may miss cases.
if (Value *V = SimplifyInstruction(PN, {getDataLayout(), &TLI, &DT, &AC}))
+ return getSCEV(V);
----------------
`assert(LI.replacementPreservesLCSSAForm(PN, V))`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71539/new/
https://reviews.llvm.org/D71539
More information about the llvm-commits
mailing list