summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
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/test/CodeGen
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/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/X86/br-fold.ll4
-rw-r--r--llvm/test/CodeGen/X86/ps4-noreturn.ll38
2 files changed, 42 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/br-fold.ll b/llvm/test/CodeGen/X86/br-fold.ll
index fd1e73bde8c..5e5f860ffc7 100644
--- a/llvm/test/CodeGen/X86/br-fold.ll
+++ b/llvm/test/CodeGen/X86/br-fold.ll
@@ -2,6 +2,7 @@
; RUN: llc -mtriple=x86_64-pc-linux < %s | FileCheck -check-prefix=X64_LINUX %s
; RUN: llc -mtriple=x86_64-pc-windows < %s | FileCheck -check-prefix=X64_WINDOWS %s
; RUN: llc -mtriple=x86_64-pc-windows-gnu < %s | FileCheck -check-prefix=X64_WINDOWS_GNU %s
+; RUN: llc -mtriple=x86_64-scei-ps4 < %s | FileCheck -check-prefix=PS4 %s
; X64_DARWIN: orq
; X64_DARWIN-NEXT: %bb8.i329
@@ -15,6 +16,9 @@
; X64_WINDOWS_GNU: orq %rax, %rcx
; X64_WINDOWS_GNU-NEXT: ud2
+; PS4: orq %rax, %rcx
+; PS4-NEXT: ud2
+
@_ZN11xercesc_2_513SchemaSymbols21fgURI_SCHEMAFORSCHEMAE = external constant [33 x i16], align 32 ; <[33 x i16]*> [#uses=1]
@_ZN11xercesc_2_56XMLUni16fgNotationStringE = external constant [9 x i16], align 16 ; <[9 x i16]*> [#uses=1]
diff --git a/llvm/test/CodeGen/X86/ps4-noreturn.ll b/llvm/test/CodeGen/X86/ps4-noreturn.ll
new file mode 100644
index 00000000000..4c14f218932
--- /dev/null
+++ b/llvm/test/CodeGen/X86/ps4-noreturn.ll
@@ -0,0 +1,38 @@
+; RUN: llc < %s -mtriple=x86_64-scei-ps4 | FileCheck %s
+
+declare i32 @personality(...)
+
+; Check that after the (implicitly noreturn) unwind call, there is
+; another instruction. It was easy to produce 'ud2' so we check for that.
+define void @foo1() personality i32 (...)* @personality {
+; CHECK-LABEL: foo1:
+; CHECK: .cfi_startproc
+; CHECK: callq bar
+; CHECK: retq
+; Check for 'ud2' between noreturn call and function end.
+; CHECK: callq _Unwind_Resume
+; CHECK-NEXT: ud2
+; CHECK-NEXT: .Lfunc_end0:
+ invoke void @bar()
+ to label %normal
+ unwind label %catch
+normal:
+ ret void
+catch:
+ %1 = landingpad { i8*, i32 } cleanup
+ resume { i8*, i32 } %1
+}
+
+declare void @bar() #0
+
+; Similar check after an explicit noreturn call.
+define void @foo2() {
+; CHECK-LABEL: foo2:
+; CHECK: callq bar
+; CHECK-NEXT: ud2
+; CHECK-NEXT: .Lfunc_end1:
+ tail call void @bar()
+ unreachable
+}
+
+attributes #0 = { noreturn }
OpenPOWER on IntegriCloud