llvm.org GIT mirror llvm / ed3959a
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@346358 91177308-0d34-0410-b5e6-96231b3b80d8 Eli Friedman 10 months ago
2 changed file(s) with 27 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
262262 this->Options.NoTrapAfterNoreturn = true;
263263 }
264264
265 if (TT.isOSWindows()) {
266 // Unwinding can get confused if the last instruction in an
267 // exception-handling region (function, funclet, try block, etc.)
268 // is a call.
269 //
270 // FIXME: We could elide the trap if the next instruction would be in
271 // the same region anyway.
272 this->Options.TrapUnreachable = true;
273 }
274
265275 // Enable GlobalISel at or below EnableGlobalISelAt0.
266276 if (getOptLevel() <= EnableGlobalISelAtO)
267277 setGlobalISel(true);
0 ; RUN: llc -mtriple=aarch64-win32 %s -o - | FileCheck %s
1
2 declare void @callee() noreturn
3
4 ; Make sure the call isn't the last instruction in the function; if it is,
5 ; unwinding may break.
6 ;
7 ; (The instruction after the call doesn't have to be anything in particular,
8 ; but trapping has the nice side-effect of catching bugs.)
9
10 define void @test_unreachable() {
11 ; CHECK-LABEL: test_unreachable:
12 ; CHECK: bl callee
13 ; CHECK-NEXT: brk #0x1
14 call void @callee() noreturn
15 unreachable
16 }