[polly] r206510 - Ensure a scalar pointer when issuing a vector load
Tobias Grosser
tobias at grosser.es
Thu Apr 17 16:13:49 PDT 2014
Author: grosser
Date: Thu Apr 17 18:13:49 2014
New Revision: 206510
URL: http://llvm.org/viewvc/llvm-project?rev=206510&view=rev
Log:
Ensure a scalar pointer when issuing a vector load
Even tough we may want to generate a vector load, the address from which to load
still is a scalar. Make sure even if previous address computations may have been
vectorized, that the addresses are also available as scalars.
This fixes http://llvm.org/PR19469
Reported-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Added:
polly/trunk/test/Cloog/CodeGen/vector_load_from_bitcast.ll
Modified:
polly/trunk/lib/CodeGen/BlockGenerators.cpp
Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=206510&r1=206509&r2=206510&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Thu Apr 17 18:13:49 2014
@@ -580,6 +580,10 @@ void VectorBlockGenerator::copyStore(con
Value *Vector = getVectorValue(Store->getValueOperand(), VectorMap,
ScalarMaps, getLoopForInst(Store));
+ // Make sure we have scalar values available to access the pointer to
+ // the data location.
+ extractScalarValues(Store, VectorMap, ScalarMaps);
+
if (Access.isStrideOne(isl_map_copy(Schedule))) {
Type *VectorPtrType = getVectorPtrTy(Pointer, VectorWidth);
Value *NewPointer = getNewValue(Pointer, ScalarMaps[0], GlobalMaps[0],
Added: polly/trunk/test/Cloog/CodeGen/vector_load_from_bitcast.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Cloog/CodeGen/vector_load_from_bitcast.ll?rev=206510&view=auto
==============================================================================
--- polly/trunk/test/Cloog/CodeGen/vector_load_from_bitcast.ll (added)
+++ polly/trunk/test/Cloog/CodeGen/vector_load_from_bitcast.ll Thu Apr 17 18:13:49 2014
@@ -0,0 +1,32 @@
+; RUN: opt %loadPolly -tbaa -polly-codegen -polly-vectorizer=polly -S < %s | FileCheck %s
+
+target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128"
+target triple = "i386-apple-macosx10.8.0"
+
+define void @foo(float** %tone) {
+preheader:
+ br label %for
+
+for:
+ %indvar = phi i32 [ %indvar.next, %for ], [ 0, %preheader ]
+ %ptr1 = getelementptr inbounds float** %tone, i32 0
+ %val = load float** %ptr1, align 4, !tbaa !2817
+ %ptr2 = getelementptr float* %val, i32 %indvar
+ %re115 = bitcast float* %ptr2 to float*
+; CHECK: %val_p_vec_p = bitcast float** %p_ptr1 to <1 x float*>*
+
+ store float undef, float* %re115, !tbaa !2816
+; CHECK: store <4 x float> undef, <4 x float>* %vector_ptr
+
+ %indvar.next = add nsw i32 %indvar, 1
+ %exitcond = icmp ne i32 %indvar.next, 4
+ br i1 %exitcond, label %for, label %end
+
+end:
+ unreachable
+}
+
+!2814 = metadata !{metadata !"Simple C/C++ TBAA"}
+!2813 = metadata !{metadata !"omnipotent char", metadata !2814, i64 0}
+!2816 = metadata !{metadata !"int", metadata !2813, i64 0}
+!2817 = metadata !{metadata !"short", metadata !2813, i64 0}
More information about the llvm-commits
mailing list