summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2008-06-05 08:48:32 +0000
committerMatthijs Kooijman <matthijs@stdin.nl>2008-06-05 08:48:32 +0000
commit257da0a7fc2df19444e57e7c84a278c6c1b9b551 (patch)
tree81d70701a9aa2db61fd45abf153f2d5bb2fbe816 /lib/Transforms/IPO
parent41335411a84aaf709e79b86b7dc109976940b772 (diff)
downloadllvm-257da0a7fc2df19444e57e7c84a278c6c1b9b551.tar.gz
llvm-257da0a7fc2df19444e57e7c84a278c6c1b9b551.tar.bz2
llvm-257da0a7fc2df19444e57e7c84a278c6c1b9b551.tar.xz
Let StructRetPromotion check if it's users are really calling it and not
passing its pointer. Fixes test with added testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51991 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/StructRetPromotion.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/IPO/StructRetPromotion.cpp b/lib/Transforms/IPO/StructRetPromotion.cpp
index 174a6fa767..97a532b8b1 100644
--- a/lib/Transforms/IPO/StructRetPromotion.cpp
+++ b/lib/Transforms/IPO/StructRetPromotion.cpp
@@ -158,6 +158,10 @@ bool SRETPromotion::isSafeToUpdateAllCallers(Function *F) {
for (Value::use_iterator FnUseI = F->use_begin(), FnUseE = F->use_end();
FnUseI != FnUseE; ++FnUseI) {
+ // The function is passed in as an argument to (possibly) another function,
+ // we can't change it!
+ if (FnUseI.getOperandNo() != 0)
+ return false;
CallSite CS = CallSite::get(*FnUseI);
Instruction *Call = CS.getInstruction();