[PATCH] D101685: [IndVarSimplify][NFC] Removed mayThrow from if-condition in predicateLoopExits of IndVarSimplify

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 1 04:38:50 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1673
     for (auto &I : *BB)
       // TODO:isGuaranteedToTransfer
+      if (I.mayHaveSideEffects())
----------------
xbolva00 wrote:
> Or better, implement TODO?
Ideally we should be using SCEV loop properties here, which are cached. Unfortunately, the SCEV notion of "side effect" differs from what is needed here (SCEV ignores simple writes).

We could at least use loopHasNoAbnormalExits() though, which uses isGuaranteedToTransfer(). And I do believe that one is needed here -- I don't think the transform is valid if the loop contains a non-willreturn readonly call. It would be good to add a test for that case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101685



More information about the llvm-commits mailing list