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 | f4013373cd9919fb7f4425ad549e4fdf0c875fba (patch) | |
tree | ca91eca70111f94b6a90c0122a063b49db4c37ae /llvm/lib/Transforms/IPO/IPConstantPropagation.cpp | |
parent | 8c5ffd07610476f5e7fd95fca8817e12c76584f4 (diff) | |
download | llvm-f4013373cd9919fb7f4425ad549e4fdf0c875fba.zip llvm-f4013373cd9919fb7f4425ad549e4fdf0c875fba.tar.gz llvm-f4013373cd9919fb7f4425ad549e4fdf0c875fba.tar.bz2 |
introduce a useful abstraction to find out if a Use is in the call position of an instruction
llvm-svn: 62788
Diffstat (limited to 'llvm/lib/Transforms/IPO/IPConstantPropagation.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/IPConstantPropagation.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp b/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp index 6ae8276..2dc85582 100644 --- a/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp +++ b/llvm/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? |