Really fix the load case.
authorTobias Grosser <tobias@grosser.es>
Fri, 18 Apr 2014 09:46:35 +0000 (09:46 +0000)
committerTobias Grosser <tobias@grosser.es>
Fri, 18 Apr 2014 09:46:35 +0000 (09:46 +0000)
Commit r206510 falsely advertised to fix the load cases, even though it only
fixed the store case. This commit adds the same fix for the load case including
the missing test coverage.

llvm-svn: 206577

polly/lib/CodeGen/BlockGenerators.cpp
polly/test/Cloog/CodeGen/vector_load_from_bitcast.ll

index ae404e8..7d36e83 100644 (file)
@@ -526,6 +526,10 @@ void VectorBlockGenerator::generateLoad(const LoadInst *Load,
 
   const MemoryAccess &Access = Statement.getAccessFor(Load);
 
+  // Make sure we have scalar values available to access the pointer to
+  // the data location.
+  extractScalarValues(Load, VectorMap, ScalarMaps);
+
   Value *NewLoad;
   if (Access.isStrideZero(isl_map_copy(Schedule)))
     NewLoad = generateStrideZeroLoad(Load, ScalarMaps[0]);
index 61973c6..bee5657 100644 (file)
@@ -15,8 +15,13 @@ for:
   %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
+  %scevgep3 = getelementptr float* %val, i32 %indvar
+  %scevgep162163 = bitcast float* %scevgep3 to float*
+  %ptr5 = load float* %scevgep162163, !tbaa !2816
+; CHECK: load <4 x float>
+  %add = fadd float undef, %ptr5
+  store float %add, float* %re115, !tbaa !2816
+; CHECK: store <4 x float>
 
   %indvar.next = add nsw i32 %indvar, 1
   %exitcond = icmp ne i32 %indvar.next, 4