[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
Wed Oct 6 11:49:55 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf53d05135e98: [UBSAN][PS4] For the PS4 target, emit the ud2 ocpode for ubsan traps. (authored by wolfgangp).

Changed prior to commit:
  https://reviews.llvm.org/D111172?vs=377313&id=377628#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111172/new/

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
@@ -533,7 +533,10 @@
 
   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);
+  else
+    setOperationAction(ISD::UBSANTRAP, MVT::Other, Legal);
 
   // 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.377628.patch
Type: text/x-patch
Size: 1268 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211006/c098a12c/attachment.bin>


More information about the llvm-commits mailing list