This patch is to fix radar://8426430. It is about llvm support of __builtin_debugtrap()
[oota-llvm.git] / lib / CodeGen / SelectionDAG / TargetLowering.cpp
index cd485ac235c1c27d897b4362e2b5439ff63dd7d1..5abc55ba8e2a95a0b6b010f047c0400ef02d5f70 100644 (file)
@@ -583,6 +583,11 @@ TargetLowering::TargetLowering(const TargetMachine &tm,
   // Default ISD::TRAP to expand (which turns it into abort).
   setOperationAction(ISD::TRAP, MVT::Other, Expand);
 
+  // On most systems, DEBUGTRAP and TRAP have no difference. The "Expand"
+  // here is to inform DAG Legalizer to replace DEBUGTRAP with TRAP.
+  //
+  setOperationAction(ISD::DEBUGTRAP, MVT::Other, Expand);
+
   IsLittleEndian = TD->isLittleEndian();
   PointerTy = MVT::getIntegerVT(8*TD->getPointerSize(0));
   memset(RegClassForVT, 0,MVT::LAST_VALUETYPE*sizeof(TargetRegisterClass*));