mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 15:13:49 -04:00
3ea7b0a0b1
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339636 91177308-0d34-0410-b5e6-96231b3b80d8
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)
|