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

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 23 03:53:26 PDT 2020


mkazantsev added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:8483
+    if (Op == Cast->getOperand())
+      return Cast; // must be loop invariant
+    return getPtrToIntExpr(Op, Cast->getType());
----------------
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`.


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