2008-02-18 06:11:00 +00:00
|
|
|
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {call.*stackrestore}
|
2006-01-13 22:01:47 +00:00
|
|
|
|
|
|
|
;; Test that llvm.stackrestore is removed when possible.
|
2008-02-18 06:11:00 +00:00
|
|
|
define i32* @test1(i32 %P) {
|
|
|
|
%tmp = call i8* @llvm.stacksave( )
|
|
|
|
call void @llvm.stackrestore( i8* %tmp ) ;; not restoring anything
|
|
|
|
%A = alloca i32, i32 %P
|
|
|
|
ret i32* %A
|
2006-01-13 22:01:47 +00:00
|
|
|
}
|
|
|
|
|
2008-02-18 06:11:00 +00:00
|
|
|
define void @test2(i8* %X) {
|
|
|
|
call void @llvm.stackrestore( i8* %X ) ;; no allocas before return.
|
2006-01-13 22:01:47 +00:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2008-02-18 06:11:00 +00:00
|
|
|
declare i8* @llvm.stacksave()
|
|
|
|
|
|
|
|
declare void @llvm.stackrestore(i8*)
|
2006-01-13 22:01:47 +00:00
|
|
|
|