[PATCH] D104148: [LoopUtils] Fix incorrect RT check bounds for loop-invariant mem accesses

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 8 07:42:00 PDT 2021


fhahn added inline comments.


================
Comment at: llvm/lib/Analysis/LoopAccessAnalysis.cpp:204
+    ScStart = Sc;
+    ScEnd = SE->getAddExpr(Sc, SE->getOne(Ptr->getType()));
+  } else {
----------------
I think we should use the same code as in the `else` part to compute `ScEnd`. Perhaps we can just keep `ScStart = ScEnd = Sc` and move the increment code out of the `else`.

```
    // Add the size of the pointed element to ScEnd.
    auto &DL = Lp->getHeader()->getModule()->getDataLayout();
    Type *IdxTy = DL.getIndexType(Ptr->getType());
    const SCEV *EltSizeSCEV =
        SE->getStoreSizeOfExpr(IdxTy, Ptr->getType()->getPointerElementType());
    ScEnd = SE->getAddExpr(ScEnd, EltSizeSCEV);
```


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

https://reviews.llvm.org/D104148



More information about the llvm-commits mailing list