Add NoTrapAfterNoreturn target option which skips emission of traps
behind noreturn calls even if TrapUnreachable is enabled.
rdar://41530228
Paths
| Differential D48674
SelectionDAGBuilder, mach-o: Skip trap after noreturn call (for Mach-O) ClosedPublic Authored by MatzeB on Jun 27 2018, 2:26 PM.
Details
Summary Add NoTrapAfterNoreturn target option which skips emission of traps rdar://41530228
Diff Detail
Event TimelineThis revision is now accepted and ready to land.Jun 28 2018, 1:39 AM Comment Actions
It reduces code size (0.5-1.2%) in the projects I measured. Comment Actions This feature was/is only enabled in -O0, though, right? As a debugging aid, Comment Actions These two MachO specific configurations seem like needlessly MachO specific policy decisions. I think it would make more sense for the project overall if we emitted traps for unreachables not preceded by noreturn calls for all targets. As you've noticed, the vast majority of unreachables are from calls to noreturn functions. The remainder account for the confusing and hard to debug fall through cases. I believe noreturn functions rarely return erroneously, and are usually not problematic for the user. Comment Actions By the way, once upon a time I *almost* removed TrapOnUnreachable in rL248959, but I had to revert it for reasons I am trying to rediscover.
Revision Contents
Diff 153177 include/llvm/Target/TargetOptions.h
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/Target/AArch64/AArch64TargetMachine.cpp
lib/Target/ARM/ARMTargetMachine.cpp
lib/Target/X86/X86TargetMachine.cpp
test/CodeGen/X86/unreachable-trap.ll
|