blob: d4e7264712385f64e2a854e978abbb26f725b9c1 [file] [log] [blame]
Krzysztof Parzyszek7bb63ac2016-10-19 16:30:56 +00001; RUN: llc -march=hexagon -verify-machineinstrs < %s | FileCheck %s
2; Check that this testcase compiles successfully.
3; CHECK-LABEL: fred:
4; CHECK: call foo
5
6target triple = "hexagon"
7
8%struct.0 = type { i32, i16, i8* }
9
Matt Arsenaultf10061e2017-04-10 20:18:21 +000010declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
11declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
Krzysztof Parzyszek7bb63ac2016-10-19 16:30:56 +000012
13define i32 @fred(i8* readonly %p0, i32* %p1) local_unnamed_addr #0 {
14entry:
15 %v0 = alloca i16, align 2
16 %v1 = icmp eq i8* %p0, null
17 br i1 %v1, label %if.then, label %lor.lhs.false
18
19lor.lhs.false: ; preds = %entry
20 %v2 = bitcast i8* %p0 to %struct.0**
21 %v3 = load %struct.0*, %struct.0** %v2, align 4
22 %v4 = icmp eq %struct.0* %v3, null
23 br i1 %v4, label %if.then, label %if.else
24
25if.then: ; preds = %lor.lhs.false, %ent
26 %v5 = icmp eq i32* %p1, null
27 br i1 %v5, label %cleanup, label %if.then3
28
29if.then3: ; preds = %if.then
30 store i32 0, i32* %p1, align 4
31 br label %cleanup
32
33if.else: ; preds = %lor.lhs.false
34 %v6 = bitcast i16* %v0 to i8*
Matt Arsenaultf10061e2017-04-10 20:18:21 +000035 call void @llvm.lifetime.start.p0i8(i64 2, i8* nonnull %v6) #0
Krzysztof Parzyszek7bb63ac2016-10-19 16:30:56 +000036 store i16 0, i16* %v0, align 2
37 %v7 = call i32 @foo(%struct.0* nonnull %v3, i16* nonnull %v0) #0
38 %v8 = icmp eq i32* %p1, null
39 br i1 %v8, label %if.end7, label %if.then6
40
41if.then6: ; preds = %if.else
42 %v9 = load i16, i16* %v0, align 2
43 %v10 = zext i16 %v9 to i32
44 store i32 %v10, i32* %p1, align 4
45 br label %if.end7
46
47if.end7: ; preds = %if.else, %if.then6
Matt Arsenaultf10061e2017-04-10 20:18:21 +000048 call void @llvm.lifetime.end.p0i8(i64 2, i8* nonnull %v6) #0
Krzysztof Parzyszek7bb63ac2016-10-19 16:30:56 +000049 br label %cleanup
50
51cleanup: ; preds = %if.then3, %if.then,
52 %v11 = phi i32 [ %v7, %if.end7 ], [ -2147024809, %if.then ], [ -2147024809, %if.then3 ]
53 ret i32 %v11
54}
55
56declare i32 @foo(%struct.0*, i16*) local_unnamed_addr #0
57
58attributes #0 = { nounwind }
59attributes #1 = { argmemonly nounwind }
60