[llvm-commits] [llvm] r51990 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
Matthijs Kooijman
matthijs at stdin.nl
Thu Jun 5 01:34:26 PDT 2008
Author: matthijs
Date: Thu Jun 5 03:34:25 2008
New Revision: 51990
URL: http://llvm.org/viewvc/llvm-project?rev=51990&view=rev
Log:
Use use_iterator::getOperandNo instead of CallSite::hasArgument to check if a
function is passed as an argument instead of called. Also do this check a bit
earlier.
Modified:
llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=51990&r1=51989&r2=51990&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Thu Jun 5 03:34:25 2008
@@ -302,6 +302,12 @@
FunctionIntrinsicallyLive = true;
else
for (Value::use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) {
+ // If the function is PASSED IN as an argument, its address has been taken
+ if (I.getOperandNo() != 0) {
+ FunctionIntrinsicallyLive = true;
+ break;
+ }
+
// If this use is anything other than a call site, the function is alive.
CallSite CS = CallSite::get(*I);
Instruction *TheCall = CS.getInstruction();
@@ -329,13 +335,6 @@
RetValLiveness = Live;
break;
}
-
- // If the function is PASSED IN as an argument, its address has been taken
-
- if (CS.hasArgument(&F)) {
- FunctionIntrinsicallyLive = true;
- break;
- }
}
if (FunctionIntrinsicallyLive) {
More information about the llvm-commits
mailing list