[PATCH] D116499: [SCEV] Compute exit count from overflow check expressed w/ x.with.overflow intrinsics
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 4 09:14:08 PST 2022
reames added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:8101
+ if (EVI->getNumIndices() == 1 && EVI->getIndices()[0] == 1)
+ if (auto *WO = dyn_cast<WithOverflowInst>(EVI->getAggregateOperand())) {
+ const APInt *C;
----------------
nikic wrote:
> I'd write these three conditions as `match(ExitCond, m_ExtractValue<1>(m_WithOverflowInst(WO))`.
Thanks, this is *much* cleaner.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:8111
+ if (!ExitIfTrue)
+ Pred = ICmpInst::getInversePredicate(Pred);
+ auto *LHS = getSCEV(WO->getLHS());
----------------
nikic wrote:
> I didn't spot where this case is tested. Can you please add one where the successors are swapped? I see some tests using `xor -1`, but that doesn't appear to be supported by SCEV right now.
Oops, you're right. Will be covered by @sadd_symbolic_swapped once the change is pushed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116499/new/
https://reviews.llvm.org/D116499
More information about the llvm-commits
mailing list