mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
6e852d9c3d
Summary: Calls marked 'tail' cannot read or write allocas from the current frame because the current frame might be destroyed by the time they run. However, a tail call may use an alloca with byval. Calling with byval copies the contents of the alloca into argument registers or stack slots, so there is no lifetime issue. Tail calls never modify allocas, so we can return just ModRefInfo::Ref. Fixes PR38466, a longstanding bug. Reviewers: hfinkel, nlewycky, gbiv, george.burgess.iv Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D50679 llvm-svn: 339636
16 lines
490 B
LLVM
16 lines
490 B
LLVM
; RUN: opt -basicaa -aa-eval -print-all-alias-modref-info -disable-output < %s 2>&1 | FileCheck %s
|
|
|
|
declare void @takebyval(i32* byval %p)
|
|
|
|
define i32 @tailbyval() {
|
|
entry:
|
|
%p = alloca i32
|
|
store i32 42, i32* %p
|
|
tail call void @takebyval(i32* byval %p)
|
|
%rv = load i32, i32* %p
|
|
ret i32 %rv
|
|
}
|
|
; FIXME: This should be Just Ref.
|
|
; CHECK-LABEL: Function: tailbyval: 1 pointers, 1 call sites
|
|
; CHECK-NEXT: Both ModRef: Ptr: i32* %p <-> tail call void @takebyval(i32* byval %p)
|