[PATCH] D89456: [SCEV] Introduce SCEVPtrToIntExpr (PR46786)

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 23 05:14:51 PDT 2020


mkazantsev accepted this revision.
mkazantsev added a comment.
This revision is now accepted and ready to land.

I don't see any more problems, thanks.



================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:8483
+    if (Op == Cast->getOperand())
+      return Cast; // must be loop invariant
+    return getPtrToIntExpr(Op, Cast->getType());
----------------
lebedev.ri wrote:
> mkazantsev wrote:
> > It doesn't look like the right way to check for loop invariance. `getSCEVAtScope` can potentially simplify your expression that is still invariant. Example: you have `Op = A + B` and loop is guarded by condition `B = 0`. `getSCEVAtScope(Op)` may return `A` which is still loop invariant, but not equal to `Op`.
> > 
> > What you might be looking for is `isAvailableAtLoopEntry`.
> Disclaimer: *i'm* not looking for loop invariance.
> This chunk is a verbatum copy-paste from `SCEVTruncateExpr`/`SCEVSignExtendExpr`/`SCEVZeroExtendExpr` handling above.
> If this isn't the right handling, then they are all wrong, and that's a preexisting problem.
Allright, maybe it's just a misleading comment then. Otherwise the code looks fine to me. I'll take a look later into these pieces.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89456/new/

https://reviews.llvm.org/D89456



More information about the llvm-commits mailing list