[llvm-commits] [llvm] r37947 - in /llvm/trunk/lib/CodeGen: IntrinsicLowering.cpp SelectionDAG/SelectionDAGISel.cpp

Duncan Sands baldrick at free.fr
Fri Jul 6 07:46:23 PDT 2007


Author: baldrick
Date: Fri Jul  6 09:46:23 2007
New Revision: 37947

URL: http://llvm.org/viewvc/llvm-project?rev=37947&view=rev
Log:
The exception handling intrinsics return values,
so must be lowered to a value, not nothing at all.
Subtle point: I made eh_selector return 0 and
eh_typeid_for return 1.  This means that only
cleanups (destructors) will be run as the exception
unwinds [if eh_typeid_for returned 0 then it would
be as if the first catch always matched, and the
corresponding handler would be run], which is
probably want you want in the CBE.

Modified:
    llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Modified: llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp?rev=37947&r1=37946&r2=37947&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp Fri Jul  6 09:46:23 2007
@@ -706,9 +706,17 @@
   case Intrinsic::dbg_region_end:
   case Intrinsic::dbg_func_start:
   case Intrinsic::dbg_declare:
+    break;    // Simply strip out debugging intrinsics
+
   case Intrinsic::eh_exception:
   case Intrinsic::eh_selector:
-    break;    // Simply strip out debugging and eh intrinsics
+    CI->replaceAllUsesWith(Constant::getNullValue(CI->getType()));
+    break;
+
+  case Intrinsic::eh_typeid_for:
+    // Return something different to eh_selector.
+    CI->replaceAllUsesWith(ConstantInt::get(CI->getType(), 1));
+    break;
 
   case Intrinsic::var_annotation:
     break;   // Strip out annotate intrinsic

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=37947&r1=37946&r2=37947&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Jul  6 09:46:23 2007
@@ -2716,7 +2716,8 @@
       unsigned TypeID = MMI->getTypeIDFor(GV);
       setValue(&I, DAG.getConstant(TypeID, MVT::i32));
     } else {
-      setValue(&I, DAG.getConstant(0, MVT::i32));
+      // Return something different to eh_selector.
+      setValue(&I, DAG.getConstant(1, MVT::i32));
     }
 
     return 0;





More information about the llvm-commits mailing list