blob: f26ab9b0cef2c37967fba09c16143e8856b445a0 [file] [log] [blame]
Krzysztof Parzyszek2db0c8b2016-09-07 20:37:05 +00001; RUN: llc -march=hexagon -verify-machineinstrs < %s | FileCheck %s
2; Check that we don't crash.
3; CHECK: call printf
4target triple = "hexagon"
5
6%struct.1 = type { i16, i8, i32, i8*, i8*, i8*, i8*, i8*, i8*, i32* }
7%struct.0 = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }
8
9declare void @foo(%struct.1*, %struct.0* readonly) local_unnamed_addr #0
10declare zeroext i8 @bar() local_unnamed_addr #0
11declare i32 @printf(i8* nocapture readonly, ...) local_unnamed_addr #0
12
13@.str = private unnamed_addr constant [5 x i8] c"blah\00", align 1
14
15define i32 @main(i32 %argc, i8** nocapture readonly %argv) local_unnamed_addr #0 {
16entry:
17 %t0 = alloca %struct.0, align 4
18 br label %do.body
19
20do.body: ; preds = %if.end88.do.body_crit_edge, %entry
21 %cond = icmp eq i32 undef, 0
22 br i1 %cond, label %if.end49, label %if.then124
23
24if.end49: ; preds = %do.body
25 br i1 undef, label %if.end55, label %if.then53
26
27if.then53: ; preds = %if.end49
28 call void @foo(%struct.1* null, %struct.0* nonnull %t0)
29 br label %if.end55
30
31if.end55: ; preds = %if.then53, %if.end49
32 %call76 = call zeroext i8 @bar() #0
33 switch i8 %call76, label %sw.epilog79 [
34 i8 0, label %sw.bb77
35 i8 3, label %sw.bb77
36 ]
37
38sw.bb77: ; preds = %if.end55, %if.end55
39 unreachable
40
41sw.epilog79: ; preds = %if.end55
42 br i1 undef, label %if.end88, label %if.then81
43
44if.then81: ; preds = %sw.epilog79
45 %div87 = fdiv float 0.000000e+00, undef
46 br label %if.end88
47
48if.end88: ; preds = %if.then81, %sw.epilog79
49 %t1 = phi float [ undef, %sw.epilog79 ], [ %div87, %if.then81 ]
50 %div89 = fdiv float 1.000000e+00, %t1
51 %.sroa.speculated = select i1 undef, float 0.000000e+00, float undef
52 %conv108 = fpext float %.sroa.speculated to double
53 %call113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), double undef, double %conv108, i64 undef, i32 undef) #0
54 br i1 undef, label %if.end88.do.body_crit_edge, label %if.then124
55
56if.end88.do.body_crit_edge: ; preds = %if.end88
57 br label %do.body
58
59if.then124: ; preds = %if.end88, %do.body
60 %t2 = phi float [ undef, %do.body ], [ %t1, %if.end88 ]
61 ret i32 0
62}
63
64attributes #0 = { nounwind }