Krzysztof Parzyszek | b28ae10 | 2016-01-14 15:05:27 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=hexagon < %s |
| 2 | ; REQUIRES: asserts |
| 3 | ; |
| 4 | ; The tail calls to foo and bar are branches with functions as operands, |
| 5 | ; instead of basic blocks. Make sure we don't crash on such instructions. |
| 6 | |
| 7 | 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" |
| 8 | target triple = "hexagon" |
| 9 | |
| 10 | %struct.t0 = type { i8, [2 x i8] } |
| 11 | %struct.t1 = type { i8, i8, [1900 x i8], %struct.t0 } |
| 12 | |
| 13 | @var = internal global [3 x %struct.t1] zeroinitializer, align 8 |
| 14 | declare void @foo() #2 |
| 15 | declare void @bar(i32, i32) #2 |
| 16 | |
| 17 | ; Function Attrs: nounwind |
| 18 | define void @fred(i8 signext %a, i8 signext %b) #1 { |
| 19 | entry: |
| 20 | %i = sext i8 %a to i32 |
| 21 | %t = getelementptr inbounds [3 x %struct.t1], [3 x %struct.t1]* @var, i32 0, i32 %i, i32 3, i32 0 |
| 22 | %0 = load i8, i8* %t, align 8 |
| 23 | switch i8 %0, label %if.end14 [ |
| 24 | i8 1, label %if.then |
| 25 | i8 0, label %do.body |
| 26 | ] |
| 27 | |
| 28 | if.then: ; preds = %entry |
| 29 | %j = sext i8 %b to i32 |
| 30 | %u = getelementptr inbounds [3 x %struct.t1], [3 x %struct.t1]* @var, i32 0, i32 %i, i32 3, i32 1, i32 %j |
| 31 | store i8 1, i8* %u, align 1 |
| 32 | tail call void @foo() #0 |
| 33 | br label %if.end14 |
| 34 | |
| 35 | do.body: ; preds = %entry |
| 36 | %conv11 = sext i8 %b to i32 |
| 37 | tail call void @bar(i32 %i, i32 %conv11) #0 |
| 38 | br label %if.end14 |
| 39 | |
| 40 | if.end14: ; preds = %entry, %do.body, %if.then |
| 41 | ret void |
| 42 | } |
| 43 | |
| 44 | attributes #0 = { nounwind } |
| 45 | attributes #1 = { nounwind "disable-tail-calls"="false" } |
| 46 | attributes #2 = { "disable-tail-calls"="false" } |