
This is to teach tailcallelim transformation not to mark llvm.stackrestore with tail-call, as the intrinsic call can modify unescaped allocas from the caller. This fixes a problem found with our downstream testing. The problem can also be shown when running the test case llvm/test/Transforms/MemCpyOpt/stackrestore with passes=”tailcallelim, memcpyopt”.
15 lines
338 B
LLVM
15 lines
338 B
LLVM
; RUN: opt -S -passes=tailcallelim < %s | FileCheck %s
|
|
|
|
define void @foo() {
|
|
; CHECK-LABEL: define void @foo()
|
|
; CHECK-NOT: tail call void @llvm.stackrestore.p0
|
|
;
|
|
entry:
|
|
%0 = call ptr @llvm.stacksave.p0()
|
|
call void @llvm.stackrestore.p0(ptr %0)
|
|
ret void
|
|
}
|
|
|
|
declare ptr @llvm.stacksave.p0()
|
|
declare void @llvm.stackrestore.p0(ptr)
|