summaryrefslogtreecommitdiff
path: root/test/Transforms/PhaseOrdering
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-04-28 18:15:47 +0000
committerChris Lattner <sabre@nondot.org>2011-04-28 18:15:47 +0000
commit0a9e3d613bbbd8c47f4edf6841f566fa22775932 (patch)
treece37bda53452205e6f348395e81f1e9de97c4d6e /test/Transforms/PhaseOrdering
parentad3ba6a7de5eb24ea58ba0ec9dd1e41912f678a9 (diff)
downloadllvm-0a9e3d613bbbd8c47f4edf6841f566fa22775932.tar.gz
llvm-0a9e3d613bbbd8c47f4edf6841f566fa22775932.tar.bz2
llvm-0a9e3d613bbbd8c47f4edf6841f566fa22775932.tar.xz
final step needed to resolve PR6627, which allows us to flatten the code down to
a nice and tidy: %x1 = load i32* %0, align 4 %1 = icmp eq i32 %x1, 1179403647 br i1 %1, label %if.then, label %if.end instead of doing lots of loads and branches. May the FreeBSD bootloader long fit in its allocated space. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130416 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/PhaseOrdering')
-rw-r--r--test/Transforms/PhaseOrdering/basic.ll46
1 files changed, 45 insertions, 1 deletions
diff --git a/test/Transforms/PhaseOrdering/basic.ll b/test/Transforms/PhaseOrdering/basic.ll
index aeb2bc4d1a..c66e150aa7 100644
--- a/test/Transforms/PhaseOrdering/basic.ll
+++ b/test/Transforms/PhaseOrdering/basic.ll
@@ -60,7 +60,7 @@ if.then: ; preds = %land.lhs.true17
%call25 = call i32 (...)* @doo()
br label %if.end
-if.end: ; preds = %if.then, %land.lhs.true17, %land.lhs.true9, %land.lhs.true, %entry
+if.end:
ret void
; CHECK: @test2
@@ -71,3 +71,47 @@ if.end: ; preds = %if.then, %land.lhs.
declare i32 @doo(...)
+; PR6627 - This should all be flattened down to one compare. This is the same
+; as test2, except that the initial load is done as an i8 instead of i32, thus
+; requiring widening.
+define void @test2a(i8* %arrayidx) nounwind ssp {
+entry:
+ %x1 = load i8* %arrayidx, align 4
+ %conv = zext i8 %x1 to i32
+ %cmp = icmp eq i32 %conv, 127
+ br i1 %cmp, label %land.lhs.true, label %if.end
+
+land.lhs.true: ; preds = %entry
+ %arrayidx4 = getelementptr inbounds i8* %arrayidx, i64 1
+ %tmp5 = load i8* %arrayidx4, align 1
+ %conv6 = zext i8 %tmp5 to i32
+ %cmp7 = icmp eq i32 %conv6, 69
+ br i1 %cmp7, label %land.lhs.true9, label %if.end
+
+land.lhs.true9: ; preds = %land.lhs.true
+ %arrayidx12 = getelementptr inbounds i8* %arrayidx, i64 2
+ %tmp13 = load i8* %arrayidx12, align 1
+ %conv14 = zext i8 %tmp13 to i32
+ %cmp15 = icmp eq i32 %conv14, 76
+ br i1 %cmp15, label %land.lhs.true17, label %if.end
+
+land.lhs.true17: ; preds = %land.lhs.true9
+ %arrayidx20 = getelementptr inbounds i8* %arrayidx, i64 3
+ %tmp21 = load i8* %arrayidx20, align 1
+ %conv22 = zext i8 %tmp21 to i32
+ %cmp23 = icmp eq i32 %conv22, 70
+ br i1 %cmp23, label %if.then, label %if.end
+
+if.then: ; preds = %land.lhs.true17
+ %call25 = call i32 (...)* @doo()
+ br label %if.end
+
+if.end:
+ ret void
+
+; CHECK: @test2a
+; CHECK: %x1 = load i32* {{.*}}, align 4
+; CHECK-NEXT: icmp eq i32 %x1, 1179403647
+; CHECK-NEXT: br i1 {{.*}}, label %if.then, label %if.end
+}
+