diff options
| author | Philip Reames <listmail@philipreames.com> | 2016-12-13 01:38:41 +0000 |
|---|---|---|
| committer | Philip Reames <listmail@philipreames.com> | 2016-12-13 01:38:41 +0000 |
| commit | 1f1bbac8dac99605128981effa3edebb03099916 (patch) | |
| tree | ca5bdef2ba7734d606841a178dd32dc2be72be57 /llvm/test/CodeGen | |
| parent | 51387a8c28ca43ceadd29aa58fde8fe1103f9a2a (diff) | |
| download | bcm5719-llvm-1f1bbac8dac99605128981effa3edebb03099916.tar.gz bcm5719-llvm-1f1bbac8dac99605128981effa3edebb03099916.zip | |
[peephole] Enhance folding logic to work for STATEPOINTs
The general idea here is to get enough of the existing restrictions out of the way that the already existing folding logic in foldMemoryOperand can kick in for STATEPOINTs and fold references to immutable stack slots. The key changes are:
Support for folding multiple operands at once which reference the same load
Support for folding multiple loads into a single instruction
Walk all the operands of the instruction for varidic instructions (this is a bug fix!)
Once this lands, I'll post another patch which refactors the TII interface here. There's nothing actually x86 specific about the x86 code used here.
Differential Revision: https://reviews.llvm.org/D24103
llvm-svn: 289510
Diffstat (limited to 'llvm/test/CodeGen')
| -rw-r--r-- | llvm/test/CodeGen/X86/anyregcc.ll | 52 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/stackmap.ll | 4 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/statepoint-live-in.ll | 31 |
3 files changed, 38 insertions, 49 deletions
diff --git a/llvm/test/CodeGen/X86/anyregcc.ll b/llvm/test/CodeGen/X86/anyregcc.ll index 018a92a52f7..1b51b53bd22 100644 --- a/llvm/test/CodeGen/X86/anyregcc.ll +++ b/llvm/test/CodeGen/X86/anyregcc.ll @@ -34,7 +34,7 @@ ; CHECK-NEXT: .quad 56 ; CHECK-NEXT: .quad 1 ; CHECK-NEXT: .quad _anyreg_test2 -; CHECK-NEXT: .quad 56 +; CHECK-NEXT: .quad 8 ; CHECK-NEXT: .quad 1 ; CHECK-NEXT: .quad _patchpoint_spilldef ; CHECK-NEXT: .quad 56 @@ -272,31 +272,31 @@ entry: ; CHECK-NEXT: .byte 8 ; CHECK-NEXT: .short {{[0-9]+}} ; CHECK-NEXT: .long 0 -; Loc 9: Register -; CHECK-NEXT: .byte 1 -; CHECK-NEXT: .byte 8 -; CHECK-NEXT: .short {{[0-9]+}} -; CHECK-NEXT: .long 0 -; Loc 10: Register -; CHECK-NEXT: .byte 1 -; CHECK-NEXT: .byte 8 -; CHECK-NEXT: .short {{[0-9]+}} -; CHECK-NEXT: .long 0 -; Loc 11: Register -; CHECK-NEXT: .byte 1 -; CHECK-NEXT: .byte 8 -; CHECK-NEXT: .short {{[0-9]+}} -; CHECK-NEXT: .long 0 -; Loc 12: Register -; CHECK-NEXT: .byte 1 -; CHECK-NEXT: .byte 8 -; CHECK-NEXT: .short {{[0-9]+}} -; CHECK-NEXT: .long 0 -; Loc 13: Register -; CHECK-NEXT: .byte 1 -; CHECK-NEXT: .byte 8 -; CHECK-NEXT: .short {{[0-9]+}} -; CHECK-NEXT: .long 0 +; Loc 9: Argument, still on stack +; CHECK-NEXT: .byte 3 +; CHECK-NEXT: .byte 8 +; CHECK-NEXT: .short 6 +; CHECK-NEXT: .long +; Loc 10: Argument, still on stack +; CHECK-NEXT: .byte 3 +; CHECK-NEXT: .byte 8 +; CHECK-NEXT: .short 6 +; CHECK-NEXT: .long +; Loc 11: Argument, still on stack +; CHECK-NEXT: .byte 3 +; CHECK-NEXT: .byte 8 +; CHECK-NEXT: .short 6 +; CHECK-NEXT: .long +; Loc 12: Argument, still on stack +; CHECK-NEXT: .byte 3 +; CHECK-NEXT: .byte 8 +; CHECK-NEXT: .short 6 +; CHECK-NEXT: .long +; Loc 13: Argument, still on stack +; CHECK-NEXT: .byte 3 +; CHECK-NEXT: .byte 8 +; CHECK-NEXT: .short 6 +; CHECK-NEXT: .long define i64 @anyreg_test2(i8* %a1, i8* %a2, i8* %a3, i8* %a4, i8* %a5, i8* %a6, i8* %a7, i8* %a8, i8* %a9, i8* %a10, i8* %a11, i8* %a12, i8* %a13) nounwind ssp uwtable { entry: %f = inttoptr i64 12297829382473034410 to i8* diff --git a/llvm/test/CodeGen/X86/stackmap.ll b/llvm/test/CodeGen/X86/stackmap.ll index fe3846254be..9818d3547fc 100644 --- a/llvm/test/CodeGen/X86/stackmap.ll +++ b/llvm/test/CodeGen/X86/stackmap.ll @@ -38,10 +38,10 @@ ; CHECK-NEXT: .quad 8 ; CHECK-NEXT: .quad 1 ; CHECK-NEXT: .quad _spilledValue -; CHECK-NEXT: .quad 56 +; CHECK-NEXT: .quad 8 ; CHECK-NEXT: .quad 1 ; CHECK-NEXT: .quad _spilledStackMapValue -; CHECK-NEXT: .quad 56 +; CHECK-NEXT: .quad 8 ; CHECK-NEXT: .quad 1 ; CHECK-NEXT: .quad _spillSubReg ; CHECK-NEXT: .quad 56 diff --git a/llvm/test/CodeGen/X86/statepoint-live-in.ll b/llvm/test/CodeGen/X86/statepoint-live-in.ll index a1718f0f193..b236393e9f4 100644 --- a/llvm/test/CodeGen/X86/statepoint-live-in.ll +++ b/llvm/test/CodeGen/X86/statepoint-live-in.ll @@ -34,35 +34,24 @@ define void @test3(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, i32 % entry: ; TODO: We should have folded the reload into the statepoint. ; CHECK-LABEL: @test3 -; CHECK: movl 32(%rsp), %r10d -; CHECK-NEXT: movl 24(%rsp), %r11d -; CHECK-NEXT: movl 16(%rsp), %eax +; CHECK: pushq %rax +; CHECK-NEXT: Lcfi +; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: callq _bar %statepoint_token1 = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @bar, i32 0, i32 2, i32 0, i32 9, i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, i32 %h, i32 %i) ret void } ; This case just confirms that we don't crash when given more live values -; than registers. This is a case where we *have* to use a stack slot. +; than registers. This is a case where we *have* to use a stack slot. This +; also ends up being a good test of whether we can fold loads from immutable +; stack slots into the statepoint. define void @test4(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, i32 %h, i32 %i, i32 %j, i32 %k, i32 %l, i32 %m, i32 %n, i32 %o, i32 %p, i32 %q, i32 %r, i32 %s, i32 %t, i32 %u, i32 %v, i32 %w, i32 %x, i32 %y, i32 %z) gc "statepoint-example" { entry: -; TODO: We should have folded the reload into the statepoint. ; CHECK-LABEL: test4 -; CHECK: pushq %r15 -; CHECK: pushq %r14 -; CHECK: pushq %r13 -; CHECK: pushq %r12 -; CHECK: pushq %rbx -; CHECK: pushq %rax -; CHECK: movl 128(%rsp), %r13d -; CHECK-NEXT: movl 120(%rsp), %r12d -; CHECK-NEXT: movl 112(%rsp), %r15d -; CHECK-NEXT: movl 104(%rsp), %r14d -; CHECK-NEXT: movl 96(%rsp), %ebp -; CHECK-NEXT: movl 88(%rsp), %ebx -; CHECK-NEXT: movl 80(%rsp), %r11d -; CHECK-NEXT: movl 72(%rsp), %r10d -; CHECK-NEXT: movl 64(%rsp), %eax +; CHECK: pushq %rax +; CHECK-NEXT: Lcfi +; CHECK-NEXT: .cfi_def_cfa_offset 16 ; CHECK-NEXT: callq _bar %statepoint_token1 = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @bar, i32 0, i32 2, i32 0, i32 26, i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, i32 %h, i32 %i, i32 %j, i32 %k, i32 %l, i32 %m, i32 %n, i32 %o, i32 %p, i32 %q, i32 %r, i32 %s, i32 %t, i32 %u, i32 %v, i32 %w, i32 %x, i32 %y, i32 %z) ret void @@ -90,7 +79,7 @@ entry: ; CHECK: movl %edi, %ebx ; CHECK: movl %ebx, 12(%rsp) ; CHECK-NEXT: callq _baz -; CHECK-NEXT: Ltmp6: +; CHECK-NEXT: Ltmp ; CHECK-NEXT: callq _bar call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @baz, i32 0, i32 0, i32 0, i32 1, i32 %a) call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 2882400000, i32 0, void ()* @bar, i32 0, i32 2, i32 0, i32 1, i32 %a) |

