1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s 3 4; This test hung in the BranchFolding pass during asm-goto bring up 5 6@e = global i32 0 7@j = global i32 0 8 9define void @n(i32* %o, i32 %p, i32 %u) nounwind { 10; CHECK-LABEL: n: 11; CHECK: # %bb.0: # %entry 12; CHECK-NEXT: pushq %rbp 13; CHECK-NEXT: pushq %r15 14; CHECK-NEXT: pushq %r14 15; CHECK-NEXT: pushq %r13 16; CHECK-NEXT: pushq %r12 17; CHECK-NEXT: pushq %rbx 18; CHECK-NEXT: pushq %rax 19; CHECK-NEXT: movl %edx, %ebx 20; CHECK-NEXT: movl %esi, %r12d 21; CHECK-NEXT: movq %rdi, %r15 22; CHECK-NEXT: callq c 23; CHECK-NEXT: movl %eax, %r13d 24; CHECK-NEXT: movq %r15, %rdi 25; CHECK-NEXT: callq l 26; CHECK-NEXT: testl %eax, %eax 27; CHECK-NEXT: jne .LBB0_10 28; CHECK-NEXT: # %bb.1: # %if.end 29; CHECK-NEXT: movl %ebx, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill 30; CHECK-NEXT: cmpl $0, {{.*}}(%rip) 31; CHECK-NEXT: # implicit-def: $ebx 32; CHECK-NEXT: # implicit-def: $r14d 33; CHECK-NEXT: je .LBB0_4 34; CHECK-NEXT: # %bb.2: # %if.then4 35; CHECK-NEXT: movslq %r12d, %rdi 36; CHECK-NEXT: callq m 37; CHECK-NEXT: # implicit-def: $ebx 38; CHECK-NEXT: # implicit-def: $ebp 39; CHECK-NEXT: .LBB0_3: # %r 40; CHECK-NEXT: callq c 41; CHECK-NEXT: movl %ebp, %r14d 42; CHECK-NEXT: .LBB0_4: # %if.end8 43; CHECK-NEXT: movl %ebx, %edi 44; CHECK-NEXT: callq i 45; CHECK-NEXT: movl %eax, %ebp 46; CHECK-NEXT: orl %r14d, %ebp 47; CHECK-NEXT: testl %r13d, %r13d 48; CHECK-NEXT: je .LBB0_6 49; CHECK-NEXT: # %bb.5: 50; CHECK-NEXT: andl $4, %ebx 51; CHECK-NEXT: jmp .LBB0_3 52; CHECK-NEXT: .LBB0_6: # %if.end12 53; CHECK-NEXT: testl %ebp, %ebp 54; CHECK-NEXT: je .LBB0_9 55; CHECK-NEXT: # %bb.7: # %if.then14 56; CHECK-NEXT: movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload 57; CHECK-NEXT: #APP 58; CHECK-NEXT: #NO_APP 59; CHECK-NEXT: jmp .LBB0_10 60; CHECK-NEXT: .Ltmp0: # Block address taken 61; CHECK-NEXT: # %bb.8: # %if.then20.critedge 62; CHECK-NEXT: movl {{.*}}(%rip), %edi 63; CHECK-NEXT: movslq %eax, %rcx 64; CHECK-NEXT: movl $1, %esi 65; CHECK-NEXT: movq %r15, %rdx 66; CHECK-NEXT: addq $8, %rsp 67; CHECK-NEXT: popq %rbx 68; CHECK-NEXT: popq %r12 69; CHECK-NEXT: popq %r13 70; CHECK-NEXT: popq %r14 71; CHECK-NEXT: popq %r15 72; CHECK-NEXT: popq %rbp 73; CHECK-NEXT: jmp k # TAILCALL 74; CHECK-NEXT: .LBB0_9: # %if.else 75; CHECK-NEXT: incq 0 76; CHECK-NEXT: .LBB0_10: # %cleanup 77; CHECK-NEXT: addq $8, %rsp 78; CHECK-NEXT: popq %rbx 79; CHECK-NEXT: popq %r12 80; CHECK-NEXT: popq %r13 81; CHECK-NEXT: popq %r14 82; CHECK-NEXT: popq %r15 83; CHECK-NEXT: popq %rbp 84; CHECK-NEXT: retq 85entry: 86 %call = tail call i32 @c() 87 %call1 = tail call i32 @l(i32* %o) 88 %tobool = icmp eq i32 %call1, 0 89 br i1 %tobool, label %if.end, label %cleanup 90 91if.end: ; preds = %entry 92 %0 = load i32, i32* @e 93 %tobool3 = icmp eq i32 %0, 0 94 br i1 %tobool3, label %if.end8, label %if.then4, !prof !0 95 96if.then4: ; preds = %if.end 97 %conv5 = sext i32 %p to i64 98 %call6 = tail call i32 @m(i64 %conv5) 99 br label %r 100 101r: ; preds = %if.end8, %if.then4 102 %flags.0 = phi i32 [ undef, %if.then4 ], [ %and, %if.end8 ] 103 %major.0 = phi i32 [ undef, %if.then4 ], [ %or, %if.end8 ] 104 %call7 = tail call i32 @c() 105 br label %if.end8 106 107if.end8: ; preds = %r, %if.end 108 %flags.1 = phi i32 [ %flags.0, %r ], [ undef, %if.end ] 109 %major.1 = phi i32 [ %major.0, %r ], [ undef, %if.end ] 110 %call9 = tail call i32 @i(i32 %flags.1) 111 %or = or i32 %call9, %major.1 112 %and = and i32 %flags.1, 4 113 %tobool10 = icmp eq i32 %call, 0 114 br i1 %tobool10, label %if.end12, label %r 115 116if.end12: ; preds = %if.end8 117 %tobool13 = icmp eq i32 %or, 0 118 br i1 %tobool13, label %if.else, label %if.then14 119 120if.then14: ; preds = %if.end12 121 callbr void asm sideeffect "", "X,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@n, %if.then20.critedge)) 122 to label %cleanup [label %if.then20.critedge] 123 124if.then20.critedge: ; preds = %if.then14 125 %1 = load i32, i32* @j 126 %conv21 = sext i32 %u to i64 127 %call22 = tail call i32 @k(i32 %1, i64 1, i32* %o, i64 %conv21) 128 br label %cleanup 129 130if.else: ; preds = %if.end12 131 %2 = load i64, i64* null 132 %inc = add i64 %2, 1 133 store i64 %inc, i64* null 134 br label %cleanup 135 136cleanup: ; preds = %if.else, %if.then20.critedge, %if.then14, %entry 137 ret void 138} 139 140declare dso_local i32 @c() 141 142declare dso_local i32 @l(i32*) 143 144declare dso_local i32 @m(i64) 145 146declare dso_local i32 @i(i32) 147 148declare dso_local i32 @k(i32, i64, i32*, i64) 149 150!0 = !{!"branch_weights", i32 2000, i32 1} 151