[PATCH] D91690: [LoopFlatten] Widen IV, cont'd

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 11:06:15 PST 2020


dmgreen added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopFlatten.cpp:342
+  if (FI.Widened &&
+      (dyn_cast<SExtInst>(InnerLimit) || dyn_cast<ZExtInst>(InnerLimit)))
+    InnerLimit = dyn_cast<Instruction>(InnerLimit)->getOperand(0);
----------------
dyn_cast -> isa


================
Comment at: llvm/lib/Transforms/Scalar/LoopFlatten.cpp:343
+      (dyn_cast<SExtInst>(InnerLimit) || dyn_cast<ZExtInst>(InnerLimit)))
+    InnerLimit = dyn_cast<Instruction>(InnerLimit)->getOperand(0);
 
----------------
dyn_cast -> cast


================
Comment at: llvm/lib/Transforms/Scalar/LoopFlatten.cpp:552
+  auto HasSZExtUser = [] (Value *V) -> Value * {
     for (User *U : V->users() )
+      if (dyn_cast<SExtInst>(U) || dyn_cast<ZExtInst>(U))
----------------
Some of the formatting is still a little off here.



================
Comment at: llvm/lib/Transforms/Scalar/LoopFlatten.cpp:563
+    if (FI.Widened)
+      if (Value *U = HasSZExtUser(V))
+        V = U;
----------------
I'm not sure I understand any more. Should we not be replacing it with trunc(OuterInductionPHI) ?

Can you add a test where it (the o*I+i value) is not zext or sext?


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

https://reviews.llvm.org/D91690



More information about the llvm-commits mailing list