xref: /llvm-project/llvm/test/CodeGen/X86/callbr-asm-sink.ll (revision 6e83c0a1cbfdb0c0f13c282312c47c7945970f55)
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;; Verify that the machine instructions generated from the first
5;; getelementptr don't get sunk below the callbr. (Reduced from a bug
6;; report.)
7
8%struct1 = type { ptr, i32 }
9
10define void @klist_dec_and_del(ptr) {
11; CHECK-LABEL: klist_dec_and_del:
12; CHECK:       # %bb.0:
13; CHECK-NEXT:    leaq 8(%rdi), %rax
14; CHECK-NEXT:    #APP
15; CHECK-NEXT:    # 8(%rdi) .LBB0_1
16; CHECK-NEXT:    #NO_APP
17; CHECK-NEXT:  # %bb.2:
18; CHECK-NEXT:    retq
19; CHECK-NEXT:  .LBB0_1: # Block address taken
20; CHECK-NEXT:    # Label of block must be emitted
21; CHECK-NEXT:    movq $0, -8(%rax)
22; CHECK-NEXT:    retq
23  %2 = getelementptr inbounds %struct1, ptr %0, i64 0, i32 1
24  callbr void asm sideeffect "# $0 $1", "*m,!i,~{memory},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %2)
25          to label %6 [label %3]
26
273:
28  %4 = getelementptr i32, ptr %2, i64 -2
29  %5 = bitcast ptr %4 to ptr
30  store ptr null, ptr %5, align 8
31  br label %6
32
336:
34  ret void
35}
36