From 5fd5b125ff41088c005b7107e8cf92f281313040 Mon Sep 17 00:00:00 2001 From: Andrew Trick Date: Fri, 18 Mar 2011 16:50:32 +0000 Subject: Avoid creating canonical induction variables for non-native types. For example, on 32-bit architecture, don't promote all uses of the IV to 64-bits just because one use is a 64-bit cast. Alternate implementation of the patch by Arnaud de Grandmaison. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127884 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll | 2 +- test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll | 2 +- test/Transforms/IndVarSimplify/ada-loops.ll | 2 +- test/Transforms/IndVarSimplify/addrec-gep.ll | 2 +- test/Transforms/IndVarSimplify/ashr-tripcount.ll | 2 +- test/Transforms/IndVarSimplify/iv-sext.ll | 2 +- test/Transforms/IndVarSimplify/iv-zext.ll | 2 +- test/Transforms/IndVarSimplify/max-pointer.ll | 2 +- test/Transforms/IndVarSimplify/pointer.ll | 2 +- test/Transforms/IndVarSimplify/preserve-gep-loop-variant.ll | 2 +- test/Transforms/IndVarSimplify/preserve-gep-nested.ll | 2 +- test/Transforms/IndVarSimplify/preserve-gep-remainder.ll | 2 +- test/Transforms/IndVarSimplify/preserve-gep.ll | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) (limited to 'test/Transforms/IndVarSimplify') diff --git a/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll b/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll index 37ad63a..0f6267b 100644 --- a/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll +++ b/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -indvars -S | not grep {sext} ; ModuleID = '' -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" +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-n:32:64" target triple = "x86_64-apple-darwin9.6" @a = external global i32* ; [#uses=3] @b = external global i32* ; [#uses=3] diff --git a/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll b/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll index 803b540..46d6b38 100644 --- a/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll +++ b/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll @@ -13,7 +13,7 @@ ; d[(i+2)&15] = e[(i+2)&15]+f[(i+2)&15]+K[i+2]; ; } ;} -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" +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-n:32:64" target triple = "x86_64-apple-darwin9.6" @a = external global i32* ; [#uses=3] @b = external global i32* ; [#uses=3] diff --git a/test/Transforms/IndVarSimplify/ada-loops.ll b/test/Transforms/IndVarSimplify/ada-loops.ll index 436840a..4a07d99 100644 --- a/test/Transforms/IndVarSimplify/ada-loops.ll +++ b/test/Transforms/IndVarSimplify/ada-loops.ll @@ -11,7 +11,7 @@ ; count without casting. ; ModuleID = 'ada.bc' -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-n:8:16:32" target triple = "i686-pc-linux-gnu" define void @kinds__sbytezero([256 x i32]* nocapture %a) nounwind { diff --git a/test/Transforms/IndVarSimplify/addrec-gep.ll b/test/Transforms/IndVarSimplify/addrec-gep.ll index 345f666..58cba60 100644 --- a/test/Transforms/IndVarSimplify/addrec-gep.ll +++ b/test/Transforms/IndVarSimplify/addrec-gep.ll @@ -9,7 +9,7 @@ ; be able to reconstruct the full getelementptr, despite it having a few ; obstacles set in its way. -target datalayout = "e-p:64:64:64" +target datalayout = "e-p:64:64:64-n:32:64" define void @foo(i64 %n, i64 %m, i64 %o, i64 %q, double* nocapture %p) nounwind { entry: diff --git a/test/Transforms/IndVarSimplify/ashr-tripcount.ll b/test/Transforms/IndVarSimplify/ashr-tripcount.ll index baaefdc..09d559f 100644 --- a/test/Transforms/IndVarSimplify/ashr-tripcount.ll +++ b/test/Transforms/IndVarSimplify/ashr-tripcount.ll @@ -4,7 +4,7 @@ ; Indvars should be able to eliminate all of the sign extensions ; inside the loop. -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" +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-n:32:64" @pow_2_tab = external constant [0 x float] ; <[0 x float]*> [#uses=1] @pow_2_025_tab = external constant [0 x float] ; <[0 x float]*> [#uses=1] @i_pow_2_tab = external constant [0 x float] ; <[0 x float]*> [#uses=1] diff --git a/test/Transforms/IndVarSimplify/iv-sext.ll b/test/Transforms/IndVarSimplify/iv-sext.ll index 5516502..3e90873 100644 --- a/test/Transforms/IndVarSimplify/iv-sext.ll +++ b/test/Transforms/IndVarSimplify/iv-sext.ll @@ -6,7 +6,7 @@ ; inner loop to i64. ; TODO: it should promote hiPart to i64 in the outer loop too. -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" +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-n:32:64" define void @t(float* %pTmp1, float* %peakWeight, float* %nrgReducePeakrate, i32 %bandEdgeIndex, float %tmp1) nounwind { entry: diff --git a/test/Transforms/IndVarSimplify/iv-zext.ll b/test/Transforms/IndVarSimplify/iv-zext.ll index 1cc559f..80a77b6 100644 --- a/test/Transforms/IndVarSimplify/iv-zext.ll +++ b/test/Transforms/IndVarSimplify/iv-zext.ll @@ -2,7 +2,7 @@ ; RUN: not grep and %t ; RUN: not grep zext %t -target datalayout = "-p:64:64:64" +target datalayout = "-p:64:64:64-n:32:64" define void @foo(double* %d, i64 %n) nounwind { entry: diff --git a/test/Transforms/IndVarSimplify/max-pointer.ll b/test/Transforms/IndVarSimplify/max-pointer.ll index f18f968..46ac2d8 100644 --- a/test/Transforms/IndVarSimplify/max-pointer.ll +++ b/test/Transforms/IndVarSimplify/max-pointer.ll @@ -2,7 +2,7 @@ ; RUN: grep {icmp ugt i8\\\*} %t | count 1 ; RUN: grep {icmp sgt i8\\\*} %t | count 1 -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" +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-n:32:64" %struct.CKenCodeCodec = type <{ i8 }> diff --git a/test/Transforms/IndVarSimplify/pointer.ll b/test/Transforms/IndVarSimplify/pointer.ll index 5eee655..d55bf98 100644 --- a/test/Transforms/IndVarSimplify/pointer.ll +++ b/test/Transforms/IndVarSimplify/pointer.ll @@ -9,7 +9,7 @@ ; Indvars should be able to expand the pointer-arithmetic ; IV into an integer IV indexing into a simple getelementptr. -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-n:32:64" define void @foo(i8* %A, i64 %n) nounwind { entry: diff --git a/test/Transforms/IndVarSimplify/preserve-gep-loop-variant.ll b/test/Transforms/IndVarSimplify/preserve-gep-loop-variant.ll index 3a5c0b6..26f05c4 100644 --- a/test/Transforms/IndVarSimplify/preserve-gep-loop-variant.ll +++ b/test/Transforms/IndVarSimplify/preserve-gep-loop-variant.ll @@ -2,7 +2,7 @@ ; RUN: not grep inttoptr %t ; RUN: not grep ptrtoint %t ; RUN: grep scevgep %t -target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" +target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128-n:32:64" ; Indvars shouldn't need inttoptr/ptrtoint to expand an address here. diff --git a/test/Transforms/IndVarSimplify/preserve-gep-nested.ll b/test/Transforms/IndVarSimplify/preserve-gep-nested.ll index bb0993c..b41de58 100644 --- a/test/Transforms/IndVarSimplify/preserve-gep-nested.ll +++ b/test/Transforms/IndVarSimplify/preserve-gep-nested.ll @@ -13,7 +13,7 @@ ; FIXME: This test should pass with or without TargetData. Until opt ; supports running tests without targetdata, just hardware this in. -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" +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-n:32:64" %struct.Q = type { [10 x %struct.N] } %struct.N = type { %struct.S } diff --git a/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll b/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll index e17368b..ca0c399 100644 --- a/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll +++ b/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -indvars -S \ ; RUN: | grep {\[%\]p.2.ip.1 = getelementptr \\\[3 x \\\[3 x double\\\]\\\]\\* \[%\]p, i64 2, i64 \[%\]tmp, i64 1} -target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" +target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128-n:32:64" ; Indvars shouldn't expand this to ; %p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 %tmp, i64 19 diff --git a/test/Transforms/IndVarSimplify/preserve-gep.ll b/test/Transforms/IndVarSimplify/preserve-gep.ll index a27d20d..82eda03 100644 --- a/test/Transforms/IndVarSimplify/preserve-gep.ll +++ b/test/Transforms/IndVarSimplify/preserve-gep.ll @@ -6,7 +6,7 @@ ; Indvars shouldn't leave getelementptrs expanded out as ; inttoptr+ptrtoint in its output in common cases. -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" +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-n:32:64" target triple = "x86_64-unknown-linux-gnu" %struct.Foo = type { i32, i32, [10 x i32], i32 } -- cgit v1.1