1; RUN: llc %s -o - -fast-isel=true -O1 -verify-machineinstrs | FileCheck %s
2
3target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
4target triple = "thumbv7-apple-ios8.0.0"
5
6; Tail duplication was incorrectly leaving kill flags on the duplicated instructions.
7; The machine verifier is able to spot this error, so this test should pass if it passes verification.
8
9; CHECK-LABEL: @test
10
11%struct.cdiff_ctx = type { i8*, %struct.cdiff_node*, %struct.cdiff_node*, %struct.cdiff_node*, %struct.cdiff_node* }
12%struct.cdiff_node = type { i32, i8*, i8*, %struct.cdiff_node* }
13
14declare i32 @logg(i32)
15
16define hidden i32 @test(%struct.cdiff_ctx* nocapture %ctx, %struct.cdiff_node* %tmp10) {
17bb:
18  br label %.outer
19
20bb33:                                             ; preds = %bb92, %.outer
21  %lines.0 = phi i32 [ %tmp37, %bb92 ], [ %lines.0.ph, %.outer ]
22  %tmp37 = add i32 %lines.0, 1
23  %tmp39 = load i32, i32* %tmp57, align 4
24  %tmp40 = icmp eq i32 %tmp39, %tmp37
25  br i1 %tmp40, label %bb41, label %bb92
26
27bb41:                                             ; preds = %bb33
28  %tmp45 = call i32 @strncmp()
29  %tmp46 = icmp eq i32 %tmp45, 0
30  br i1 %tmp46, label %bb53, label %bb47
31
32bb47:                                             ; preds = %bb41
33  %tmp52 = call i32 @logg(i32 %tmp37)
34  ret i32 -1
35
36bb53:                                             ; preds = %bb41
37  %tmp54 = getelementptr inbounds %struct.cdiff_node, %struct.cdiff_node* %del.0.ph, i32 0, i32 3
38  %tmp55 = load %struct.cdiff_node*, %struct.cdiff_node** %tmp54, align 4
39  br label %.outer
40
41.outer:                                           ; preds = %bb53, %bb
42  %del.0.ph = phi %struct.cdiff_node* [ %tmp55, %bb53 ], [ null, %bb ]
43  %lines.0.ph = phi i32 [ 1, %bb53 ], [ 0, %bb ]
44  %tmp57 = getelementptr inbounds %struct.cdiff_node, %struct.cdiff_node* %del.0.ph, i32 0, i32 0
45  br label %bb33
46
47bb92:                                             ; preds = %bb33
48  %tmp93 = call i32 @puts()
49  br label %bb33
50}
51
52declare i32 @strncmp()
53
54declare i32 @puts()
55