2017-06-03 00:36:37 +08:00
|
|
|
; RUN: llc -verify-machineinstrs < %s 2>&1 | FileCheck %s
|
2015-03-11 00:26:48 +08:00
|
|
|
|
|
|
|
target triple = "x86_64-pc-linux-gnu"
|
|
|
|
|
2015-05-20 19:37:25 +08:00
|
|
|
declare void @"some_call"(i64 addrspace(1)*)
|
2015-03-11 00:26:48 +08:00
|
|
|
declare i64 addrspace(1)* @"some_other_call"(i64 addrspace(1)*)
|
|
|
|
|
|
|
|
declare i32 @"personality_function"()
|
|
|
|
|
2015-05-20 19:37:25 +08:00
|
|
|
define i64 addrspace(1)* @test_basic(i64 addrspace(1)* %obj,
|
|
|
|
i64 addrspace(1)* %obj1)
|
2015-06-18 04:52:32 +08:00
|
|
|
gc "statepoint-example" personality i32 ()* @"personality_function" {
|
2015-05-20 19:37:25 +08:00
|
|
|
entry:
|
|
|
|
; CHECK: Ltmp{{[0-9]+}}:
|
|
|
|
; CHECK: callq some_call
|
|
|
|
; CHECK: Ltmp{{[0-9]+}}:
|
2015-12-26 15:54:32 +08:00
|
|
|
%0 = invoke token (i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 0, i32 0, void (i64 addrspace(1)*)* @some_call, i32 1, i32 0, i64 addrspace(1)* %obj, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0, i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1)
|
2015-05-20 19:37:25 +08:00
|
|
|
to label %invoke_safepoint_normal_dest unwind label %exceptional_return
|
|
|
|
|
|
|
|
invoke_safepoint_normal_dest:
|
|
|
|
; CHECK: movq
|
2015-12-26 15:54:32 +08:00
|
|
|
%obj.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %0, i32 13, i32 13)
|
|
|
|
%obj1.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %0, i32 14, i32 14)
|
2015-05-20 19:37:25 +08:00
|
|
|
br label %normal_return
|
|
|
|
|
|
|
|
normal_return:
|
|
|
|
; CHECK: retq
|
|
|
|
ret i64 addrspace(1)* %obj.relocated
|
|
|
|
|
|
|
|
exceptional_return:
|
|
|
|
; CHECK: Ltmp{{[0-9]+}}:
|
|
|
|
; CHECK: movq
|
|
|
|
; CHECK: retq
|
2015-12-26 15:54:32 +08:00
|
|
|
%landing_pad = landingpad token
|
2015-05-20 19:37:25 +08:00
|
|
|
cleanup
|
2015-12-26 15:54:32 +08:00
|
|
|
%obj.relocated1 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 13, i32 13)
|
|
|
|
%obj1.relocated1 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 14, i32 14)
|
2015-05-20 19:37:25 +08:00
|
|
|
ret i64 addrspace(1)* %obj1.relocated1
|
|
|
|
}
|
|
|
|
; CHECK-LABEL: GCC_except_table{{[0-9]+}}:
|
2018-02-10 01:13:37 +08:00
|
|
|
; CHECK: .uleb128 .Ltmp{{[0-9]+}}-.Ltmp{{[0-9]+}}
|
|
|
|
; CHECK: .uleb128 .Ltmp{{[0-9]+}}-.Lfunc_begin{{[0-9]+}}
|
2015-05-20 19:37:25 +08:00
|
|
|
; CHECK: .byte 0
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 4
|
2015-05-20 19:37:25 +08:00
|
|
|
|
|
|
|
define i64 addrspace(1)* @test_result(i64 addrspace(1)* %obj,
|
2015-03-27 13:09:33 +08:00
|
|
|
i64 addrspace(1)* %obj1)
|
2015-06-18 04:52:32 +08:00
|
|
|
gc "statepoint-example" personality i32 ()* @personality_function {
|
2015-03-11 00:26:48 +08:00
|
|
|
entry:
|
|
|
|
; CHECK: .Ltmp{{[0-9]+}}:
|
|
|
|
; CHECK: callq some_other_call
|
|
|
|
; CHECK: .Ltmp{{[0-9]+}}:
|
2015-12-26 15:54:32 +08:00
|
|
|
%0 = invoke token (i64, i32, i64 addrspace(1)* (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_p1i64p1i64f(i64 0, i32 0, i64 addrspace(1)* (i64 addrspace(1)*)* @some_other_call, i32 1, i32 0, i64 addrspace(1)* %obj, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0, i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1)
|
2015-03-11 00:26:48 +08:00
|
|
|
to label %normal_return unwind label %exceptional_return
|
|
|
|
|
|
|
|
normal_return:
|
|
|
|
; CHECK: popq
|
|
|
|
; CHECK: retq
|
2015-12-26 15:54:32 +08:00
|
|
|
%ret_val = call i64 addrspace(1)* @llvm.experimental.gc.result.p1i64(token %0)
|
2015-03-11 00:26:48 +08:00
|
|
|
ret i64 addrspace(1)* %ret_val
|
|
|
|
|
|
|
|
exceptional_return:
|
|
|
|
; CHECK: .Ltmp{{[0-9]+}}:
|
2015-05-20 19:37:25 +08:00
|
|
|
; CHECK: movq
|
2015-12-26 15:54:32 +08:00
|
|
|
%landing_pad = landingpad token
|
2015-03-11 00:26:48 +08:00
|
|
|
cleanup
|
2015-12-26 15:54:32 +08:00
|
|
|
%obj.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 13, i32 13)
|
2015-05-20 19:37:25 +08:00
|
|
|
ret i64 addrspace(1)* %obj.relocated
|
2015-03-11 00:26:48 +08:00
|
|
|
}
|
|
|
|
; CHECK-LABEL: GCC_except_table{{[0-9]+}}:
|
2018-02-10 01:13:37 +08:00
|
|
|
; CHECK: .uleb128 .Ltmp{{[0-9]+}}-.Ltmp{{[0-9]+}}
|
|
|
|
; CHECK: .uleb128 .Ltmp{{[0-9]+}}-.Lfunc_begin{{[0-9]+}}
|
2015-03-11 00:26:48 +08:00
|
|
|
; CHECK: .byte 0
|
2016-01-26 08:03:25 +08:00
|
|
|
; CHECK: .p2align 4
|
2015-03-11 00:26:48 +08:00
|
|
|
|
2015-05-20 19:37:25 +08:00
|
|
|
define i64 addrspace(1)* @test_same_val(i1 %cond, i64 addrspace(1)* %val1, i64 addrspace(1)* %val2, i64 addrspace(1)* %val3)
|
2015-06-18 04:52:32 +08:00
|
|
|
gc "statepoint-example" personality i32 ()* @"personality_function" {
|
2015-05-20 19:37:25 +08:00
|
|
|
entry:
|
|
|
|
br i1 %cond, label %left, label %right
|
|
|
|
|
|
|
|
left:
|
|
|
|
; CHECK-LABEL: %left
|
|
|
|
; CHECK: movq %rdx, 8(%rsp)
|
|
|
|
; CHECK: movq
|
|
|
|
; CHECK: callq some_call
|
2015-12-26 15:54:32 +08:00
|
|
|
%sp1 = invoke token (i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 0, i32 0, void (i64 addrspace(1)*)* @some_call, i32 1, i32 0, i64 addrspace(1)* %val1, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0, i64 addrspace(1)* %val1, i64 addrspace(1)* %val2)
|
2015-05-20 19:37:25 +08:00
|
|
|
to label %left.relocs unwind label %exceptional_return.left
|
|
|
|
|
|
|
|
left.relocs:
|
|
|
|
; CHECK: movq (%rsp),
|
|
|
|
; CHECK: movq 8(%rsp), [[REGVAL2:%[a-z]+]]
|
2015-12-26 15:54:32 +08:00
|
|
|
%val1.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %sp1, i32 13, i32 13)
|
|
|
|
%val2.relocated_left = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %sp1, i32 14, i32 14)
|
2015-05-20 19:37:25 +08:00
|
|
|
br label %normal_return
|
|
|
|
|
|
|
|
right:
|
|
|
|
; CHECK-LABEL: %right
|
2017-07-18 15:53:47 +08:00
|
|
|
; CHECK: movq %rdx, (%rsp)
|
[DAG] Improve Aliasing of operations to static alloca
Re-recommiting after landing DAG extension-crash fix.
Recommiting after adding check to avoid miscomputing alias information
on addresses of the same base but different subindices.
Memory accesses offset from frame indices may alias, e.g., we
may merge write from function arguments passed on the stack when they
are contiguous. As a result, when checking aliasing, we consider the
underlying frame index's offset from the stack pointer.
Static allocs are realized as stack objects in SelectionDAG, but its
offset is not set until post-DAG causing DAGCombiner's alias check to
consider access to static allocas to frequently alias. Modify isAlias
to consider access between static allocas and access from other frame
objects to be considered aliasing.
Many test changes are included here. Most are fixes for tests which
indirectly relied on our aliasing ability and needed to be modified to
preserve their original intent.
The remaining tests have minor improvements due to relaxed
ordering. The exception is CodeGen/X86/2011-10-19-widen_vselect.ll
which has a minor degradation dispite though the pre-legalized DAG is
improved.
Reviewers: rnk, mkuper, jonpa, hfinkel, uweigand
Reviewed By: rnk
Subscribers: sdardis, nemanjai, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D33345
llvm-svn: 308350
2017-07-19 04:06:24 +08:00
|
|
|
; CHECK: movq
|
2015-05-20 19:37:25 +08:00
|
|
|
; CHECK: callq some_call
|
2015-12-26 15:54:32 +08:00
|
|
|
%sp2 = invoke token (i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 0, i32 0, void (i64 addrspace(1)*)* @some_call, i32 1, i32 0, i64 addrspace(1)* %val1, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0, i64 addrspace(1)* %val2, i64 addrspace(1)* %val3)
|
2015-05-20 19:37:25 +08:00
|
|
|
to label %right.relocs unwind label %exceptional_return.right
|
|
|
|
|
|
|
|
right.relocs:
|
|
|
|
; CHECK: movq (%rsp), [[REGVAL2]]
|
|
|
|
; CHECK: movq
|
2015-12-26 15:54:32 +08:00
|
|
|
%val2.relocated_right = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %sp2, i32 13, i32 13)
|
|
|
|
%val3.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %sp2, i32 14, i32 14)
|
2015-05-20 19:37:25 +08:00
|
|
|
br label %normal_return
|
|
|
|
|
|
|
|
normal_return:
|
|
|
|
; CHECK-LABEL: %normal_return
|
|
|
|
; CHECK: cmoveq {{.*}}[[REGVAL2]]{{.*}}
|
2015-08-11 03:01:27 +08:00
|
|
|
; CHECK: retq
|
2015-05-20 19:37:25 +08:00
|
|
|
%a1 = phi i64 addrspace(1)* [%val1.relocated, %left.relocs], [%val3.relocated, %right.relocs]
|
|
|
|
%a2 = phi i64 addrspace(1)* [%val2.relocated_left, %left.relocs], [%val2.relocated_right, %right.relocs]
|
|
|
|
%ret = select i1 %cond, i64 addrspace(1)* %a1, i64 addrspace(1)* %a2
|
|
|
|
ret i64 addrspace(1)* %ret
|
|
|
|
|
|
|
|
exceptional_return.left:
|
2015-12-26 15:54:32 +08:00
|
|
|
%landing_pad = landingpad token
|
2015-05-20 19:37:25 +08:00
|
|
|
cleanup
|
2015-12-26 15:54:32 +08:00
|
|
|
%val.relocated2 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 13, i32 13)
|
2015-05-20 19:37:25 +08:00
|
|
|
ret i64 addrspace(1)* %val.relocated2
|
|
|
|
|
|
|
|
exceptional_return.right:
|
2015-12-26 15:54:32 +08:00
|
|
|
%landing_pad1 = landingpad token
|
2015-05-20 19:37:25 +08:00
|
|
|
cleanup
|
2015-12-26 15:54:32 +08:00
|
|
|
%val.relocated3 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad1, i32 13, i32 13)
|
2015-05-20 19:37:25 +08:00
|
|
|
ret i64 addrspace(1)* %val.relocated3
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 addrspace(1)* @test_null_undef(i64 addrspace(1)* %val1)
|
2015-06-18 04:52:32 +08:00
|
|
|
gc "statepoint-example" personality i32 ()* @"personality_function" {
|
2015-05-20 19:37:25 +08:00
|
|
|
; CHECK-LABEL: test_null_undef:
|
|
|
|
entry:
|
|
|
|
; CHECK: callq some_call
|
2015-12-26 15:54:32 +08:00
|
|
|
%sp1 = invoke token (i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 0, i32 0, void (i64 addrspace(1)*)* @some_call, i32 1, i32 0, i64 addrspace(1)* %val1, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0, i64 addrspace(1)* null, i64 addrspace(1)* undef)
|
2015-05-20 19:37:25 +08:00
|
|
|
to label %normal_return unwind label %exceptional_return
|
|
|
|
|
|
|
|
normal_return:
|
|
|
|
; CHECK-LABEL: %normal_return
|
|
|
|
; CHECK: xorl %eax, %eax
|
|
|
|
; CHECK-NEXT: popq
|
|
|
|
; CHECK-NEXT: retq
|
2015-12-26 15:54:32 +08:00
|
|
|
%null.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %sp1, i32 13, i32 13)
|
|
|
|
%undef.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %sp1, i32 14, i32 14)
|
2015-05-20 19:37:25 +08:00
|
|
|
ret i64 addrspace(1)* %null.relocated
|
|
|
|
|
|
|
|
exceptional_return:
|
2015-12-26 15:54:32 +08:00
|
|
|
%landing_pad = landingpad token
|
2015-05-20 19:37:25 +08:00
|
|
|
cleanup
|
2015-12-26 15:54:32 +08:00
|
|
|
%null.relocated2 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 13, i32 13)
|
|
|
|
%undef.relocated2 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 14, i32 14)
|
2015-05-20 19:37:25 +08:00
|
|
|
ret i64 addrspace(1)* %null.relocated2
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 addrspace(1)* @test_alloca_and_const(i64 addrspace(1)* %val1)
|
2015-06-18 04:52:32 +08:00
|
|
|
gc "statepoint-example" personality i32 ()* @"personality_function" {
|
2015-05-20 19:37:25 +08:00
|
|
|
; CHECK-LABEL: test_alloca_and_const:
|
|
|
|
entry:
|
|
|
|
%a = alloca i32
|
|
|
|
%aa = addrspacecast i32* %a to i32 addrspace(1)*
|
|
|
|
%c = inttoptr i64 15 to i64 addrspace(1)*
|
|
|
|
; CHECK: callq
|
2015-12-26 15:54:32 +08:00
|
|
|
%sp = invoke token (i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 0, i32 0, void (i64 addrspace(1)*)* @some_call, i32 1, i32 0, i64 addrspace(1)* %val1, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0, i32 addrspace(1)* %aa, i64 addrspace(1)* %c)
|
2015-05-20 19:37:25 +08:00
|
|
|
to label %normal_return unwind label %exceptional_return
|
|
|
|
|
|
|
|
normal_return:
|
|
|
|
; CHECK: leaq
|
|
|
|
; CHECK-NEXT: popq
|
|
|
|
; CHECK-NEXT: retq
|
2015-12-26 15:54:32 +08:00
|
|
|
%aa.rel = call coldcc i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %sp, i32 13, i32 13)
|
2015-05-20 19:37:25 +08:00
|
|
|
%aa.converted = bitcast i32 addrspace(1)* %aa.rel to i64 addrspace(1)*
|
|
|
|
ret i64 addrspace(1)* %aa.converted
|
|
|
|
|
|
|
|
exceptional_return:
|
|
|
|
; CHECK: movl $15
|
|
|
|
; CHECK-NEXT: popq
|
|
|
|
; CHECK-NEXT: retq
|
2015-12-26 15:54:32 +08:00
|
|
|
%landing_pad = landingpad token
|
2015-05-20 19:37:25 +08:00
|
|
|
cleanup
|
2015-12-26 15:54:32 +08:00
|
|
|
%aa.rel2 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 14, i32 14)
|
2015-05-20 19:37:25 +08:00
|
|
|
ret i64 addrspace(1)* %aa.rel2
|
|
|
|
}
|
|
|
|
|
2015-12-26 15:54:32 +08:00
|
|
|
declare token @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...)
|
|
|
|
declare token @llvm.experimental.gc.statepoint.p0f_p1i64p1i64f(i64, i32, i64 addrspace(1)* (i64 addrspace(1)*)*, i32, i32, ...)
|
2015-05-20 19:37:25 +08:00
|
|
|
|
2015-12-26 15:54:32 +08:00
|
|
|
declare i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token, i32, i32)
|
|
|
|
declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token, i32, i32)
|
|
|
|
declare i64 addrspace(1)* @llvm.experimental.gc.result.p1i64(token)
|