diff options
author | Gabor Greif <ggreif@gmail.com> | 2009-01-22 21:35:57 +0000 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2009-01-22 21:35:57 +0000 |
commit | edc4d69917df7dc34543adf719d5c93249fd5e27 (patch) | |
tree | 5da6a083d7eff2b5ba22d563b1a817caf42abcaf /lib/Transforms/IPO/IPConstantPropagation.cpp | |
parent | 1592e5b75a4e919c463914acdb4cab0a6a6ebd53 (diff) | |
download | llvm-edc4d69917df7dc34543adf719d5c93249fd5e27.tar.gz llvm-edc4d69917df7dc34543adf719d5c93249fd5e27.tar.bz2 llvm-edc4d69917df7dc34543adf719d5c93249fd5e27.tar.xz |
introduce a useful abstraction to find out if a Use is in the call position of an instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62788 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/IPConstantPropagation.cpp')
-rw-r--r-- | lib/Transforms/IPO/IPConstantPropagation.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp index 6ae8276d52..2dc8558246 100644 --- a/lib/Transforms/IPO/IPConstantPropagation.cpp +++ b/lib/Transforms/IPO/IPConstantPropagation.cpp @@ -88,11 +88,12 @@ bool IPCP::PropagateConstantsIntoArguments(Function &F) { for (Value::use_iterator UI = F.use_begin(), E = F.use_end(); UI != E; ++UI) { // Used by a non-instruction, or not the callee of a function, do not // transform. - if (UI.getOperandNo() != 0 || - (!isa<CallInst>(*UI) && !isa<InvokeInst>(*UI))) + if (!isa<CallInst>(*UI) && !isa<InvokeInst>(*UI)) return false; CallSite CS = CallSite::get(cast<Instruction>(*UI)); + if (!CS.isCallee(UI)) + return false; // Check out all of the potentially constant arguments. Note that we don't // inspect varargs here. @@ -219,7 +220,7 @@ bool IPCP::PropagateConstantReturn(Function &F) { // Not a call instruction or a call instruction that's not calling F // directly? - if (!Call || UI.getOperandNo() != 0) + if (!Call || !CS.isCallee(UI)) continue; // Call result not used? |