From 227c27dd0628d317fdb71e900809ff7bd39e70d2 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Wed, 4 Jun 2008 16:57:50 +0000 Subject: [PATCH] Replace two manual loops with calls to CallSite::hasArguments (no functional changes). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51947 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/IPA/CallGraph.cpp | 4 +--- lib/Transforms/IPO/DeadArgumentElimination.cpp | 12 +++++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp index eaa0d0181af..19d0fd51907 100644 --- a/lib/Analysis/IPA/CallGraph.cpp +++ b/lib/Analysis/IPA/CallGraph.cpp @@ -26,9 +26,7 @@ using namespace llvm; /// takes the address of the function. static bool isOnlyADirectCall(Function *F, CallSite CS) { if (!CS.getInstruction()) return false; - for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); I != E; ++I) - if (*I == F) return false; - return true; + return !CS.hasArgument(F); } namespace { diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp index 1ca5a3982ae..2f075ba30dc 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -331,13 +331,11 @@ void DAE::SurveyFunction(Function &F) { } // If the function is PASSED IN as an argument, its address has been taken - for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); - AI != E; ++AI) - if (AI->get() == &F) { - FunctionIntrinsicallyLive = true; - break; - } - if (FunctionIntrinsicallyLive) break; + + if (CS.hasArgument(&F)) { + FunctionIntrinsicallyLive = true; + break; + } } if (FunctionIntrinsicallyLive) {