[PATCH] D107185: [LoopStrengthReduction] Fix pointer to int extend asserts

Brendon Cahoon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 30 12:58:37 PDT 2021


bcahoon added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:4082
   if (!DstTy) return;
   if (DstTy->isPointerTy())
     return;
----------------
efriedma wrote:
> Should we force Formula::getType() to always return an integer type, to avoid confusion like this in the future?
I'm not sure that would be correct?


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:4093
       // taking ext.
-      if (F.ScaledReg) {
+      if (F.ScaledReg && !F.ScaledReg->getType()->isPointerTy()) {
         const SCEV *NewScaledReg = SE.getAnyExtendExpr(F.ScaledReg, SrcTy);
----------------
efriedma wrote:
> This doesn't look right; I think if `F.ScaledReg->getType()->isPointerTy()` is true, you need to "continue", so we don't try to use a partially-transformed formula?
Thanks! I moved this check to occur prior to the loop.


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

https://reviews.llvm.org/D107185



More information about the llvm-commits mailing list