[llvm-commits] [llvm] r52519 - /llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
Dan Gohman
gohman at apple.com
Thu Jun 19 18:03:44 PDT 2008
Author: djg
Date: Thu Jun 19 20:03:44 2008
New Revision: 52519
URL: http://llvm.org/viewvc/llvm-project?rev=52519&view=rev
Log:
Teach InlineFunction how to differentiate between multiple-value
return statements and aggregate returns so that it handles both
correctly.
Modified:
llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=52519&r1=52518&r2=52519&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Thu Jun 19 20:03:44 2008
@@ -443,8 +443,9 @@
// uses of the returned value.
if (!TheCall->use_empty()) {
ReturnInst *R = Returns[0];
- if (isa<StructType>(TheCall->getType())) {
- // Multiple return values.
+ if (isa<StructType>(TheCall->getType()) &&
+ TheCall->getType() != R->getOperand(0)->getType()) {
+ // Multiple-value return statements.
while (!TheCall->use_empty()) {
GetResultInst *GR = cast<GetResultInst>(TheCall->use_back());
Value *RV = R->getOperand(GR->getIndex());
@@ -509,6 +510,13 @@
// any users of the original call/invoke instruction.
const Type *RTy = CalledFunc->getReturnType();
const StructType *STy = dyn_cast<StructType>(RTy);
+
+ // We do special handling for multiple-value return statements. If this is
+ // a plain aggregate return, don't do the special handling.
+ if (!Returns.empty() && Returns[0]->getNumOperands() != 0 &&
+ Returns[0]->getOperand(0)->getType() == STy)
+ STy = 0;
+
if (Returns.size() > 1 || STy) {
// The PHI node should go at the front of the new basic block to merge all
// possible incoming values.
More information about the llvm-commits
mailing list