summaryrefslogtreecommitdiffstats
path: root/test/Transforms/GVN
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2011-06-12 15:42:51 +0000
committerdim <dim@FreeBSD.org>2011-06-12 15:42:51 +0000
commitece02cd5829cea836e9365b0845a8ef042d17b0a (patch)
treeb3032e51d630e8070e9e08d6641648f195316a80 /test/Transforms/GVN
parent2b066988909948dc3d53d01760bc2d71d32f3feb (diff)
downloadFreeBSD-src-ece02cd5829cea836e9365b0845a8ef042d17b0a.zip
FreeBSD-src-ece02cd5829cea836e9365b0845a8ef042d17b0a.tar.gz
Vendor import of llvm trunk r132879:
http://llvm.org/svn/llvm-project/llvm/trunk@132879
Diffstat (limited to 'test/Transforms/GVN')
-rw-r--r--test/Transforms/GVN/2007-07-26-InterlockingLoops.ll5
-rw-r--r--test/Transforms/GVN/2008-07-02-Unreachable.ll2
-rw-r--r--test/Transforms/GVN/2011-06-01-NonLocalMemdepMiscompile.ll61
-rw-r--r--test/Transforms/GVN/crash.ll12
-rw-r--r--test/Transforms/GVN/mixed.ll13
-rw-r--r--test/Transforms/GVN/phi-translate-partial-alias.ll27
-rw-r--r--test/Transforms/GVN/preserve-tbaa.ll10
-rw-r--r--test/Transforms/GVN/rle.ll29
8 files changed, 129 insertions, 30 deletions
diff --git a/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll b/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll
index 14cb91b..a1cc008 100644
--- a/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll
+++ b/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll
@@ -4,8 +4,11 @@
define i32 @NextRootMove(i32 %wtm) {
entry:
+ %A = alloca i32*
%tmp17618 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4
+ store i32* %tmp17618, i32** %A
; CHECK: entry:
+; CHECK-NEXT: alloca i32
; CHECK-NEXT: %tmp17618 = load
; CHECK-NOT: load
; CHECK-NOT: phi
@@ -16,6 +19,7 @@ cond_true116:
cond_true128:
%tmp17625 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4
+ store i32* %tmp17625, i32** %A
br i1 false, label %bb98.backedge, label %return.loopexit
bb98.backedge:
@@ -23,6 +27,7 @@ bb98.backedge:
cond_true145:
%tmp17631 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4
+ store i32* %tmp17631, i32** %A
br i1 false, label %bb98.backedge, label %return.loopexit
return.loopexit:
diff --git a/test/Transforms/GVN/2008-07-02-Unreachable.ll b/test/Transforms/GVN/2008-07-02-Unreachable.ll
index be69cfc..407940b 100644
--- a/test/Transforms/GVN/2008-07-02-Unreachable.ll
+++ b/test/Transforms/GVN/2008-07-02-Unreachable.ll
@@ -5,6 +5,7 @@
define i8 @func_1() nounwind {
entry:
+ %A = alloca i8
br i1 false, label %ifelse, label %ifthen
ifthen: ; preds = %entry
@@ -12,6 +13,7 @@ ifthen: ; preds = %entry
ifelse: ; preds = %entry
%tmp3 = load i8* @g_3 ; <i8> [#uses=0]
+ store i8 %tmp3, i8* %A
br label %forcond.thread
forcond.thread: ; preds = %ifelse
diff --git a/test/Transforms/GVN/2011-06-01-NonLocalMemdepMiscompile.ll b/test/Transforms/GVN/2011-06-01-NonLocalMemdepMiscompile.ll
new file mode 100644
index 0000000..f24e956
--- /dev/null
+++ b/test/Transforms/GVN/2011-06-01-NonLocalMemdepMiscompile.ll
@@ -0,0 +1,61 @@
+; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
+; This test is checking that (a) this doesn't crash, and (b) we don't
+; conclude the value of %tmp17 is available in bb1.bb15_crit_edge.
+; rdar://9429882
+
+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"
+target triple = "x86_64-apple-macosx10.7.0"
+
+define i1 @rb_intern() nounwind ssp {
+; CHECK: @rb_intern
+
+bb:
+ %tmp = alloca i8*, align 8
+ store i8* null, i8** %tmp, align 8
+ store i8 undef, i8* null, align 536870912
+ br label %bb1
+
+bb1:
+ br i1 undef, label %bb3, label %bb15
+
+; CHECK: bb1:
+; CHECK: %tmp16 = phi i8* [ getelementptr (i8* null, i64 undef), %bb10 ], [ null, %bb ]
+
+; CHECK: bb1.bb15_crit_edge:
+; CHECK: %tmp17.pre = load i8* %tmp16, align 1
+
+bb3:
+ call void @isalnum()
+ br i1 undef, label %bb10, label %bb5
+
+bb5:
+ br i1 undef, label %bb10, label %bb6
+
+bb6:
+ %tmp7 = load i8** %tmp, align 8
+ %tmp8 = load i8* %tmp7, align 1
+ %tmp9 = zext i8 %tmp8 to i64
+ br i1 undef, label %bb15, label %bb10
+
+bb10:
+ %tmp11 = load i8** %tmp, align 8
+ %tmp12 = load i8* %tmp11, align 1
+ %tmp13 = zext i8 %tmp12 to i64
+ %tmp14 = getelementptr inbounds i8* null, i64 undef
+ store i8* %tmp14, i8** %tmp, align 8
+ br label %bb1
+
+bb15:
+ %tmp16 = load i8** %tmp, align 8
+ %tmp17 = load i8* %tmp16, align 1
+ %tmp18 = icmp eq i8 %tmp17, 0
+ br label %bb19
+
+; CHECK: bb15:
+; CHECK: %tmp17 = phi i8 [ %tmp17.pre, %bb1.bb15_crit_edge ], [ %tmp8, %bb6 ]
+
+bb19: ; preds = %bb15
+ ret i1 %tmp18
+}
+
+declare void @isalnum() nounwind inlinehint ssp
diff --git a/test/Transforms/GVN/crash.ll b/test/Transforms/GVN/crash.ll
index 4a3aa1c..31eae25 100644
--- a/test/Transforms/GVN/crash.ll
+++ b/test/Transforms/GVN/crash.ll
@@ -151,3 +151,15 @@ dead:
dead2:
ret i32 %A
}
+
+
+; PR9841
+define fastcc i8 @test5(i8* %P) nounwind {
+entry:
+ %0 = load i8* %P, align 2
+
+ %Q = getelementptr i8* %P, i32 1
+ %1 = load i8* %Q, align 1
+ ret i8 %1
+}
+
diff --git a/test/Transforms/GVN/mixed.ll b/test/Transforms/GVN/mixed.ll
deleted file mode 100644
index 6bfada2..0000000
--- a/test/Transforms/GVN/mixed.ll
+++ /dev/null
@@ -1,13 +0,0 @@
-; RUN: opt < %s -basicaa -gvn -S | not grep DEADLOAD
-; RUN: opt < %s -basicaa -gvn -S | not grep DEADGEP
-
-define i32 @main(i32** %p) {
-block1:
- %z1 = load i32** %p
- %z2 = getelementptr i32* %z1, i32 0
- %z3 = load i32* %z2
- %DEADLOAD = load i32** %p
- %DEADGEP = getelementptr i32* %DEADLOAD, i32 0
- %DEADLOAD2 = load i32* %DEADGEP
- ret i32 %DEADLOAD2
-}
diff --git a/test/Transforms/GVN/phi-translate-partial-alias.ll b/test/Transforms/GVN/phi-translate-partial-alias.ll
new file mode 100644
index 0000000..47bec41
--- /dev/null
+++ b/test/Transforms/GVN/phi-translate-partial-alias.ll
@@ -0,0 +1,27 @@
+; RUN: opt -basicaa -gvn -S < %s | FileCheck %s
+
+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-f128:128:128-n8:16:32:64"
+
+; GVN shouldn't PRE the load around the loop backedge because it's
+; not actually redundant around the loop backedge, despite appearances
+; if phi-translation is ignored.
+
+; CHECK: define void @test0(i8* %begin)
+; CHECK: loop:
+; CHECK: %l0 = load i8* %phi
+; CHECK: call void @bar(i8 %l0)
+; CHECK: %l1 = load i8* %phi
+define void @test0(i8* %begin) {
+entry:
+ br label %loop
+
+loop:
+ %phi = phi i8* [ %begin, %entry ], [ %next, %loop ]
+ %l0 = load i8* %phi
+ call void @bar(i8 %l0)
+ %l1 = load i8* %phi
+ %next = getelementptr inbounds i8* %phi, i8 %l1
+ br label %loop
+}
+
+declare void @bar(i8)
diff --git a/test/Transforms/GVN/preserve-tbaa.ll b/test/Transforms/GVN/preserve-tbaa.ll
index 2fcfc47..a936755 100644
--- a/test/Transforms/GVN/preserve-tbaa.ll
+++ b/test/Transforms/GVN/preserve-tbaa.ll
@@ -5,9 +5,9 @@ target datalayout = "e-p:64:64:64"
; GVN should preserve the TBAA tag on loads when doing PRE.
; CHECK: @test
-; CHECK: %tmp33.pre = load i16* undef, align 2, !tbaa !0
+; CHECK: %tmp33.pre = load i16* %P, align 2, !tbaa !0
; CHECK: br label %for.body
-define void @test() nounwind {
+define void @test(i16 *%P, i16* %Q) nounwind {
entry:
br i1 undef, label %bb.nph, label %for.end
@@ -15,8 +15,10 @@ bb.nph: ; preds = %entry
br label %for.body
for.body: ; preds = %for.body, %bb.nph
- %tmp33 = load i16* undef, align 2, !tbaa !0
- store i16 undef, i16* undef, align 2, !tbaa !0
+ %tmp33 = load i16* %P, align 2, !tbaa !0
+ store i16 %tmp33, i16* %Q
+
+ store i16 0, i16* %P, align 2, !tbaa !0
br i1 false, label %for.end, label %for.body
for.end: ; preds = %for.body, %entry
diff --git a/test/Transforms/GVN/rle.ll b/test/Transforms/GVN/rle.ll
index 4ff5bec..28b1fc7 100644
--- a/test/Transforms/GVN/rle.ll
+++ b/test/Transforms/GVN/rle.ll
@@ -360,8 +360,11 @@ Cont:
define i32 @chained_load(i32** %p) {
block1:
+ %A = alloca i32*
+
%z = load i32** %p
- br i1 true, label %block2, label %block3
+ store i32* %z, i32** %A
+ br i1 true, label %block2, label %block3
block2:
%a = load i32** %p
@@ -559,14 +562,14 @@ entry:
%add = add nsw i32 %tmp2, %conv
ret i32 %add
-; CHECK: @load_load_partial_alias
-; CHECK: load i32*
-; CHECK-NOT: load
-; CHECK: lshr i32 {{.*}}, 8
-; CHECK-NOT: load
-; CHECK: trunc i32 {{.*}} to i8
-; CHECK-NOT: load
-; CHECK: ret i32
+; TEMPORARILYDISABLED: @load_load_partial_alias
+; TEMPORARILYDISABLED: load i32*
+; TEMPORARILYDISABLED-NOT: load
+; TEMPORARILYDISABLED: lshr i32 {{.*}}, 8
+; TEMPORARILYDISABLED-NOT: load
+; TEMPORARILYDISABLED: trunc i32 {{.*}} to i8
+; TEMPORARILYDISABLED-NOT: load
+; TEMPORARILYDISABLED: ret i32
}
@@ -586,10 +589,10 @@ land.lhs.true: ; preds = %entry
if.end:
ret i32 52
-; CHECK: @load_load_partial_alias_cross_block
-; CHECK: land.lhs.true:
-; CHECK-NOT: load i8
-; CHECK: ret i32 %conv6
+; TEMPORARILY_DISABLED: @load_load_partial_alias_cross_block
+; TEMPORARILY_DISABLED: land.lhs.true:
+; TEMPORARILY_DISABLED-NOT: load i8
+; TEMPORARILY_DISABLED: ret i32 %conv6
}
OpenPOWER on IntegriCloud