diff options
author | Matthijs Kooijman <matthijs@stdin.nl> | 2008-06-05 08:48:32 +0000 |
---|---|---|
committer | Matthijs Kooijman <matthijs@stdin.nl> | 2008-06-05 08:48:32 +0000 |
commit | 463f86639dc83c13c8e84e3c84496b4af1b0e080 (patch) | |
tree | d592d59fcdb90bc545a3a72af8425e0d77163c1f /llvm/lib/Transforms/IPO/StructRetPromotion.cpp | |
parent | 230d6fbfebcaf6a72fa9c1604bd9d2b93df14047 (diff) | |
download | bcm5719-llvm-463f86639dc83c13c8e84e3c84496b4af1b0e080.tar.gz bcm5719-llvm-463f86639dc83c13c8e84e3c84496b4af1b0e080.zip |
Let StructRetPromotion check if it's users are really calling it and not
passing its pointer. Fixes test with added testcase.
llvm-svn: 51991
Diffstat (limited to 'llvm/lib/Transforms/IPO/StructRetPromotion.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/StructRetPromotion.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/StructRetPromotion.cpp b/llvm/lib/Transforms/IPO/StructRetPromotion.cpp index 174a6fa7671..97a532b8b11 100644 --- a/llvm/lib/Transforms/IPO/StructRetPromotion.cpp +++ b/llvm/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(); |