This repository has been archived by the owner on Mar 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SelectionDAGBuilder, mach-o: Skip trap after noreturn call (for Mach-O)
Add NoTrapAfterNoreturn target option which skips emission of traps behind noreturn calls even if TrapUnreachable is enabled. Enable the feature on Mach-O to save code size; Comments suggest it is not possible to enable it for the other users of TrapUnreachable. rdar://41530228 DifferentialRevision: https://reviews.llvm.org/D48674 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335877 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
6 changed files
with
62 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
; RUN: llc -o - %s -mtriple=x86_64-windows-msvc | FileCheck %s --check-prefixes=CHECK,TRAP_AFTER_NORETURN | ||
; RUN: llc -o - %s -mtriple=x86_64-apple-darwin | FileCheck %s --check-prefixes=CHECK,NO_TRAP_AFTER_NORETURN | ||
|
||
; CHECK-LABEL: call_exit: | ||
; CHECK: callq {{_?}}exit | ||
; TRAP_AFTER_NORETURN: ud2 | ||
; NO_TRAP_AFTER_NORETURN-NOT: ud2 | ||
define i32 @call_exit() noreturn nounwind { | ||
tail call void @exit(i32 0) | ||
unreachable | ||
} | ||
|
||
; CHECK-LABEL: trap: | ||
; CHECK: ud2 | ||
; TRAP_AFTER_NORETURN: ud2 | ||
; NO_TRAP_AFTER_NORETURN-NOT: ud2 | ||
define i32 @trap() noreturn nounwind { | ||
tail call void @llvm.trap() | ||
unreachable | ||
} | ||
|
||
; CHECK-LABEL: unreachable: | ||
; CHECK: ud2 | ||
define i32 @unreachable() noreturn nounwind { | ||
unreachable | ||
} | ||
|
||
declare void @llvm.trap() nounwind noreturn | ||
declare void @exit(i32 %rc) nounwind noreturn |