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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 30 11:13:47 PDT 2021


efriedma added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:4082
   if (!DstTy) return;
   if (DstTy->isPointerTy())
     return;
----------------
Should we force Formula::getType() to always return an integer type, to avoid confusion like this in the future?


================
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);
----------------
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?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107185



More information about the llvm-commits mailing list