teak-llvm/llvm/test/CodeGen/X86/pop-stack-cleanup-msvc.ll
Bjorn Steinbrink c02b237e46 [X86] Don't clobber reserved registers with stack adjustments
Summary:
Calls using invoke in funclet based functions are assumed to clobber
all registers, which causes the stack adjustment using pops to consider
all registers not defined by the call to be undefined, which can
unfortunately include the base pointer, if one is needed.

To prevent this (and possibly other hazards), skip reserved registers
when looking for candidate registers.

This fixes issue #45034 in the Rust compiler.

Reviewers: mkuper

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D39636

llvm-svn: 317551
2017-11-07 08:50:21 +00:00

27 lines
609 B
LLVM

; RUN: llc < %s | FileCheck %s
target triple = "i686--windows-msvc"
declare { i8*, i32 } @param2_ret2(i32, i32)
declare i32 @__CxxFrameHandler3(...)
define void @test_reserved_regs() minsize optsize personality i32 (...)* @__CxxFrameHandler3 {
; CHECK-LABEL: test_reserved_regs:
; CHECK: calll _param2_ret2
; CHECK-NEXT: popl %ecx
; CHECK-NEXT: popl %edi
start:
%s = alloca i64
store i64 4, i64* %s
%0 = invoke { i8*, i32 } @param2_ret2(i32 0, i32 1)
to label %out unwind label %cleanup
out:
ret void
cleanup:
%cp = cleanuppad within none []
cleanupret from %cp unwind to caller
}