brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.0 KiB · 2abd684 Raw
93 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -verify-machineinstrs < %s | FileCheck %s3 4target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"5target triple = "x86_64-pc-linux-gnu"6 7declare void @use(...)8declare void @f()9declare token @llvm.experimental.gc.statepoint.p0(i64, i32, ptr, i32, i32, ...)10declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32, i32) #311 12;; Two gc.relocates of the same input, should require only a single spill/fill13define void @test_gcrelocate_uniqueing(ptr addrspace(1) %ptr) gc "statepoint-example" {14; CHECK-LABEL: test_gcrelocate_uniqueing:15; CHECK:       # %bb.0:16; CHECK-NEXT:    pushq %rax17; CHECK-NEXT:    .cfi_def_cfa_offset 1618; CHECK-NEXT:    movq %rdi, (%rsp)19; CHECK-NEXT:    callq f@PLT20; CHECK-NEXT:  .Ltmp0:21; CHECK-NEXT:    movq (%rsp), %rdi22; CHECK-NEXT:    movq %rdi, %rsi23; CHECK-NEXT:    xorl %eax, %eax24; CHECK-NEXT:    callq use@PLT25; CHECK-NEXT:    popq %rax26; CHECK-NEXT:    .cfi_def_cfa_offset 827; CHECK-NEXT:    retq28  %tok = tail call token (i64, i32, ptr, i32, i32, ...)29      @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void ()) @f, i32 0, i32 0, i32 0, i32 0) ["gc-live" (ptr addrspace(1) %ptr, ptr addrspace(1) %ptr), "deopt" (ptr addrspace(1) %ptr, i32 undef)]30  %a = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %tok, i32 0, i32 0)31  %b = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %tok, i32 1, i32 1)32  call void (...) @use(ptr addrspace(1) %a, ptr addrspace(1) %b)33  ret void34}35 36;; Two gc.relocates of a bitcasted pointer should only require a single spill/fill37define void @test_gcptr_uniqueing(ptr addrspace(1) %ptr) gc "statepoint-example" {38; CHECK-LABEL: test_gcptr_uniqueing:39; CHECK:       # %bb.0:40; CHECK-NEXT:    pushq %rax41; CHECK-NEXT:    .cfi_def_cfa_offset 1642; CHECK-NEXT:    movq %rdi, (%rsp)43; CHECK-NEXT:    callq f@PLT44; CHECK-NEXT:  .Ltmp1:45; CHECK-NEXT:    movq (%rsp), %rdi46; CHECK-NEXT:    movq %rdi, %rsi47; CHECK-NEXT:    xorl %eax, %eax48; CHECK-NEXT:    callq use@PLT49; CHECK-NEXT:    popq %rax50; CHECK-NEXT:    .cfi_def_cfa_offset 851; CHECK-NEXT:    retq52  %tok = tail call token (i64, i32, ptr, i32, i32, ...)53      @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void ()) @f, i32 0, i32 0, i32 0, i32 0) ["gc-live" (ptr addrspace(1) %ptr, ptr addrspace(1) %ptr), "deopt" (ptr addrspace(1) %ptr, i32 undef)]54  %a = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %tok, i32 0, i32 0)55  %b = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %tok, i32 1, i32 1)56  call void (...) @use(ptr addrspace(1) %a, ptr addrspace(1) %b)57  ret void58}59 60;; A GC value is not dead, and does need to be spill (but not filed) if61;; that same value is also in the deopt list.62define void @test_deopt_use(ptr addrspace(1) %ptr) gc "statepoint-example" {63; CHECK-LABEL: test_deopt_use:64; CHECK:       # %bb.0:65; CHECK-NEXT:    pushq %rax66; CHECK-NEXT:    .cfi_def_cfa_offset 1667; CHECK-NEXT:    movq %rdi, (%rsp)68; CHECK-NEXT:    callq f@PLT69; CHECK-NEXT:  .Ltmp2:70; CHECK-NEXT:    popq %rax71; CHECK-NEXT:    .cfi_def_cfa_offset 872; CHECK-NEXT:    retq73  tail call token (i64, i32, ptr, i32, i32, ...)74      @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void ()) @f, i32 0, i32 0, i32 0, i32 0) ["gc-live" (ptr addrspace(1) %ptr), "deopt" (ptr addrspace(1) %ptr, i32 undef)]75  ret void76}77 78;; A GC value which is truely unused does not need to spilled or filled.79define void @test_dse(ptr addrspace(1) %ptr) gc "statepoint-example" {80; CHECK-LABEL: test_dse:81; CHECK:       # %bb.0:82; CHECK-NEXT:    pushq %rax83; CHECK-NEXT:    .cfi_def_cfa_offset 1684; CHECK-NEXT:    callq f@PLT85; CHECK-NEXT:  .Ltmp3:86; CHECK-NEXT:    popq %rax87; CHECK-NEXT:    .cfi_def_cfa_offset 888; CHECK-NEXT:    retq89  tail call token (i64, i32, ptr, i32, i32, ...)90      @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(void ()) @f, i32 0, i32 0, i32 0, i32 0) ["gc-live" (ptr addrspace(1) %ptr)]91  ret void92}93