llvm.org GIT mirror llvm / ca13910
Fix pr33010, a 2 year old crashing regression The problem was that we were creating a CMOV64rr <TargetFrameIndex>, <TargetFrameIndex>. The entire point of a TFI is that address code is not generated, so there's no way to legalize/lower this. Instead, simply prevent it's creation. Arguably, we shouldn't be using *Target*FrameIndices in StatepointLowering at all, but that's a much deeper change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360090 91177308-0d34-0410-b5e6-96231b3b80d8 Philip Reames 1 year, 4 months ago
2 changed file(s) with 49 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
1900719007 // locations are not in the default address space.
1900819008 LLD->getPointerInfo().getAddrSpace() != 0 ||
1900919009 RLD->getPointerInfo().getAddrSpace() != 0 ||
19010 // We can't produce a CMOV of a TargetFrameIndex since we won't
19011 // generate the address generation required.
19012 LLD->getBasePtr().getOpcode() == ISD::TargetFrameIndex ||
19013 RLD->getBasePtr().getOpcode() == ISD::TargetFrameIndex ||
1901019014 !TLI.isOperationLegalOrCustom(TheSelect->getOpcode(),
1901119015 LLD->getBasePtr().getValueType()))
1901219016 return false;
0 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
1 ; RUN: llc -mtriple=x86_64-linux-generic < %s | FileCheck %s
2
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4
5 ; We can't create a select of two TargetFrameIndices since the rest
6 ; of the backend doesn't know how to handle such a construct.
7 define i32 addrspace(1)* @test(i32 addrspace(1)* %a, i32 addrspace(1)* %b, i1 %which) gc "statepoint-example" {
8 ; CHECK-LABEL: test:
9 ; CHECK: # %bb.0: # %entry
10 ; CHECK-NEXT: pushq %rbx
11 ; CHECK-NEXT: .cfi_def_cfa_offset 16
12 ; CHECK-NEXT: subq $16, %rsp
13 ; CHECK-NEXT: .cfi_def_cfa_offset 32
14 ; CHECK-NEXT: .cfi_offset %rbx, -16
15 ; CHECK-NEXT: movl %edx, %ebx
16 ; CHECK-NEXT: movq %rdi, (%rsp)
17 ; CHECK-NEXT: movq %rsi, {{[0-9]+}}(%rsp)
18 ; CHECK-NEXT: callq f
19 ; CHECK-NEXT: .Ltmp0:
20 ; CHECK-NEXT: testb $1, %bl
21 ; CHECK-NEXT: je .LBB0_1
22 ; CHECK-NEXT: # %bb.2: # %entry
23 ; CHECK-NEXT: movq (%rsp), %rax
24 ; CHECK-NEXT: jmp .LBB0_3
25 ; CHECK-NEXT: .LBB0_1:
26 ; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rax
27 ; CHECK-NEXT: .LBB0_3: # %entry
28 ; CHECK-NEXT: addq $16, %rsp
29 ; CHECK-NEXT: .cfi_def_cfa_offset 16
30 ; CHECK-NEXT: popq %rbx
31 ; CHECK-NEXT: .cfi_def_cfa_offset 8
32 ; CHECK-NEXT: retq
33 entry:
34 %tok = tail call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @f, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* %a, i32 addrspace(1)* %b)
35 %a.r = tail call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %tok, i32 7, i32 7) ; (%a, %a)
36 %b.r = tail call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %tok, i32 8, i32 8) ; (%b, %b)
37 %cond.v = select i1 %which, i8 addrspace(1)* %a.r, i8 addrspace(1)* %b.r
38 %cond = bitcast i8 addrspace(1)* %cond.v to i32 addrspace(1)*
39 ret i32 addrspace(1)* %cond
40 }
41
42 declare void @f()
43 declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)
44 declare i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token, i32, i32)