[PATCH] D35227: [LV] Don't allow outside uses of IVs if the SCEV is predicated on loop conditions

Gil Rapaport via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 16 04:19:02 PDT 2017


gilr added inline comments.


================
Comment at: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp:5321
+  // currently means re-using this SCEV outside the loop.
+  if (PSE.getUnionPredicate().isAlwaysTrue()) {
+    AllowedExit.insert(Phi);
----------------
Can we narrow the check as documented above to only check if the phi's SCEV relies on predicates?


================
Comment at: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp:5322
+  if (PSE.getUnionPredicate().isAlwaysTrue()) {
+    AllowedExit.insert(Phi);
+    AllowedExit.insert(Phi->getIncomingValueForBlock(TheLoop->getLoopLatch()));
----------------
The phi node is presumably guaranteed not to overflow also on the last iteration, so should be correct as a live out, right?


================
Comment at: llvm/trunk/test/Transforms/LoopVectorize/pr33706.ll:8
+; CHECK-LABEL: @PR33706
+; CHECK-NOT: <2 x i32>
+define void @PR33706(float* nocapture readonly %arg, float* nocapture %arg1, i32 %arg2) local_unnamed_addr {
----------------
It would be good to document the specific problem in vectorizing this loop, which is the live-out value %tmp20. When %arg2 == 1, the trip count is 65536 and %tmp20 coming out of the loop should be 0 (65536 & 65535), but currently LV pre-computes the live-out in the pre-header as 65536.
Right?

Can the test be minimized?


Repository:
  rL LLVM

https://reviews.llvm.org/D35227





More information about the llvm-commits mailing list