[llvm] r280992 - [LV] Ensure proper handling of multi-use case when collecting uniforms

Matthew Simpson via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 14:38:26 PDT 2016


Author: mssimpso
Date: Thu Sep  8 16:38:26 2016
New Revision: 280992

URL: http://llvm.org/viewvc/llvm-project?rev=280992&view=rev
Log:
[LV] Ensure proper handling of multi-use case when collecting uniforms

The test case included in r280979 wasn't checking what it was supposed to be
checking for the predicated store case. Fixing the test revealed that the
multi-use case (when a pointer is used by both vectorized and scalarized memory
accesses) wasn't being handled properly. We can't skip over
non-consecutive-like pointers since they may have looked consecutive-like with
a different memory access.

Modified:
    llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
    llvm/trunk/test/Transforms/LoopVectorize/consecutive-ptr-uniforms.ll

Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=280992&r1=280991&r2=280992&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Thu Sep  8 16:38:26 2016
@@ -5388,9 +5388,9 @@ void LoopVectorizationLegality::collectL
   for (auto *BB : TheLoop->blocks())
     for (auto &I : *BB) {
 
-      // If the pointer operand is not consecutive-like, there's nothing to do.
+      // If there's no pointer operand, there's nothing to do.
       auto *Ptr = dyn_cast_or_null<Instruction>(getPointerOperand(&I));
-      if (!Ptr || isUniform(Ptr) || !hasConsecutiveLikePtrOperand(&I))
+      if (!Ptr)
         continue;
 
       // Ensure the memory instruction will not be scalarized, making its
@@ -5398,9 +5398,9 @@ void LoopVectorizationLegality::collectL
       if (memoryInstructionMustBeScalarized(&I))
         PossibleNonUniformPtrs.insert(Ptr);
 
-      // If the memory instruction will be vectorized, its consecutive-like
-      // pointer operand should remain uniform.
-      else
+      // If the memory instruction will be vectorized and its pointer operand
+      // is consecutive-like, the pointer operand should remain uniform.
+      else if (hasConsecutiveLikePtrOperand(&I))
         ConsecutiveLikePtrs.insert(Ptr);
     }
 

Modified: llvm/trunk/test/Transforms/LoopVectorize/consecutive-ptr-uniforms.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopVectorize/consecutive-ptr-uniforms.ll?rev=280992&r1=280991&r2=280992&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LoopVectorize/consecutive-ptr-uniforms.ll (original)
+++ llvm/trunk/test/Transforms/LoopVectorize/consecutive-ptr-uniforms.ll Thu Sep  8 16:38:26 2016
@@ -71,7 +71,9 @@ for.end:
   %tmp4 = phi i32 [ %tmp3, %for.body ]
   ret i32 %tmp4
 }
+
 ; CHECK-LABEL: interleaved_access_forward
+; INTER-LABEL: interleaved_access_forward
 ;
 ; Check that a consecutive-like pointer used by a forward interleaved group is
 ; recognized as uniform and remains uniform after vectorization. When
@@ -127,6 +129,7 @@ for.end:
 }
 
 ; CHECK-LABEL: interleaved_access_reverse
+; INTER-LABEL: interleaved_access_reverse
 ;
 ; Check that a consecutive-like pointer used by a reverse interleaved group is
 ; recognized as uniform and remains uniform after vectorization. When
@@ -185,7 +188,7 @@ for.end:
   ret i32 %tmp14
 }
 
-; CHECK-LABEL: predicated_store
+; INTER-LABEL: predicated_store
 ;
 ; Check that a consecutive-like pointer used by a forward interleaved group and
 ; scalarized store is not recognized as uniform and is not uniform after




More information about the llvm-commits mailing list