brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.1 KiB · 665ca95 Raw
96 lines · plain
1# RUN: llc -x mir -run-pass=twoaddressinstruction < %s | FileCheck %s2# RUN: llc -x mir --passes=two-address-instruction < %s | FileCheck %s3 4# This test checks that TwoAddressInstruction pass does not create redundate COPY5# instruction for STATEPOINT tied operands.6 7--- |8  ; ModuleID = 'statepoint-vreg-twoaddr.ll'9  source_filename = "statepoint-vreg-twoaddr.ll"10  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"11  target triple = "x86_64-pc-linux-gnu"12 13  declare i1 @return_i1()14 15  declare void @consume(ptr addrspace(1))16  declare void @consume1(ptr addrspace(1), ptr addrspace(1))17 18  define i1 @test_relocate(ptr addrspace(1) %a) gc "statepoint-example" {19  entry:20    %safepoint_token = tail call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0) [ "gc-live"(ptr addrspace(1) %a) ]21    %rel1 = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %safepoint_token, i32 0, i32 0) ; (%a, %a)22    %res1 = call zeroext i1 @llvm.experimental.gc.result.i1(token %safepoint_token)23    call void @consume(ptr addrspace(1) %rel1)24    ret i1 %res125  }26 27  define void @test_duplicate_gcregs(ptr addrspace(1) %a) gc "statepoint-example" {28    ret void29  }30 31  ; Function Attrs: nounwind readnone32  declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32 immarg, i32 immarg) #033 34  declare token @llvm.experimental.gc.statepoint.p0(i64 immarg, i32 immarg, ptr, i32 immarg, i32 immarg, ...)35 36  ; Function Attrs: nounwind readnone37  declare i1 @llvm.experimental.gc.result.i1(token) #038 39  attributes #0 = { nounwind readnone }40 41...42---43name:            test_relocate44alignment:       1645tracksRegLiveness: true46registers:47  - { id: 0, class: gr64 }48  - { id: 1, class: gr64 }49  - { id: 2, class: gr8 }50machineFunctionInfo: {}51body:             |52  bb.0:53    liveins: $rdi54 55    ; CHECK-LABEL: name: test_relocate56    ; CHECK: [[VREG1:%[0-9]+]]:gr64 = COPY killed $rdi57    ; CHECK-NOT: [[VREG2:%[0-9]+]]:gr64 = COPY [[VREG1]]58    ; CHECK: [[VREG1]]:gr64 = STATEPOINT 0, 0, 0, target-flags(x86-plt) @return_i1, 2, 0, 2, 0, 2, 0, 2, 1, killed [[VREG1]](tied-def 0), 2, 0, 2, 1, 0, 0, csr_64, implicit-def $rsp, implicit-def $ssp, implicit-def $al59    ; CHECK: $rdi = COPY killed [[VREG1]]60    ; CHECK: CALL64pcrel32 target-flags(x86-plt) @consume, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit-def $rsp, implicit-def $ssp61 62    %0:gr64 = COPY killed $rdi63    %1:gr64 = STATEPOINT 0, 0, 0, target-flags(x86-plt) @return_i1, 2, 0, 2, 0, 2, 0, 2, 1, killed %0(tied-def 0), 2, 0, 2, 1, 0, 0, csr_64, implicit-def $rsp, implicit-def $ssp, implicit-def $al64    %2:gr8 = COPY killed $al65    $rdi = COPY killed %166    CALL64pcrel32 target-flags(x86-plt) @consume, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit-def $rsp, implicit-def $ssp67    $al = COPY killed %268    RET 0, killed $al69 70...71---72name:            test_duplicate_gcregs73alignment:       1674tracksRegLiveness: true75liveins:76  - { reg: '$rdi', virtual-reg: '%0' }77body:             |78  bb.0 (%ir-block.0):79    liveins: $rdi80 81    ; CHECK-LABEL: name: test_duplicate_gcregs82    ; CHECK:   %1:gr64 = COPY %083    ; CHECK:   %2:gr64 = COPY %084    ; CHECK:   %1:gr64, %2:gr64 = STATEPOINT 0, 0, 0, target-flags(x86-plt) @return_i1, 2, 0, 2, 0, 2, 0, 2, 2, %1(tied-def 0), %2(tied-def 1), 2, 0, 2, 2, 0, 0, 1, 1, csr_6485    ; CHECK:   $rdi = COPY killed %186    ; CHECK:   $rsi = COPY killed %287    ; CHECK:   CALL64pcrel32 target-flags(x86-plt) @consume1, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit killed $rsi, implicit-def $rsp, implicit-def $ssp88    ; CHECK:   RET 089    %0:gr64 = COPY killed $rdi90    %1:gr64, %2:gr64 = STATEPOINT 0, 0, 0, target-flags(x86-plt) @return_i1, 2, 0, 2, 0, 2, 0, 2, 2, killed %0(tied-def 0), killed %0(tied-def 1), 2, 0, 2, 2, 0, 0, 1, 1, csr_64, implicit-def $rsp, implicit-def $ssp, implicit-def dead $al91    $rdi = COPY killed %192    $rsi = COPY killed %293    CALL64pcrel32 target-flags(x86-plt) @consume1, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit killed $rsi, implicit-def $rsp, implicit-def $ssp94    RET 095...96