1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu -verify-machineinstrs -O2 < %s | FileCheck %s
4 ;; https://llvm.org/PR47468
6 ;; PHI elimination should place copies BEFORE the inline asm, not
7 ;; after, even if the inline-asm uses as an input the same value as
10 declare void @foo(ptr)
12 define void @test1(ptr %arg, ptr %mem) nounwind {
14 ; CHECK: # %bb.0: # %entry
15 ; CHECK-NEXT: pushq %r14
16 ; CHECK-NEXT: pushq %rbx
17 ; CHECK-NEXT: pushq %rax
18 ; CHECK-NEXT: movq %rsi, %rbx
19 ; CHECK-NEXT: .LBB0_1: # Block address taken
21 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
22 ; CHECK-NEXT: # Label of block must be emitted
23 ; CHECK-NEXT: movq (%rbx), %r14
24 ; CHECK-NEXT: callq foo@PLT
25 ; CHECK-NEXT: movq %r14, %rdi
28 ; CHECK-NEXT: # %bb.2: # %end
29 ; CHECK-NEXT: addq $8, %rsp
30 ; CHECK-NEXT: popq %rbx
31 ; CHECK-NEXT: popq %r14
37 %a = phi ptr [ %arg, %entry ], [ %b, %loop ]
38 %b = load ptr, ptr %mem, align 8
39 call void @foo(ptr %a)
40 callbr void asm sideeffect "", "*m,!i"(ptr elementtype(i8) %b)
41 to label %end [label %loop]