diff options
author | Paul Robinson <paul_robinson@playstation.sony.com> | 2016-03-24 00:10:03 +0000 |
---|---|---|
committer | Paul Robinson <paul_robinson@playstation.sony.com> | 2016-03-24 00:10:03 +0000 |
commit | f81836bd18be6fb8bc6fe9942053f418dbb13d98 (patch) | |
tree | d27cc0e2ec19f80a0aa8f3f4df8235215053bf34 /llvm/lib/Target | |
parent | 1ee9fbd842273ab3fb6748c34d9f159a10ccb0d0 (diff) | |
download | bcm5719-llvm-f81836bd18be6fb8bc6fe9942053f418dbb13d98.tar.gz bcm5719-llvm-f81836bd18be6fb8bc6fe9942053f418dbb13d98.zip |
[PS4] Guarantee an instruction after a 'noreturn' call.
We need the "return address" of a noreturn call to be within the
bounds of the calling function; TrapUnreachable turns 'unreachable'
into a 'ud2' instruction, which has that desired effect.
Differential Revision: http://reviews.llvm.org/D18414
llvm-svn: 264224
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/X86/X86TargetMachine.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp index 806ba129cbe..382de993459 100644 --- a/llvm/lib/Target/X86/X86TargetMachine.cpp +++ b/llvm/lib/Target/X86/X86TargetMachine.cpp @@ -119,7 +119,9 @@ X86TargetMachine::X86TargetMachine(const Target &T, const Triple &TT, // after a call to 'noreturn' function. // To prevent that, we emit a trap for 'unreachable' IR instructions. // (which on X86, happens to be the 'ud2' instruction) - if (Subtarget.isTargetWin64()) + // On PS4, the "return address" of a 'noreturn' call must still be within + // the calling function, and TrapUnreachable is an easy way to get that. + if (Subtarget.isTargetWin64() || Subtarget.isTargetPS4()) this->Options.TrapUnreachable = true; // By default (and when -ffast-math is on), enable estimate codegen for |