diff options
-rw-r--r-- | lib/Transforms/IPO/DeadArgumentElimination.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp index 2f075ba..604a148 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -302,6 +302,12 @@ void DAE::SurveyFunction(Function &F) { 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 @@ void DAE::SurveyFunction(Function &F) { 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) { |