From a44d8a2897c4e0d3f50c878d171b6e1c9742b642 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 7 Oct 2003 22:32:43 +0000 Subject: [PATCH] Refactor code a bit git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8952 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/InstructionCombining.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index a8234b3c4b4..b31ec635c85 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -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. // -- 2.34.1