[PATCH] D111172: [PS4 UBSAN] Emit ud2 for ubsantrap for the PS4 target.
Wolfgang Pieb via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 5 11:42:06 PDT 2021
wolfgangp created this revision.
wolfgangp added a reviewer: probinson.
Herald added subscribers: pengfei, hiraditya.
wolfgangp requested review of this revision.
Herald added a project: LLVM.
For the PS4 target we want to emit a ud2 opcode for a ubsantrap instead of ud1.
https://reviews.llvm.org/D111172
Files:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/ubsantrap.ll
Index: llvm/test/CodeGen/X86/ubsantrap.ll
===================================================================
--- llvm/test/CodeGen/X86/ubsantrap.ll
+++ llvm/test/CodeGen/X86/ubsantrap.ll
@@ -1,8 +1,12 @@
; RUN: llc -mtriple=x86_64-linux-gnu %s -o - | FileCheck %s
+; RUN: llc -mtriple=x86_64-scei-ps4 %s -o - | FileCheck --check-prefix=PS4 %s
define void @test_ubsantrap() {
; CHECK-LABEL: test_ubsantrap
; CHECK: ud1l 12(%eax), %eax
+; PS4-LABEL: test_ubsantrap
+; PS4-NOT: ud1
+; PS4: ud2
call void @llvm.ubsantrap(i8 12)
ret void
}
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -534,6 +534,8 @@
setOperationAction(ISD::TRAP, MVT::Other, Legal);
setOperationAction(ISD::DEBUGTRAP, MVT::Other, Legal);
setOperationAction(ISD::UBSANTRAP, MVT::Other, Legal);
+ if (Subtarget.getTargetTriple().isPS4CPU())
+ setOperationAction(ISD::UBSANTRAP, MVT::Other, Expand);
// VASTART needs to be custom lowered to use the VarArgsFrameIndex
setOperationAction(ISD::VASTART , MVT::Other, Custom);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111172.377313.patch
Type: text/x-patch
Size: 1197 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211005/9c291891/attachment.bin>
More information about the llvm-commits
mailing list