diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2015-03-04 18:43:29 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2015-03-04 18:43:29 +0000 |
commit | 46a43556db23edb514f190cc03b0ce7f68d40534 (patch) | |
tree | 8975390ebdcdf12760bb63b35a7eb883156e87fd /llvm/test/Transforms | |
parent | 2ae03e178392e0693872e42c947d784b3c02ea60 (diff) | |
download | bcm5719-llvm-46a43556db23edb514f190cc03b0ce7f68d40534.tar.gz bcm5719-llvm-46a43556db23edb514f190cc03b0ce7f68d40534.zip |
Make DataLayout Non-Optional in the Module
Summary:
DataLayout keeps the string used for its creation.
As a side effect it is no longer needed in the Module.
This is "almost" NFC, the string is no longer
canonicalized, you can't rely on two "equals" DataLayout
having the same string returned by getStringRepresentation().
Get rid of DataLayoutPass: the DataLayout is in the Module
The DataLayout is "per-module", let's enforce this by not
duplicating it more than necessary.
One more step toward non-optionality of the DataLayout in the
module.
Make DataLayout Non-Optional in the Module
Module->getDataLayout() will never returns nullptr anymore.
Reviewers: echristo
Subscribers: resistor, llvm-commits, jholewinski
Differential Revision: http://reviews.llvm.org/D7992
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 231270
Diffstat (limited to 'llvm/test/Transforms')
44 files changed, 231 insertions, 347 deletions
diff --git a/llvm/test/Transforms/ConstantMerge/merge-both.ll b/llvm/test/Transforms/ConstantMerge/merge-both.ll index 316267648f1..11b0621d42d 100644 --- a/llvm/test/Transforms/ConstantMerge/merge-both.ll +++ b/llvm/test/Transforms/ConstantMerge/merge-both.ll @@ -1,7 +1,6 @@ ; RUN: opt -constmerge -S < %s | FileCheck %s ; Test that in one run var3 is merged into var2 and var1 into var4. -; Test that we merge @var5 and @var6 into one with the higher alignment, and -; don't merge var7/var8 into var5/var6. +; Test that we merge @var5 and @var6 into one with the higher alignment declare void @zed(%struct.foobar*, %struct.foobar*) @@ -23,8 +22,8 @@ declare void @helper([16 x i8]*) @var7 = internal constant [16 x i8] c"foo1bar2foo3bar\00" @var8 = private unnamed_addr constant [16 x i8] c"foo1bar2foo3bar\00" -; CHECK-NEXT: @var6 = private constant [16 x i8] c"foo1bar2foo3bar\00", align 16 -; CHECK-NEXT: @var8 = private constant [16 x i8] c"foo1bar2foo3bar\00" +; CHECK-NEXT: @var7 = internal constant [16 x i8] c"foo1bar2foo3bar\00" +; CHECK-NEXT: @var8 = private constant [16 x i8] c"foo1bar2foo3bar\00", align 16 @var4a = alias %struct.foobar* @var4 @llvm.used = appending global [1 x %struct.foobar*] [%struct.foobar* @var4a], section "llvm.metadata" diff --git a/llvm/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll b/llvm/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll index d4bf8032cda..7da65092dff 100644 --- a/llvm/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll +++ b/llvm/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll @@ -26,7 +26,7 @@ define internal void @_GLOBAL__I_a() section "__TEXT,__StaticInit,regular,pure_i declare void @test(i8*) define void @print() { -; CHECK: %1 = load i8*, i8** getelementptr inbounds ([1 x %struct.ButtonInitData]* @_ZL14buttonInitData, i32 0, i32 0, i32 0), align 4 +; CHECK: %1 = load i8*, i8** @_ZL14buttonInitData.0.0, align 4 %1 = load i8*, i8** getelementptr inbounds ([1 x %struct.ButtonInitData]* @_ZL14buttonInitData, i32 0, i32 0, i32 0), align 4 call void @test(i8* %1) ret void diff --git a/llvm/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll b/llvm/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll index 4c0c3279232..58934f5ef84 100644 --- a/llvm/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll +++ b/llvm/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll @@ -1,6 +1,10 @@ ; RUN: opt < %s -indvars -S | grep sext | count 1 ; ModuleID = '<stdin>' +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + %struct.App1Marker = type <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }> %struct.ComponentInstanceRecord = type <{ [1 x i32] }> %struct.DCPredictors = type { [5 x i16] } diff --git a/llvm/test/Transforms/IndVarSimplify/2009-04-27-Floating.ll b/llvm/test/Transforms/IndVarSimplify/2009-04-27-Floating.ll index 47164d86047..44c43a3a043 100644 --- a/llvm/test/Transforms/IndVarSimplify/2009-04-27-Floating.ll +++ b/llvm/test/Transforms/IndVarSimplify/2009-04-27-Floating.ll @@ -1,5 +1,9 @@ ; RUN: opt < %s -indvars -S | FileCheck %s ; PR4086 + +; Provide legal integer types. +target datalayout = "n8:16:32:64" + declare void @foo() define void @test() { diff --git a/llvm/test/Transforms/IndVarSimplify/iv-widen.ll b/llvm/test/Transforms/IndVarSimplify/iv-widen.ll index 2b69cb151d2..464b03ce559 100644 --- a/llvm/test/Transforms/IndVarSimplify/iv-widen.ll +++ b/llvm/test/Transforms/IndVarSimplify/iv-widen.ll @@ -1,5 +1,9 @@ ; RUN: opt < %s -indvars -S | FileCheck %s +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + target triple = "x86_64-apple-darwin" ; CHECK-LABEL: @sloop diff --git a/llvm/test/Transforms/IndVarSimplify/lftr-extend-const.ll b/llvm/test/Transforms/IndVarSimplify/lftr-extend-const.ll index f12c68cacb6..fa3166d4a3e 100644 --- a/llvm/test/Transforms/IndVarSimplify/lftr-extend-const.ll +++ b/llvm/test/Transforms/IndVarSimplify/lftr-extend-const.ll @@ -1,5 +1,9 @@ ;RUN: opt -S %s -indvars | FileCheck %s +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + ; CHECK-LABEL: @foo( ; CHECK-NOT: %lftr.wideiv = trunc i32 %indvars.iv.next to i16 ; CHECK: %exitcond = icmp ne i32 %indvars.iv.next, 512 diff --git a/llvm/test/Transforms/IndVarSimplify/lftr_simple.ll b/llvm/test/Transforms/IndVarSimplify/lftr_simple.ll index e373013609b..6a8d9372183 100644 --- a/llvm/test/Transforms/IndVarSimplify/lftr_simple.ll +++ b/llvm/test/Transforms/IndVarSimplify/lftr_simple.ll @@ -1,7 +1,11 @@ -; LFTR should eliminate the need for the computation of i*i completely. It +; LFTR should eliminate the need for the computation of i*i completely. It ; is only used to compute the exit value. ; RUN: opt < %s -indvars -dce -S | not grep mul +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + @A = external global i32 ; <i32*> [#uses=1] define i32 @quadratic_setlt() { diff --git a/llvm/test/Transforms/IndVarSimplify/pr20680.ll b/llvm/test/Transforms/IndVarSimplify/pr20680.ll index 0713f31783a..2c9eb54a789 100644 --- a/llvm/test/Transforms/IndVarSimplify/pr20680.ll +++ b/llvm/test/Transforms/IndVarSimplify/pr20680.ll @@ -1,5 +1,9 @@ ; RUN: opt < %s -indvars -S | FileCheck %s +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + @a = common global i32 0, align 4 @c = common global i32 0, align 4 @b = common global i32 0, align 4 diff --git a/llvm/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll b/llvm/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll index 1fdbc63762c..c8d34acb24a 100644 --- a/llvm/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll +++ b/llvm/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll @@ -4,6 +4,10 @@ ; sext for the addressing, however it shouldn't eliminate the sext ; on the other phi, since that value undergoes signed wrapping. +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + define void @foo(i32* nocapture %d, i32 %n) nounwind { entry: %0 = icmp sgt i32 %n, 0 ; <i1> [#uses=1] diff --git a/llvm/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll b/llvm/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll index b6765011336..f2afaf42bc9 100644 --- a/llvm/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll +++ b/llvm/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll @@ -1,5 +1,8 @@ -; RUN: opt < %s -indvars -S > %t -; RUN: not grep sext %t +; RUN: opt < %s -indvars -S | not grep sext + +; Provide legal integer types. +target datalayout = "n8:16:32:64" + define i64 @test(i64* nocapture %first, i32 %count) nounwind readonly { entry: diff --git a/llvm/test/Transforms/IndVarSimplify/signed-trip-count.ll b/llvm/test/Transforms/IndVarSimplify/signed-trip-count.ll index bbcc9c51141..992e22e2a96 100644 --- a/llvm/test/Transforms/IndVarSimplify/signed-trip-count.ll +++ b/llvm/test/Transforms/IndVarSimplify/signed-trip-count.ll @@ -2,6 +2,10 @@ ; RUN: not grep sext %t ; RUN: grep phi %t | count 1 +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + define void @foo(i64* nocapture %x, i32 %n) nounwind { entry: %tmp102 = icmp sgt i32 %n, 0 ; <i1> [#uses=1] diff --git a/llvm/test/Transforms/IndVarSimplify/ult-sub-to-eq.ll b/llvm/test/Transforms/IndVarSimplify/ult-sub-to-eq.ll index 642d1ba205f..7272ef1ec13 100644 --- a/llvm/test/Transforms/IndVarSimplify/ult-sub-to-eq.ll +++ b/llvm/test/Transforms/IndVarSimplify/ult-sub-to-eq.ll @@ -1,5 +1,9 @@ ; RUN: opt -S -indvars < %s | FileCheck %s +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + define void @test1(float* nocapture %autoc, float* nocapture %data, float %d, i32 %data_len, i32 %sample) nounwind { entry: %sub = sub i32 %data_len, %sample diff --git a/llvm/test/Transforms/IndVarSimplify/widen-loop-comp.ll b/llvm/test/Transforms/IndVarSimplify/widen-loop-comp.ll index 6be2238ce9a..eb81ceb700b 100644 --- a/llvm/test/Transforms/IndVarSimplify/widen-loop-comp.ll +++ b/llvm/test/Transforms/IndVarSimplify/widen-loop-comp.ll @@ -1,6 +1,10 @@ ; RUN: opt < %s -indvars -S | FileCheck %s target triple = "aarch64--linux-gnu" +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + ; Check the loop exit i32 compare instruction and operand are widened to i64 ; instead of truncating IV before its use in the i32 compare instruction. diff --git a/llvm/test/Transforms/Inline/alloca-merge-align-nodl.ll b/llvm/test/Transforms/Inline/alloca-merge-align-nodl.ll deleted file mode 100644 index d51c5626747..00000000000 --- a/llvm/test/Transforms/Inline/alloca-merge-align-nodl.ll +++ /dev/null @@ -1,88 +0,0 @@ -; RUN: opt < %s -inline -S | FileCheck %s -; This variant of the test has no data layout information. -target triple = "powerpc64-unknown-linux-gnu" - -%struct.s = type { i32, i32 } - -define void @foo(%struct.s* byval nocapture readonly %a) { -entry: - %x = alloca [2 x i32], align 4 - %a1 = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 0 - %0 = load i32, i32* %a1, align 4 - %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 0 - store i32 %0, i32* %arrayidx, align 4 - %b = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 1 - %1 = load i32, i32* %b, align 4 - %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 1 - store i32 %1, i32* %arrayidx2, align 4 - call void @bar(i32* %arrayidx) #2 - ret void -} - -define void @foo0(%struct.s* byval nocapture readonly %a) { -entry: - %x = alloca [2 x i32] - %a1 = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 0 - %0 = load i32, i32* %a1, align 4 - %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 0 - store i32 %0, i32* %arrayidx, align 4 - %b = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 1 - %1 = load i32, i32* %b, align 4 - %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 1 - store i32 %1, i32* %arrayidx2, align 4 - call void @bar(i32* %arrayidx) #2 - ret void -} - -declare void @bar(i32*) #1 - -define void @goo(%struct.s* byval nocapture readonly %a) { -entry: - %x = alloca [2 x i32], align 32 - %a1 = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 0 - %0 = load i32, i32* %a1, align 4 - %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 0 - store i32 %0, i32* %arrayidx, align 32 - %b = getelementptr inbounds %struct.s, %struct.s* %a, i64 0, i32 1 - %1 = load i32, i32* %b, align 4 - %arrayidx2 = getelementptr inbounds [2 x i32], [2 x i32]* %x, i64 0, i64 1 - store i32 %1, i32* %arrayidx2, align 4 - call void @bar(i32* %arrayidx) #2 - ret void -} - -; CHECK-LABEL: @main -; CHECK: alloca [2 x i32], align 32 -; CHECK-NOT: alloca [2 x i32] -; CHECK: ret i32 0 - -define signext i32 @main() { -entry: - %a = alloca i64, align 8 - %tmpcast = bitcast i64* %a to %struct.s* - store i64 0, i64* %a, align 8 - %a1 = bitcast i64* %a to i32* - store i32 1, i32* %a1, align 8 - call void @foo(%struct.s* byval %tmpcast) - store i32 2, i32* %a1, align 8 - call void @goo(%struct.s* byval %tmpcast) - ret i32 0 -} - -; CHECK-LABEL: @test0 -; CHECK: alloca [2 x i32], align 32 -; CHECK: alloca [2 x i32] -; CHECK: ret i32 0 - -define signext i32 @test0() { -entry: - %a = alloca i64, align 8 - %tmpcast = bitcast i64* %a to %struct.s* - store i64 0, i64* %a, align 8 - %a1 = bitcast i64* %a to i32* - store i32 1, i32* %a1, align 8 - call void @foo0(%struct.s* byval %tmpcast) - store i32 2, i32* %a1, align 8 - call void @goo(%struct.s* byval %tmpcast) - ret i32 0 -} diff --git a/llvm/test/Transforms/Inline/alloca-merge-align.ll b/llvm/test/Transforms/Inline/alloca-merge-align.ll index ef053a7ed76..70b94f7b69a 100644 --- a/llvm/test/Transforms/Inline/alloca-merge-align.ll +++ b/llvm/test/Transforms/Inline/alloca-merge-align.ll @@ -102,21 +102,3 @@ entry: call void @goo(%struct.s* byval %tmpcast) ret i32 0 } - -; CHECK-LABEL: @test1 -; CHECK: {{alloca \[2 x i32\]$}} -; CHECK-NOT: alloca [2 x i32] -; CHECK: ret i32 0 - -define signext i32 @test1() { -entry: - %a = alloca i64, align 8 - %tmpcast = bitcast i64* %a to %struct.s* - store i64 0, i64* %a, align 8 - %a1 = bitcast i64* %a to i32* - store i32 1, i32* %a1, align 8 - call void @foo0(%struct.s* byval %tmpcast) - store i32 2, i32* %a1, align 8 - call void @foo1(%struct.s* byval %tmpcast) - ret i32 0 -} diff --git a/llvm/test/Transforms/Inline/lifetime-no-datalayout.ll b/llvm/test/Transforms/Inline/lifetime-no-datalayout.ll index 5abb77f2c3f..4307064e194 100644 --- a/llvm/test/Transforms/Inline/lifetime-no-datalayout.ll +++ b/llvm/test/Transforms/Inline/lifetime-no-datalayout.ll @@ -8,13 +8,13 @@ define void @helper() { ret void } -; Size in llvm.lifetime.X should be -1 (unknown). +; Size in llvm.lifetime.X should be 1 (default for i8). define void @test() { ; CHECK-LABEL: @test( ; CHECK-NOT: lifetime -; CHECK: llvm.lifetime.start(i64 -1 +; CHECK: llvm.lifetime.start(i64 1 ; CHECK-NOT: lifetime -; CHECK: llvm.lifetime.end(i64 -1 +; CHECK: llvm.lifetime.end(i64 1 call void @helper() ; CHECK-NOT: lifetime ; CHECK: ret void diff --git a/llvm/test/Transforms/InstCombine/2012-09-24-MemcpyFromGlobalCrash.ll b/llvm/test/Transforms/InstCombine/2012-09-24-MemcpyFromGlobalCrash.ll deleted file mode 100644 index 570da9be394..00000000000 --- a/llvm/test/Transforms/InstCombine/2012-09-24-MemcpyFromGlobalCrash.ll +++ /dev/null @@ -1,19 +0,0 @@ -; RUN: opt < %s -instcombine -S | FileCheck %s - -; Check we don't crash due to lack of target data. - -@G = constant [100 x i8] zeroinitializer - -declare void @bar(i8*) -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind - -define void @test() { -; CHECK-LABEL: @test( -; CHECK: llvm.memcpy -; CHECK: ret void - %A = alloca [100 x i8] - %a = getelementptr inbounds [100 x i8], [100 x i8]* %A, i64 0, i64 0 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* getelementptr inbounds ([100 x i8]* @G, i64 0, i32 0), i64 100, i32 4, i1 false) - call void @bar(i8* %a) readonly - ret void -} diff --git a/llvm/test/Transforms/InstCombine/extractvalue.ll b/llvm/test/Transforms/InstCombine/extractvalue.ll index 4dc1545cb41..6319590873a 100644 --- a/llvm/test/Transforms/InstCombine/extractvalue.ll +++ b/llvm/test/Transforms/InstCombine/extractvalue.ll @@ -13,7 +13,7 @@ define i32 @foo(i32 %a, i32 %b) { %s1 = insertvalue {i32, i32} %s1.1, i32 %b, 1 %v1 = extractvalue {i32, i32} %s1, 0 %v2 = extractvalue {i32, i32} %s1, 1 - + ; Build a nested struct and pull a sub struct out of it ; This requires instcombine to insert a few insertvalue instructions %ns1.1 = insertvalue {i32, {i32, i32}} undef, i32 %v1, 0 @@ -40,7 +40,7 @@ define i32 @foo(i32 %a, i32 %b) { } ; CHECK-LABEL: define i32 @extract2gep( -; CHECK-NEXT: [[GEP:%[a-z0-9]+]] = getelementptr inbounds {{.*}}, {{.*}}* %pair, i32 0, i32 1 +; CHECK-NEXT: [[GEP:%[a-z0-9]+]] = getelementptr inbounds {{.*}}, {{.*}}* %pair, i64 0, i32 1 ; CHECK-NEXT: [[LOAD:%[A-Za-z0-9]+]] = load i32, i32* [[GEP]] ; CHECK-NEXT: store ; CHECK-NEXT: br label %loop @@ -68,7 +68,7 @@ end: } ; CHECK-LABEL: define i32 @doubleextract2gep( -; CHECK-NEXT: [[GEP:%[a-z0-9]+]] = getelementptr inbounds {{.*}}, {{.*}}* %arg, i32 0, i32 1, i32 1 +; CHECK-NEXT: [[GEP:%[a-z0-9]+]] = getelementptr inbounds {{.*}}, {{.*}}* %arg, i64 0, i32 1, i32 1 ; CHECK-NEXT: [[LOAD:%[A-Za-z0-9]+]] = load i32, i32* [[GEP]] ; CHECK-NEXT: ret i32 [[LOAD]] define i32 @doubleextract2gep({i32, {i32, i32}}* %arg) { diff --git a/llvm/test/Transforms/InstCombine/gc.relocate.ll b/llvm/test/Transforms/InstCombine/gc.relocate.ll index 8fbb752f891..4a7ea2c4234 100644 --- a/llvm/test/Transforms/InstCombine/gc.relocate.ll +++ b/llvm/test/Transforms/InstCombine/gc.relocate.ll @@ -1,4 +1,5 @@ -; RUN: opt < %s -datalayout -instcombine -S | FileCheck %s +; RUN: opt < %s -instcombine -S | FileCheck %s +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-f80:128:128" ; Uses InstCombine with DataLayout to propagate dereferenceable ; attribute via gc.relocate: if the derived ptr is dereferenceable(N), diff --git a/llvm/test/Transforms/InstCombine/load-cmp.ll b/llvm/test/Transforms/InstCombine/load-cmp.ll index 7f4e2806c80..b0bfdc4c4c5 100644 --- a/llvm/test/Transforms/InstCombine/load-cmp.ll +++ b/llvm/test/Transforms/InstCombine/load-cmp.ll @@ -1,5 +1,4 @@ -; RUN: opt -instcombine -S < %s | FileCheck -check-prefix=NODL %s -; RUN: opt -instcombine -S -default-data-layout="p:32:32:32-p1:16:16:16-n8:16:32:64" < %s | FileCheck -check-prefix=P32 %s +; RUN: opt -instcombine -S -default-data-layout="p:32:32:32-p1:16:16:16-n8:16:32:64" < %s | FileCheck %s @G16 = internal constant [10 x i16] [i16 35, i16 82, i16 69, i16 81, i16 85, i16 73, i16 82, i16 69, i16 68, i16 0] @@ -25,13 +24,9 @@ define i1 @test1(i32 %X) { %Q = load i16, i16* %P %R = icmp eq i16 %Q, 0 ret i1 %R -; NODL-LABEL: @test1( -; NODL-NEXT: %R = icmp eq i32 %X, 9 -; NODL-NEXT: ret i1 %R - -; P32-LABEL: @test1( -; P32-NEXT: %R = icmp eq i32 %X, 9 -; P32-NEXT: ret i1 %R +; CHECK-LABEL: @test1( +; CHECK-NEXT: %R = icmp eq i32 %X, 9 +; CHECK-NEXT: ret i1 %R } define i1 @test1_noinbounds(i32 %X) { @@ -39,12 +34,9 @@ define i1 @test1_noinbounds(i32 %X) { %Q = load i16, i16* %P %R = icmp eq i16 %Q, 0 ret i1 %R -; NODL-LABEL: @test1_noinbounds( -; NODL-NEXT: %P = getelementptr [10 x i16], [10 x i16]* @G16, i32 0, i32 %X - -; P32-LABEL: @test1_noinbounds( -; P32-NEXT: %R = icmp eq i32 %X, 9 -; P32-NEXT: ret i1 %R +; CHECK-LABEL: @test1_noinbounds( +; CHECK-NEXT: %R = icmp eq i32 %X, 9 +; CHECK-NEXT: ret i1 %R } define i1 @test1_noinbounds_i64(i64 %X) { @@ -52,12 +44,9 @@ define i1 @test1_noinbounds_i64(i64 %X) { %Q = load i16, i16* %P %R = icmp eq i16 %Q, 0 ret i1 %R -; NODL-LABEL: @test1_noinbounds_i64( -; NODL-NEXT: %P = getelementptr [10 x i16], [10 x i16]* @G16, i64 0, i64 %X - -; P32-LABEL: @test1_noinbounds_i64( -; P32: %R = icmp eq i32 %1, 9 -; P32-NEXT: ret i1 %R +; CHECK-LABEL: @test1_noinbounds_i64( +; CHECK: %R = icmp eq i32 %1, 9 +; CHECK-NEXT: ret i1 %R } define i1 @test1_noinbounds_as1(i32 %x) { @@ -66,10 +55,10 @@ define i1 @test1_noinbounds_as1(i32 %x) { %r = icmp eq i16 %q, 0 ret i1 %r -; P32-LABEL: @test1_noinbounds_as1( -; P32-NEXT: trunc i32 %x to i16 -; P32-NEXT: %r = icmp eq i16 %1, 9 -; P32-NEXT: ret i1 %r +; CHECK-LABEL: @test1_noinbounds_as1( +; CHECK-NEXT: trunc i32 %x to i16 +; CHECK-NEXT: %r = icmp eq i16 %1, 9 +; CHECK-NEXT: ret i1 %r } define i1 @test2(i32 %X) { @@ -77,9 +66,9 @@ define i1 @test2(i32 %X) { %Q = load i16, i16* %P %R = icmp slt i16 %Q, 85 ret i1 %R -; NODL-LABEL: @test2( -; NODL-NEXT: %R = icmp ne i32 %X, 4 -; NODL-NEXT: ret i1 %R +; CHECK-LABEL: @test2( +; CHECK-NEXT: %R = icmp ne i32 %X, 4 +; CHECK-NEXT: ret i1 %R } define i1 @test3(i32 %X) { @@ -87,13 +76,9 @@ define i1 @test3(i32 %X) { %Q = load double, double* %P %R = fcmp oeq double %Q, 1.0 ret i1 %R -; NODL-LABEL: @test3( -; NODL-NEXT: %R = icmp eq i32 %X, 1 -; NODL-NEXT: ret i1 %R - -; P32-LABEL: @test3( -; P32-NEXT: %R = icmp eq i32 %X, 1 -; P32-NEXT: ret i1 %R +; CHECK-LABEL: @test3( +; CHECK-NEXT: %R = icmp eq i32 %X, 1 +; CHECK-NEXT: ret i1 %R } @@ -102,17 +87,11 @@ define i1 @test4(i32 %X) { %Q = load i16, i16* %P %R = icmp sle i16 %Q, 73 ret i1 %R -; NODL-LABEL: @test4( -; NODL-NEXT: lshr i32 933, %X -; NODL-NEXT: and i32 {{.*}}, 1 -; NODL-NEXT: %R = icmp ne i32 {{.*}}, 0 -; NODL-NEXT: ret i1 %R - -; P32-LABEL: @test4( -; P32-NEXT: lshr i32 933, %X -; P32-NEXT: and i32 {{.*}}, 1 -; P32-NEXT: %R = icmp ne i32 {{.*}}, 0 -; P32-NEXT: ret i1 %R +; CHECK-LABEL: @test4( +; CHECK-NEXT: lshr i32 933, %X +; CHECK-NEXT: and i32 {{.*}}, 1 +; CHECK-NEXT: %R = icmp ne i32 {{.*}}, 0 +; CHECK-NEXT: ret i1 %R } define i1 @test4_i16(i16 %X) { @@ -120,19 +99,12 @@ define i1 @test4_i16(i16 %X) { %Q = load i16, i16* %P %R = icmp sle i16 %Q, 73 ret i1 %R - -; NODL-LABEL: @test4_i16( -; NODL-NEXT: lshr i16 933, %X -; NODL-NEXT: and i16 {{.*}}, 1 -; NODL-NEXT: %R = icmp ne i16 {{.*}}, 0 -; NODL-NEXT: ret i1 %R - -; P32-LABEL: @test4_i16( -; P32-NEXT: sext i16 %X to i32 -; P32-NEXT: lshr i32 933, %1 -; P32-NEXT: and i32 {{.*}}, 1 -; P32-NEXT: %R = icmp ne i32 {{.*}}, 0 -; P32-NEXT: ret i1 %R +; CHECK-LABEL: @test4_i16( +; CHECK-NEXT: sext i16 %X to i32 +; CHECK-NEXT: lshr i32 933, %1 +; CHECK-NEXT: and i32 {{.*}}, 1 +; CHECK-NEXT: %R = icmp ne i32 {{.*}}, 0 +; CHECK-NEXT: ret i1 %R } define i1 @test5(i32 %X) { @@ -140,17 +112,11 @@ define i1 @test5(i32 %X) { %Q = load i16, i16* %P %R = icmp eq i16 %Q, 69 ret i1 %R -; NODL-LABEL: @test5( -; NODL-NEXT: icmp eq i32 %X, 2 -; NODL-NEXT: icmp eq i32 %X, 7 -; NODL-NEXT: %R = or i1 -; NODL-NEXT: ret i1 %R - -; P32-LABEL: @test5( -; P32-NEXT: icmp eq i32 %X, 2 -; P32-NEXT: icmp eq i32 %X, 7 -; P32-NEXT: %R = or i1 -; P32-NEXT: ret i1 %R +; CHECK-LABEL: @test5( +; CHECK-NEXT: icmp eq i32 %X, 2 +; CHECK-NEXT: icmp eq i32 %X, 7 +; CHECK-NEXT: %R = or i1 +; CHECK-NEXT: ret i1 %R } define i1 @test6(i32 %X) { @@ -158,15 +124,10 @@ define i1 @test6(i32 %X) { %Q = load double, double* %P %R = fcmp ogt double %Q, 0.0 ret i1 %R -; NODL-LABEL: @test6( -; NODL-NEXT: add i32 %X, -1 -; NODL-NEXT: %R = icmp ult i32 {{.*}}, 3 -; NODL-NEXT: ret i1 %R - -; P32-LABEL: @test6( -; P32-NEXT: add i32 %X, -1 -; P32-NEXT: %R = icmp ult i32 {{.*}}, 3 -; P32-NEXT: ret i1 %R +; CHECK-LABEL: @test6( +; CHECK-NEXT: add i32 %X, -1 +; CHECK-NEXT: %R = icmp ult i32 {{.*}}, 3 +; CHECK-NEXT: ret i1 %R } define i1 @test7(i32 %X) { @@ -174,15 +135,10 @@ define i1 @test7(i32 %X) { %Q = load double, double* %P %R = fcmp olt double %Q, 0.0 ret i1 %R -; NODL-LABEL: @test7( -; NODL-NEXT: add i32 %X, -1 -; NODL-NEXT: %R = icmp ugt i32 {{.*}}, 2 -; NODL-NEXT: ret i1 %R - -; P32-LABEL: @test7( -; P32-NEXT: add i32 %X, -1 -; P32-NEXT: %R = icmp ugt i32 {{.*}}, 2 -; P32-NEXT: ret i1 %R +; CHECK-LABEL: @test7( +; CHECK-NEXT: add i32 %X, -1 +; CHECK-NEXT: %R = icmp ugt i32 {{.*}}, 2 +; CHECK-NEXT: ret i1 %R } define i1 @test8(i32 %X) { @@ -191,15 +147,10 @@ define i1 @test8(i32 %X) { %R = and i16 %Q, 3 %S = icmp eq i16 %R, 0 ret i1 %S -; NODL-LABEL: @test8( -; NODL-NEXT: and i32 %X, -2 -; NODL-NEXT: icmp eq i32 {{.*}}, 8 -; NODL-NEXT: ret i1 - -; P32-LABEL: @test8( -; P32-NEXT: and i32 %X, -2 -; P32-NEXT: icmp eq i32 {{.*}}, 8 -; P32-NEXT: ret i1 +; CHECK-LABEL: @test8( +; CHECK-NEXT: and i32 %X, -2 +; CHECK-NEXT: icmp eq i32 {{.*}}, 8 +; CHECK-NEXT: ret i1 } @GA = internal constant [4 x { i32, i32 } ] [ @@ -214,23 +165,15 @@ define i1 @test9(i32 %X) { %Q = load i32, i32* %P %R = icmp eq i32 %Q, 1 ret i1 %R -; NODL-LABEL: @test9( -; NODL-NEXT: add i32 %X, -1 -; NODL-NEXT: icmp ult i32 {{.*}}, 2 -; NODL-NEXT: ret i1 - -; P32-LABEL: @test9( -; P32-NEXT: add i32 %X, -1 -; P32-NEXT: icmp ult i32 {{.*}}, 2 -; P32-NEXT: ret i1 +; CHECK-LABEL: @test9( +; CHECK-NEXT: add i32 %X, -1 +; CHECK-NEXT: icmp ult i32 {{.*}}, 2 +; CHECK-NEXT: ret i1 } define i1 @test10_struct(i32 %x) { -; NODL-LABEL: @test10_struct( -; NODL: getelementptr inbounds %Foo, %Foo* @GS, i32 %x, i32 0 - -; P32-LABEL: @test10_struct( -; P32: ret i1 false +; CHECK-LABEL: @test10_struct( +; CHECK: ret i1 false %p = getelementptr inbounds %Foo, %Foo* @GS, i32 %x, i32 0 %q = load i32, i32* %p %r = icmp eq i32 %q, 9 @@ -238,11 +181,8 @@ define i1 @test10_struct(i32 %x) { } define i1 @test10_struct_noinbounds(i32 %x) { -; NODL-LABEL: @test10_struct_noinbounds( -; NODL: getelementptr %Foo, %Foo* @GS, i32 %x, i32 0 - -; P32-LABEL: @test10_struct_noinbounds( -; P32: getelementptr %Foo, %Foo* @GS, i32 %x, i32 0 +; CHECK-LABEL: @test10_struct_noinbounds( +; CHECK: getelementptr %Foo, %Foo* @GS, i32 %x, i32 0 %p = getelementptr %Foo, %Foo* @GS, i32 %x, i32 0 %q = load i32, i32* %p %r = icmp eq i32 %q, 9 @@ -252,11 +192,8 @@ define i1 @test10_struct_noinbounds(i32 %x) { ; Test that the GEP indices are converted before we ever get here ; Index < ptr size define i1 @test10_struct_i16(i16 %x){ -; NODL-LABEL: @test10_struct_i16( -; NODL: getelementptr inbounds %Foo, %Foo* @GS, i16 %x, i32 0 - -; P32-LABEL: @test10_struct_i16( -; P32: ret i1 false +; CHECK-LABEL: @test10_struct_i16( +; CHECK: ret i1 false %p = getelementptr inbounds %Foo, %Foo* @GS, i16 %x, i32 0 %q = load i32, i32* %p %r = icmp eq i32 %q, 0 @@ -266,11 +203,8 @@ define i1 @test10_struct_i16(i16 %x){ ; Test that the GEP indices are converted before we ever get here ; Index > ptr size define i1 @test10_struct_i64(i64 %x){ -; NODL-LABEL: @test10_struct_i64( -; NODL: getelementptr inbounds %Foo, %Foo* @GS, i64 %x, i32 0 - -; P32-LABEL: @test10_struct_i64( -; P32: ret i1 false +; CHECK-LABEL: @test10_struct_i64( +; CHECK: ret i1 false %p = getelementptr inbounds %Foo, %Foo* @GS, i64 %x, i32 0 %q = load i32, i32* %p %r = icmp eq i32 %q, 0 @@ -278,12 +212,9 @@ define i1 @test10_struct_i64(i64 %x){ } define i1 @test10_struct_noinbounds_i16(i16 %x) { -; NODL-LABEL: @test10_struct_noinbounds_i16( -; NODL: getelementptr %Foo, %Foo* @GS, i16 %x, i32 0 - -; P32-LABEL: @test10_struct_noinbounds_i16( -; P32: %1 = sext i16 %x to i32 -; P32: getelementptr %Foo, %Foo* @GS, i32 %1, i32 0 +; CHECK-LABEL: @test10_struct_noinbounds_i16( +; CHECK: %1 = sext i16 %x to i32 +; CHECK: getelementptr %Foo, %Foo* @GS, i32 %1, i32 0 %p = getelementptr %Foo, %Foo* @GS, i16 %x, i32 0 %q = load i32, i32* %p %r = icmp eq i32 %q, 0 @@ -291,13 +222,9 @@ define i1 @test10_struct_noinbounds_i16(i16 %x) { } define i1 @test10_struct_arr(i32 %x) { -; NODL-LABEL: @test10_struct_arr( -; NODL-NEXT: %r = icmp ne i32 %x, 1 -; NODL-NEXT: ret i1 %r - -; P32-LABEL: @test10_struct_arr( -; P32-NEXT: %r = icmp ne i32 %x, 1 -; P32-NEXT: ret i1 %r +; CHECK-LABEL: @test10_struct_arr( +; CHECK-NEXT: %r = icmp ne i32 %x, 1 +; CHECK-NEXT: ret i1 %r %p = getelementptr inbounds [4 x %Foo], [4 x %Foo]* @GStructArr, i32 0, i32 %x, i32 2 %q = load i32, i32* %p %r = icmp eq i32 %q, 9 @@ -305,11 +232,8 @@ define i1 @test10_struct_arr(i32 %x) { } define i1 @test10_struct_arr_noinbounds(i32 %x) { -; NODL-LABEL: @test10_struct_arr_noinbounds( -; NODL-NEXT %p = getelementptr [4 x %Foo], [4 x %Foo]* @GStructArr, i32 0, i32 %x, i32 2 - -; P32-LABEL: @test10_struct_arr_noinbounds( -; P32-NEXT %p = getelementptr [4 x %Foo], [4 x %Foo]* @GStructArr, i32 0, i32 %x, i32 2 +; CHECK-LABEL: @test10_struct_arr_noinbounds( +; CHECK-NEXT %p = getelementptr [4 x %Foo], [4 x %Foo]* @GStructArr, i32 0, i32 %x, i32 2 %p = getelementptr [4 x %Foo], [4 x %Foo]* @GStructArr, i32 0, i32 %x, i32 2 %q = load i32, i32* %p %r = icmp eq i32 %q, 9 @@ -317,13 +241,9 @@ define i1 @test10_struct_arr_noinbounds(i32 %x) { } define i1 @test10_struct_arr_i16(i16 %x) { -; NODL-LABEL: @test10_struct_arr_i16( -; NODL-NEXT: %r = icmp ne i16 %x, 1 -; NODL-NEXT: ret i1 %r - -; P32-LABEL: @test10_struct_arr_i16( -; P32-NEXT: %r = icmp ne i16 %x, 1 -; P32-NEXT: ret i1 %r +; CHECK-LABEL: @test10_struct_arr_i16( +; CHECK-NEXT: %r = icmp ne i16 %x, 1 +; CHECK-NEXT: ret i1 %r %p = getelementptr inbounds [4 x %Foo], [4 x %Foo]* @GStructArr, i16 0, i16 %x, i32 2 %q = load i32, i32* %p %r = icmp eq i32 %q, 9 @@ -331,14 +251,10 @@ define i1 @test10_struct_arr_i16(i16 %x) { } define i1 @test10_struct_arr_i64(i64 %x) { -; NODL-LABEL: @test10_struct_arr_i64( -; NODL-NEXT: %r = icmp ne i64 %x, 1 -; NODL-NEXT: ret i1 %r - -; P32-LABEL: @test10_struct_arr_i64( -; P32-NEXT: trunc i64 %x to i32 -; P32-NEXT: %r = icmp ne i32 %1, 1 -; P32-NEXT: ret i1 %r +; CHECK-LABEL: @test10_struct_arr_i64( +; CHECK-NEXT: trunc i64 %x to i32 +; CHECK-NEXT: %r = icmp ne i32 %1, 1 +; CHECK-NEXT: ret i1 %r %p = getelementptr inbounds [4 x %Foo], [4 x %Foo]* @GStructArr, i64 0, i64 %x, i32 2 %q = load i32, i32* %p %r = icmp eq i32 %q, 9 @@ -346,11 +262,8 @@ define i1 @test10_struct_arr_i64(i64 %x) { } define i1 @test10_struct_arr_noinbounds_i16(i16 %x) { -; NODL-LABEL: @test10_struct_arr_noinbounds_i16( -; NODL-NEXT: %p = getelementptr [4 x %Foo], [4 x %Foo]* @GStructArr, i32 0, i16 %x, i32 2 - -; P32-LABEL: @test10_struct_arr_noinbounds_i16( -; P32-NEXT: %r = icmp ne i16 %x, 1 +; CHECK-LABEL: @test10_struct_arr_noinbounds_i16( +; CHECK-NEXT: %r = icmp ne i16 %x, 1 %p = getelementptr [4 x %Foo], [4 x %Foo]* @GStructArr, i32 0, i16 %x, i32 2 %q = load i32, i32* %p %r = icmp eq i32 %q, 9 @@ -358,13 +271,9 @@ define i1 @test10_struct_arr_noinbounds_i16(i16 %x) { } define i1 @test10_struct_arr_noinbounds_i64(i64 %x) { -; FIXME: Should be no trunc? -; NODL-LABEL: @test10_struct_arr_noinbounds_i64( -; NODL-NEXT: %p = getelementptr [4 x %Foo], [4 x %Foo]* @GStructArr, i32 0, i64 %x, i32 2 - -; P32-LABEL: @test10_struct_arr_noinbounds_i64( -; P32: %r = icmp ne i32 %1, 1 -; P32-NEXT: ret i1 %r +; CHECK-LABEL: @test10_struct_arr_noinbounds_i64( +; CHECK: %r = icmp ne i32 %1, 1 +; CHECK-NEXT: ret i1 %r %p = getelementptr [4 x %Foo], [4 x %Foo]* @GStructArr, i32 0, i64 %x, i32 2 %q = load i32, i32* %p %r = icmp eq i32 %q, 9 diff --git a/llvm/test/Transforms/InstCombine/overflow-mul.ll b/llvm/test/Transforms/InstCombine/overflow-mul.ll index 6d8d40bcac3..bc0504b0a96 100644 --- a/llvm/test/Transforms/InstCombine/overflow-mul.ll +++ b/llvm/test/Transforms/InstCombine/overflow-mul.ll @@ -174,6 +174,17 @@ define <4 x i32> @pr20113(<4 x i16> %a, <4 x i16> %b) { ret <4 x i32> %vcgez.i } + +; The last test needs this weird datalayout. +target datalayout = "i32:8:8" +; Without it, InstCombine will align the pointed on 4 Bytes +; The KnownBitsZero that result from the alignment allows to +; turn: +; and i32 %mul, 255 +; to: +; and i32 %mul, 252 +; The mask is no longer in the form 2^n-1 and this prevents the transformation. + @pr21445_data = external global i32 define i1 @pr21445(i8 %a) { ; CHECK-LABEL: @pr21445( diff --git a/llvm/test/Transforms/InstCombine/pr21651.ll b/llvm/test/Transforms/InstCombine/pr21651.ll index 914785f329a..d2b8d312d8c 100644 --- a/llvm/test/Transforms/InstCombine/pr21651.ll +++ b/llvm/test/Transforms/InstCombine/pr21651.ll @@ -1,5 +1,9 @@ ; RUN: opt < %s -instcombine -S | FileCheck %s +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + define void @PR21651() { switch i2 0, label %out [ i2 0, label %out diff --git a/llvm/test/Transforms/InstCombine/simplify-libcalls.ll b/llvm/test/Transforms/InstCombine/simplify-libcalls.ll index 6eb474449c9..e264c2c7240 100644 --- a/llvm/test/Transforms/InstCombine/simplify-libcalls.ll +++ b/llvm/test/Transforms/InstCombine/simplify-libcalls.ll @@ -1,4 +1,5 @@ ; RUN: opt -S < %s -instcombine | FileCheck %s +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32" @G = constant [3 x i8] c"%s\00" ; <[3 x i8]*> [#uses=1] @@ -19,7 +20,7 @@ define i8* @test1() { ret i8* %tmp3 ; CHECK-LABEL: @test1( -; CHECK: ret i8* getelementptr inbounds ([5 x i8]* @str, i32 0, i64 3) +; CHECK: ret i8* getelementptr inbounds ([5 x i8]* @str, i32 0, i32 3) } declare i8* @strchr(i8*, i32) @@ -29,7 +30,7 @@ define i8* @test2() { ret i8* %tmp3 ; CHECK-LABEL: @test2( -; CHECK: ret i8* getelementptr inbounds ([8 x i8]* @str1, i32 0, i64 7) +; CHECK: ret i8* getelementptr inbounds ([8 x i8]* @str1, i32 0, i32 7) } define i8* @test3() { diff --git a/llvm/test/Transforms/InstCombine/store.ll b/llvm/test/Transforms/InstCombine/store.ll index c087a733185..5dfbd714090 100644 --- a/llvm/test/Transforms/InstCombine/store.ll +++ b/llvm/test/Transforms/InstCombine/store.ll @@ -41,7 +41,7 @@ Cont: ; CHECK-LABEL: @test3( ; CHECK-NOT: alloca ; CHECK: Cont: -; CHECK-NEXT: %storemerge = phi i32 [ 47, %Cond2 ], [ -987654321, %Cond ] +; CHECK-NEXT: %storemerge = phi i32 [ -987654321, %Cond ], [ 47, %Cond2 ] ; CHECK-NEXT: ret i32 %storemerge } diff --git a/llvm/test/Transforms/InstCombine/type_pun.ll b/llvm/test/Transforms/InstCombine/type_pun.ll index 33143ef561b..098164cd029 100644 --- a/llvm/test/Transforms/InstCombine/type_pun.ll +++ b/llvm/test/Transforms/InstCombine/type_pun.ll @@ -10,6 +10,10 @@ ; cleaning up the alloca/store/GEP/load. +; Provide legal integer types. +target datalayout = "p:32:32" + + ; Extracting the zeroth element in an i32 array. define i32 @type_pun_zeroth(<16 x i8> %in) { ; CHECK-LABEL: @type_pun_zeroth( diff --git a/llvm/test/Transforms/LoopSimplify/preserve-scev.ll b/llvm/test/Transforms/LoopSimplify/preserve-scev.ll index bc6d35c3d72..f6fa8afc56b 100644 --- a/llvm/test/Transforms/LoopSimplify/preserve-scev.ll +++ b/llvm/test/Transforms/LoopSimplify/preserve-scev.ll @@ -1,6 +1,9 @@ ; RUN: opt -S < %s -indvars | opt -analyze -iv-users | grep "%cmp = icmp slt i32" | grep "= {%\.ph,+,1}<%for.cond>" ; PR8079 +; Provide legal integer types. +target datalayout = "n8:16:32:64" + ; LoopSimplify should invalidate indvars when splitting out the ; inner loop. diff --git a/llvm/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll b/llvm/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll index 11b3171886e..1e57aee4889 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/2008-08-13-CmpStride.ll @@ -1,5 +1,9 @@ ; RUN: opt < %s -loop-reduce -S | grep add | count 2 ; PR 2662 + +; Provide legal integer types. +target datalayout = "n8:16:32:64" + @g_3 = common global i16 0 ; <i16*> [#uses=2] @"\01LC" = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1] diff --git a/llvm/test/Transforms/LoopStrengthReduce/2008-09-09-Overflow.ll b/llvm/test/Transforms/LoopStrengthReduce/2008-09-09-Overflow.ll index 5fb157b2070..ee21ea4b1c2 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/2008-09-09-Overflow.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/2008-09-09-Overflow.ll @@ -1,5 +1,9 @@ ; RUN: opt < %s -loop-reduce -S | grep phi | count 2 ; PR 2779 + +; Provide legal integer types. +target datalayout = "n8:16:32:64" + @g_19 = common global i32 0 ; <i32*> [#uses=3] @"\01LC" = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1] diff --git a/llvm/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll b/llvm/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll index 3ea4abfe486..5588995a8ce 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll @@ -4,6 +4,10 @@ target triple = "x86-apple-darwin" +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + ; Verify that identical edges are merged. rdar://problem/6453893 ; CHECK-LABEL: @test1( ; CHECK: bb89: diff --git a/llvm/test/Transforms/LoopStrengthReduce/2011-10-06-ReusePhi.ll b/llvm/test/Transforms/LoopStrengthReduce/2011-10-06-ReusePhi.ll index 4388a334ddb..cc8226e1258 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/2011-10-06-ReusePhi.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/2011-10-06-ReusePhi.ll @@ -5,6 +5,10 @@ target triple = "x86-apple-darwin" +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + ; CHECK-LABEL: @test( ; multiplies are hoisted out of the loop ; CHECK: while.body.lr.ph: @@ -17,10 +21,10 @@ target triple = "x86-apple-darwin" ; CHECK: phi ; CHECK: phi ; CHECK-NOT: phi -; CHECK: bitcast float* {{.*}} to i8* -; CHECK: bitcast float* {{.*}} to i8* -; CHECK: getelementptr i8, i8* -; CHECK: getelementptr i8, i8* +; CHECK: bitcast float* {{.*}} to i1* +; CHECK: bitcast float* {{.*}} to i1* +; CHECK: getelementptr i1, i1* +; CHECK: getelementptr i1, i1* define float @test(float* nocapture %A, float* nocapture %B, i32 %N, i32 %IA, i32 %IB) nounwind uwtable readonly ssp { entry: diff --git a/llvm/test/Transforms/LoopStrengthReduce/2012-07-18-LimitReassociate.ll b/llvm/test/Transforms/LoopStrengthReduce/2012-07-18-LimitReassociate.ll index 7cac15f0ec7..edd333b2336 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/2012-07-18-LimitReassociate.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/2012-07-18-LimitReassociate.ll @@ -1,5 +1,4 @@ -; RUN: opt -loop-reduce -disable-output -debug-only=loop-reduce < %s 2> %t -; RUN: FileCheck %s < %t +; RUN: opt -loop-reduce -disable-output -debug-only=loop-reduce < %s 2>&1 | FileCheck %s ; REQUIRES: asserts ; ; PR13361: LSR + SCEV "hangs" on reasonably sized test with sequence of loops @@ -18,6 +17,10 @@ ; CHECK-NOT:reg ; CHECK: Filtering for use +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + %struct.snork = type { %struct.fuga, i32, i32, i32, i32, i32, i32 } %struct.fuga = type { %struct.gork, i64 } %struct.gork = type { i8*, i32, i32, %struct.noot* } diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/2008-08-14-ShadowIV.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/2008-08-14-ShadowIV.ll index 9a7f4865c59..ba03597c525 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/2008-08-14-ShadowIV.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/X86/2008-08-14-ShadowIV.ll @@ -1,5 +1,9 @@ ; RUN: opt < %s -loop-reduce -S -mtriple=x86_64-unknown-unknown | grep "phi double" | count 1 +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + define void @foobar(i32 %n) nounwind { entry: icmp eq i32 %n, 0 ; <i1>:0 [#uses=2] diff --git a/llvm/test/Transforms/LoopStrengthReduce/X86/2011-07-20-DoubleIV.ll b/llvm/test/Transforms/LoopStrengthReduce/X86/2011-07-20-DoubleIV.ll index 2fe62e39fc9..0fc928ca9b2 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/X86/2011-07-20-DoubleIV.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/X86/2011-07-20-DoubleIV.ll @@ -4,6 +4,10 @@ ; nonzero initial value. ; rdar://9786536 +; Provide legal integer types. +target datalayout = "n8:16:32:64" + + ; First, make sure LSR doesn't crash on an empty IVUsers list. ; CHECK-LABEL: @dummyIV( ; CHECK-NOT: phi diff --git a/llvm/test/Transforms/LoopStrengthReduce/count-to-zero.ll b/llvm/test/Transforms/LoopStrengthReduce/count-to-zero.ll index 0e96f02904d..ca93e38ab64 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/count-to-zero.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/count-to-zero.ll @@ -1,6 +1,9 @@ ; RUN: opt < %s -loop-reduce -S | FileCheck %s ; rdar://7382068 +; Provide legal integer types. +target datalayout = "n8:16:32:64" + define void @t(i32 %c) nounwind optsize { entry: br label %bb6 diff --git a/llvm/test/Transforms/LoopStrengthReduce/dont_reverse.ll b/llvm/test/Transforms/LoopStrengthReduce/dont_reverse.ll index 4809def86ae..551bd03f0ae 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/dont_reverse.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/dont_reverse.ll @@ -4,6 +4,10 @@ ; Don't reverse the iteration if the rhs of the compare is defined ; inside the loop. +; Provide legal integer types. +; Declare i2 as legal so that IVUsers accepts to consider %indvar3451 +target datalayout = "n2:8:16:32:64" + define void @Fill_Buffer(i2* %p) nounwind { entry: br label %bb8 diff --git a/llvm/test/Transforms/LoopStrengthReduce/ivchain.ll b/llvm/test/Transforms/LoopStrengthReduce/ivchain.ll index f996f22625f..d95220d238a 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/ivchain.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/ivchain.ll @@ -4,6 +4,10 @@ ; A sign extend feeds an IVUser and cannot be hoisted into the AddRec. ; CollectIVChains should bailout on this case. + +; Provide legal integer types. +target datalayout = "n8:16:32:64" + %struct = type { i8*, i8*, i16, i64, i16, i16, i16, i64, i64, i16, i8*, i64, i64, i64 } ; CHECK-LABEL: @test( diff --git a/llvm/test/Transforms/LoopStrengthReduce/nested-reduce.ll b/llvm/test/Transforms/LoopStrengthReduce/nested-reduce.ll index 58b8d3eecd0..c05b19d8fdd 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/nested-reduce.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/nested-reduce.ll @@ -1,5 +1,8 @@ ; RUN: opt < %s -loop-reduce -S | not grep mul +; Provide legal integer types. +target datalayout = "n8:16:32:64" + ; Make sure we don't get a multiply by 6 in this loop. define i32 @foo(i32 %A, i32 %B, i32 %C, i32 %D) { diff --git a/llvm/test/Transforms/LoopStrengthReduce/pr12691.ll b/llvm/test/Transforms/LoopStrengthReduce/pr12691.ll index dfc1343912c..e33e40503a3 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/pr12691.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/pr12691.ll @@ -1,5 +1,8 @@ ; RUN: opt < %s -loop-reduce -S | FileCheck %s +; Provide legal integer types. +target datalayout = "n8:16:32:64" + @d = common global i32 0, align 4 define void @fn2(i32 %x) nounwind uwtable { diff --git a/llvm/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll b/llvm/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll index 65aa61fb937..483becc0e7b 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/quadradic-exit-value.ll @@ -1,5 +1,8 @@ ; RUN: opt < %s -analyze -iv-users | FileCheck %s +; Provide legal integer types. +target datalayout = "n8:16:32:64" + ; The value of %r is dependent on a polynomial iteration expression. ; ; CHECK-LABEL: IV Users for loop %foo.loop diff --git a/llvm/test/Transforms/LoopStrengthReduce/remove_indvar.ll b/llvm/test/Transforms/LoopStrengthReduce/remove_indvar.ll index fd0e9a5a808..3b92c25389b 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/remove_indvar.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/remove_indvar.ll @@ -1,6 +1,9 @@ ; Check that this test makes INDVAR and related stuff dead. ; RUN: opt < %s -loop-reduce -S | not grep INDVAR +; Provide legal integer types. +target datalayout = "n8:16:32:64" + declare i1 @pred() define void @test(i32* %P) { diff --git a/llvm/test/Transforms/LoopStrengthReduce/variable_stride.ll b/llvm/test/Transforms/LoopStrengthReduce/variable_stride.ll index 7c0f053e4c3..f82b2fc29ac 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/variable_stride.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/variable_stride.ll @@ -1,6 +1,9 @@ ; Check that variable strides are reduced to adds instead of multiplies. ; RUN: opt < %s -loop-reduce -S | not grep mul +; Provide legal integer types. +target datalayout = "n8:16:32:64" + declare i1 @pred(i32) define void @test([10000 x i32]* %P, i32 %STRIDE) { diff --git a/llvm/test/Transforms/PhaseOrdering/scev.ll b/llvm/test/Transforms/PhaseOrdering/scev.ll index 914af360937..c616ca2d768 100644 --- a/llvm/test/Transforms/PhaseOrdering/scev.ll +++ b/llvm/test/Transforms/PhaseOrdering/scev.ll @@ -7,7 +7,7 @@ ; CHECK: test1 ; The loop body contains two increments by %div. ; Make sure that 2*%div is recognizable, and not expressed as a bit mask of %d. -; CHECK: --> {%p,+,(2 * (%d /u 4) * sizeof(i32))} +; CHECK: --> {%p,+,(8 * (%d /u 4))} define void @test1(i64 %d, i32* %p) nounwind uwtable ssp { entry: %div = udiv i64 %d, 4 @@ -36,7 +36,7 @@ for.end: ; preds = %for.cond ; CHECK: test1a ; Same thing as test1, but it is even more tempting to fold 2 * (%d /u 2) -; CHECK: --> {%p,+,(2 * (%d /u 2) * sizeof(i32))} +; CHECK: --> {%p,+,(8 * (%d /u 2))} define void @test1a(i64 %d, i32* %p) nounwind uwtable ssp { entry: %div = udiv i64 %d, 2 diff --git a/llvm/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll b/llvm/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll index 2de2f6717b5..28f503a210c 100644 --- a/llvm/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll +++ b/llvm/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll @@ -1,5 +1,11 @@ ; RUN: opt < %s -scalarrepl -S | not grep shr +; FIXME: I think this test is no longer valid. +; It was working because SROA was aborting when +; no datalayout was supplied +; XFAIL: * + + %struct.S = type { i16 } define zeroext i1 @f(i16 signext %b) { diff --git a/llvm/test/Transforms/Scalarizer/no-data-layout.ll b/llvm/test/Transforms/Scalarizer/no-data-layout.ll deleted file mode 100644 index c89c7868c57..00000000000 --- a/llvm/test/Transforms/Scalarizer/no-data-layout.ll +++ /dev/null @@ -1,25 +0,0 @@ -; RUN: opt %s -scalarizer -scalarize-load-store -S | FileCheck %s - -; Test the handling of loads and stores when no data layout is available. -define void @f1(<4 x float> *%dest, <4 x float> *%src) { -; CHECK: @f1( -; CHECK: %val = load <4 x float>, <4 x float>* %src, align 4 -; CHECK: %val.i0 = extractelement <4 x float> %val, i32 0 -; CHECK: %add.i0 = fadd float %val.i0, %val.i0 -; CHECK: %val.i1 = extractelement <4 x float> %val, i32 1 -; CHECK: %add.i1 = fadd float %val.i1, %val.i1 -; CHECK: %val.i2 = extractelement <4 x float> %val, i32 2 -; CHECK: %add.i2 = fadd float %val.i2, %val.i2 -; CHECK: %val.i3 = extractelement <4 x float> %val, i32 3 -; CHECK: %add.i3 = fadd float %val.i3, %val.i3 -; CHECK: %add.upto0 = insertelement <4 x float> undef, float %add.i0, i32 0 -; CHECK: %add.upto1 = insertelement <4 x float> %add.upto0, float %add.i1, i32 1 -; CHECK: %add.upto2 = insertelement <4 x float> %add.upto1, float %add.i2, i32 2 -; CHECK: %add = insertelement <4 x float> %add.upto2, float %add.i3, i32 3 -; CHECK: store <4 x float> %add, <4 x float>* %dest, align 8 -; CHECK: ret void - %val = load <4 x float> , <4 x float> *%src, align 4 - %add = fadd <4 x float> %val, %val - store <4 x float> %add, <4 x float> *%dest, align 8 - ret void -} |