brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 196aebf Raw
75 lines · plain
1; RUN: llc -verify-machineinstrs -mtriple=aarch64-apple-darwin < %s | FileCheck %s --implicit-check-not=.loh --check-prefixes=CHECK,LOH2; RUN: llc -verify-machineinstrs -mtriple=aarch64-apple-darwin -enable-machine-outliner < %s | FileCheck %s --implicit-check-not=.loh --check-prefixes=CHECK,OUTLINE3 4@A = global i32 0, align 45@B = global i32 0, align 46 7declare void @foo();8declare void @bar(ptr %a);9declare void @goo(ptr %a);10 11; CHECK-LABEL: _a0:12define void @a0(i32 %a) {13 14  ; This becomes AdrpAdd when outlining is disabled, otherwise it is outlined15  ; and there should be no LOH.16  %addr = getelementptr inbounds i32, ptr @A, i32 017  %res = load i32, ptr %addr, align 418  ; LOH:      [[L0:Lloh.+]]:19  ; LOH-NEXT:   adrp x19, _A@PAGE20  ; LOH-NEXT: [[L1:Lloh.+]]:21  ; LOH-NEXT:   add x19, x19, _A@PAGEOFF22 23  call void @foo()24  ; OUTLINE:      bl _OUTLINED_FUNCTION_025  ; OUTLINE-NEXT: mov x0, x1926  ; OUTLINE-NEXT: bl _bar27  call void @bar(ptr %addr)28 29  ; This becomes AdrpAddStr.30  %addr2 = getelementptr inbounds i32, ptr @B, i32 431  store i32 %res, ptr %addr2, align 432  ; CHECK:      [[L2:Lloh.+]]:33  ; CHECK-NEXT:   adrp x8, _B@PAGE34  ; CHECK-NEXT: [[L3:Lloh.+]]:35  ; CHECK-NEXT:   add x8, x8, _B@PAGEOFF36  ; CHECK-NEXT: [[L4:Lloh.+]]:37  ; CHECK-NEXT:   str w20, [x8, #16]38  ret void39 40  ; LOH-DAG:   .loh AdrpAdd [[L0]], [[L1]]41  ; CHECK-DAG: .loh AdrpAddStr [[L2]], [[L3]], [[L4]]42  ; CHECK:     .cfi_endproc43}44 45; CHECK-LABEL: _a1:46define i32 @a1(i32 %a) {47 48  ; This becomes AdrpAdd when outlining is disabled, otherwise it is outlined49  ; and there should be no LOH.50  %addr = getelementptr inbounds i32, ptr @A, i32 051  %res = load i32, ptr %addr, align 452  ; LOH:      [[L5:Lloh.+]]:53  ; LOH-NEXT:   adrp x19, _A@PAGE54  ; LOH-NEXT: [[L6:Lloh.+]]:55  ; LOH-NEXT:   add x19, x19, _A@PAGEOFF56 57  call void @foo()58  ; OUTLINE:      bl _OUTLINED_FUNCTION_059  ; OUTLINE-NEXT: mov x0, x1960  ; OUTLINE-NEXT: bl _goo61  call void @goo(ptr %addr)62  ret i32 %res63 64  ; LOH:   .loh AdrpAdd [[L5]], [[L6]]65  ; CHECK: .cfi_endproc66}67 68; Note: it is not safe to add LOHs to this function as outlined functions do not69; follow calling convention and thus x19 could be live across the call.70; OUTLINE: _OUTLINED_FUNCTION_0:71; OUTLINE:   adrp x19, _A@PAGE72; OUTLINE:   add x19, x19, _A@PAGEOFF73; OUTLINE:   ldr w20, [x19]74; OUTLINE:   b _foo75