summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-01-20 13:14:52 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-01-20 13:14:52 +0000
commit2451c4835a7332190255c497c00f1b1150aebf8d (patch)
tree13526ea0d6b02b8eae6791e6d29c216983be8609 /llvm/test
parentd3341f50213718b386df066a47ee6f396140c4fb (diff)
downloadbcm5719-llvm-2451c4835a7332190255c497c00f1b1150aebf8d.tar.gz
bcm5719-llvm-2451c4835a7332190255c497c00f1b1150aebf8d.zip
Proper handling of diamond-like cases in if-conversion
If converter was somewhat careless about "diamond" cases, where there was no join block, or in other words, where the true/false blocks did not have analyzable branches. In such cases, it was possible for it to remove (needed) branches, resulting in a loss of entire basic blocks. Differential Revision: http://reviews.llvm.org/D16156 llvm-svn: 258310
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/Hexagon/ifcvt-diamond-bad.ll43
1 files changed, 43 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Hexagon/ifcvt-diamond-bad.ll b/llvm/test/CodeGen/Hexagon/ifcvt-diamond-bad.ll
new file mode 100644
index 00000000000..e4bee8354a7
--- /dev/null
+++ b/llvm/test/CodeGen/Hexagon/ifcvt-diamond-bad.ll
@@ -0,0 +1,43 @@
+; RUN: llc -march=hexagon -minimum-jump-tables=1 < %s
+; REQUIRES: asserts
+
+target datalayout = "e-m:e-p:32:32:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f64:64:64-f32:32:32-v64:64:64-v32:32:32-a:0-n16:32"
+target triple = "hexagon"
+
+%struct.t0 = type { i8, [2 x i8] }
+%struct.t1 = type { i8, i8, [1900 x i8], %struct.t0 }
+
+@var = internal global [3 x %struct.t1] zeroinitializer, align 8
+declare void @foo() #2
+declare void @bar(i32, i32) #2
+
+; Function Attrs: nounwind
+define void @fred(i8 signext %a, i8 signext %b) #1 {
+entry:
+ %i = sext i8 %a to i32
+ %t = getelementptr inbounds [3 x %struct.t1], [3 x %struct.t1]* @var, i32 0, i32 %i, i32 3, i32 0
+ %0 = load i8, i8* %t, align 8
+ switch i8 %0, label %if.end14 [
+ i8 1, label %if.then
+ i8 0, label %do.body
+ ]
+
+if.then: ; preds = %entry
+ %j = sext i8 %b to i32
+ %u = getelementptr inbounds [3 x %struct.t1], [3 x %struct.t1]* @var, i32 0, i32 %i, i32 3, i32 1, i32 %j
+ store i8 1, i8* %u, align 1
+ tail call void @foo() #0
+ br label %if.end14
+
+do.body: ; preds = %entry
+ %conv11 = sext i8 %b to i32
+ tail call void @bar(i32 %i, i32 %conv11) #0
+ br label %if.end14
+
+if.end14: ; preds = %entry, %do.body, %if.then
+ ret void
+}
+
+attributes #0 = { nounwind }
+attributes #1 = { nounwind "disable-tail-calls"="false" }
+attributes #2 = { "disable-tail-calls"="false" }
OpenPOWER on IntegriCloud