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

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 20 01:18:45 PST 2020


dmgreen added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopFlatten.cpp:551
 
-  auto HasSExtUser = [] (Value *V) -> Value * {
+  auto GetTruncValue = [] (Value *V) -> Value * {
     for (User *U : V->users() )
----------------
Is is better to introduce a new trunc of FI.OuterInductionPHI to the correct bitwidth? I'm a little worried that this is just finding _some_ trunc, not necessarily one that it should. It may introduce more truncs but they should get cleared up. It would also prevent using something that did not dominate.

Maybe it is fine like this, if it is know that the widening will have introduced a trunc. Can it at least check the type of the trunc is correct? And add a comment saying it should have been added by widening.


================
Comment at: llvm/lib/Transforms/Scalar/LoopFlatten.cpp:562
+    Value *OuterValue = FI.OuterInductionPHI;
+    if (FI.Widened)
+      OuterValue = GetTruncValue(FI.OuterInductionPHI);
----------------
Finding the `Value *OuterValue = FI.OuterInductionPHI; if (...`  can be outside of the loop.


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

https://reviews.llvm.org/D91690



More information about the llvm-commits mailing list