Refactor code a bit
authorChris Lattner <sabre@nondot.org>
Tue, 7 Oct 2003 22:32:43 +0000 (22:32 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 7 Oct 2003 22:32:43 +0000 (22:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8952 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/InstructionCombining.cpp

index a8234b3c4b442df607a8172f27185916a3bcd4ee..b31ec635c85a8ea1bc846992d56ed12aa653af05 100644 (file)
@@ -99,6 +99,7 @@ namespace {
     Instruction *visitInstruction(Instruction &I) { return 0; }
 
   private:
+    Instruction *visitCallSite(CallSite CS);
     bool transformConstExprCastCall(CallSite CS);
 
     // InsertNewInstBefore - insert an instruction New before instruction Old
@@ -1581,15 +1582,13 @@ Instruction *InstCombiner::visitCastInst(CastInst &CI) {
 // CallInst simplification
 //
 Instruction *InstCombiner::visitCallInst(CallInst &CI) {
-  if (transformConstExprCastCall(&CI)) return 0;
-  return 0;
+  return visitCallSite(&CI);
 }
 
 // InvokeInst simplification
 //
 Instruction *InstCombiner::visitInvokeInst(InvokeInst &II) {
-  if (transformConstExprCastCall(&II)) return 0;
-  return 0;
+  return visitCallSite(&II);
 }
 
 // getPromotedType - Return the specified type promoted as it would be to pass
@@ -1605,6 +1604,15 @@ static const Type *getPromotedType(const Type *Ty) {
   }
 }
 
+// visitCallSite - Improvements for call and invoke instructions.
+//
+Instruction *InstCombiner::visitCallSite(CallSite CS) {
+  if (transformConstExprCastCall(CS)) return 0;
+
+  
+  return 0;
+}
+
 // transformConstExprCastCall - If the callee is a constexpr cast of a function,
 // attempt to move the cast to the arguments of the call/invoke.
 //