[llvm] r188980 - Teach LoopVectorize about address space sizes
Matt Arsenault
Matthew.Arsenault at amd.com
Wed Aug 21 19:42:55 PDT 2013
Author: arsenm
Date: Wed Aug 21 21:42:55 2013
New Revision: 188980
URL: http://llvm.org/viewvc/llvm-project?rev=188980&view=rev
Log:
Teach LoopVectorize about address space sizes
Modified:
llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/trunk/test/Transforms/LoopVectorize/no_int_induction.ll
Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=188980&r1=188979&r2=188980&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Wed Aug 21 21:42:55 2013
@@ -2667,7 +2667,8 @@ bool LoopVectorizationLegality::canVecto
static Type *convertPointerToIntegerType(DataLayout &DL, Type *Ty) {
if (Ty->isPointerTy())
- return DL.getIntPtrType(Ty->getContext());
+ return DL.getIntPtrType(Ty);
+
return Ty;
}
Modified: llvm/trunk/test/Transforms/LoopVectorize/no_int_induction.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopVectorize/no_int_induction.ll?rev=188980&r1=188979&r2=188980&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LoopVectorize/no_int_induction.ll (original)
+++ llvm/trunk/test/Transforms/LoopVectorize/no_int_induction.ll Wed Aug 21 21:42:55 2013
@@ -4,10 +4,10 @@
; return std::accumulate(A, A + n, 0);
; }
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.8.0"
+target datalayout = "e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-n8:16:32:64-S128"
;CHECK-LABEL: @sum_array(
+;CHECK: phi i64
;CHECK: phi <4 x i32>
;CHECK: load <4 x i32>
;CHECK: add nsw <4 x i32>
@@ -28,6 +28,33 @@ define i32 @sum_array(i32* %A, i32 %n) n
br i1 %7, label %_ZSt10accumulateIPiiET0_T_S2_S1_.exit, label %.lr.ph.i
_ZSt10accumulateIPiiET0_T_S2_S1_.exit: ; preds = %.lr.ph.i, %0
+ %.01.lcssa.i = phi i32 [ 0, %0 ], [ %5, %.lr.ph.i ]
+ ret i32 %.01.lcssa.i
+}
+
+; Same, but use a pointer with a different size.
+;CHECK-LABEL: @sum_array_as1(
+;CHECK: phi i16
+;CHECK: phi <4 x i32>
+;CHECK: load <4 x i32>
+;CHECK: add nsw <4 x i32>
+;CHECK: ret i32
+define i32 @sum_array_as1(i32 addrspace(1)* %A, i32 %n) nounwind uwtable readonly noinline ssp {
+ %1 = sext i32 %n to i64
+ %2 = getelementptr inbounds i32 addrspace(1)* %A, i64 %1
+ %3 = icmp eq i32 %n, 0
+ br i1 %3, label %_ZSt10accumulateIPiiET0_T_S2_S1_.exit, label %.lr.ph.i
+
+.lr.ph.i: ; preds = %0, %.lr.ph.i
+ %.03.i = phi i32 addrspace(1)* [ %6, %.lr.ph.i ], [ %A, %0 ]
+ %.012.i = phi i32 [ %5, %.lr.ph.i ], [ 0, %0 ]
+ %4 = load i32 addrspace(1)* %.03.i, align 4
+ %5 = add nsw i32 %4, %.012.i
+ %6 = getelementptr inbounds i32 addrspace(1)* %.03.i, i64 1
+ %7 = icmp eq i32 addrspace(1)* %6, %2
+ br i1 %7, label %_ZSt10accumulateIPiiET0_T_S2_S1_.exit, label %.lr.ph.i
+
+_ZSt10accumulateIPiiET0_T_S2_S1_.exit: ; preds = %.lr.ph.i, %0
%.01.lcssa.i = phi i32 [ 0, %0 ], [ %5, %.lr.ph.i ]
ret i32 %.01.lcssa.i
}
More information about the llvm-commits
mailing list