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