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); 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 }