diff options
author | Matthijs Kooijman <matthijs@stdin.nl> | 2008-06-05 08:57:20 +0000 |
---|---|---|
committer | Matthijs Kooijman <matthijs@stdin.nl> | 2008-06-05 08:57:20 +0000 |
commit | e0c5adc158ab869c04113682c34d60bd890d6962 (patch) | |
tree | 86d386c072ae892f1bdf7af132b25e7651e8d81f /llvm/lib | |
parent | 463f86639dc83c13c8e84e3c84496b4af1b0e080 (diff) | |
download | bcm5719-llvm-e0c5adc158ab869c04113682c34d60bd890d6962.tar.gz bcm5719-llvm-e0c5adc158ab869c04113682c34d60bd890d6962.zip |
Let StructRetPromotion check if all if its users are really calls or invokesn,
not other instructions. This fixes a crash with the added testcase.
llvm-svn: 51992
Diffstat (limited to 'llvm/lib')
-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 97a532b8b11..94bf4c6d5f2 100644 --- a/llvm/lib/Transforms/IPO/StructRetPromotion.cpp +++ b/llvm/lib/Transforms/IPO/StructRetPromotion.cpp @@ -165,6 +165,10 @@ bool SRETPromotion::isSafeToUpdateAllCallers(Function *F) { CallSite CS = CallSite::get(*FnUseI); Instruction *Call = CS.getInstruction(); + // The function is used by something else than a call or invoke instruction, + // we can't change it! + if (!Call) + return false; CallSite::arg_iterator AI = CS.arg_begin(); Value *FirstArg = *AI; |