mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-05 02:07:56 +00:00
[AArch64] [Windows] Trap after noreturn calls.
Like the comment says, this isn't the most efficient fix in terms of codesize, but it works. Differential Revision: https://reviews.llvm.org/D54129 llvm-svn: 346358
This commit is contained in:
parent
d3b7f25801
commit
2b52060063
@ -263,6 +263,16 @@ AArch64TargetMachine::AArch64TargetMachine(const Target &T, const Triple &TT,
|
||||
this->Options.NoTrapAfterNoreturn = true;
|
||||
}
|
||||
|
||||
if (TT.isOSWindows()) {
|
||||
// Unwinding can get confused if the last instruction in an
|
||||
// exception-handling region (function, funclet, try block, etc.)
|
||||
// is a call.
|
||||
//
|
||||
// FIXME: We could elide the trap if the next instruction would be in
|
||||
// the same region anyway.
|
||||
this->Options.TrapUnreachable = true;
|
||||
}
|
||||
|
||||
// Enable GlobalISel at or below EnableGlobalISelAt0.
|
||||
if (getOptLevel() <= EnableGlobalISelAtO)
|
||||
setGlobalISel(true);
|
||||
|
17
test/CodeGen/AArch64/windows-trap.ll
Normal file
17
test/CodeGen/AArch64/windows-trap.ll
Normal file
@ -0,0 +1,17 @@
|
||||
; RUN: llc -mtriple=aarch64-win32 %s -o - | FileCheck %s
|
||||
|
||||
declare void @callee() noreturn
|
||||
|
||||
; Make sure the call isn't the last instruction in the function; if it is,
|
||||
; unwinding may break.
|
||||
;
|
||||
; (The instruction after the call doesn't have to be anything in particular,
|
||||
; but trapping has the nice side-effect of catching bugs.)
|
||||
|
||||
define void @test_unreachable() {
|
||||
; CHECK-LABEL: test_unreachable:
|
||||
; CHECK: bl callee
|
||||
; CHECK-NEXT: brk #0x1
|
||||
call void @callee() noreturn
|
||||
unreachable
|
||||
}
|
Loading…
Reference in New Issue
Block a user