summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorPaul Robinson <paul_robinson@playstation.sony.com>2016-03-24 00:10:03 +0000
committerPaul Robinson <paul_robinson@playstation.sony.com>2016-03-24 00:10:03 +0000
commitf81836bd18be6fb8bc6fe9942053f418dbb13d98 (patch)
treed27cc0e2ec19f80a0aa8f3f4df8235215053bf34 /llvm/lib/Target
parent1ee9fbd842273ab3fb6748c34d9f159a10ccb0d0 (diff)
downloadbcm5719-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.cpp4
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
OpenPOWER on IntegriCloud