[llvm-commits] [llvm] r53610 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
Matthijs Kooijman
matthijs at stdin.nl
Tue Jul 15 07:42:31 PDT 2008
Author: matthijs
Date: Tue Jul 15 09:42:31 2008
New Revision: 53610
URL: http://llvm.org/viewvc/llvm-project?rev=53610&view=rev
Log:
Allow deadargelim to change return types even though now values were dead. This
again canonicalizes {i32} into i32 and {} into void.
Modified:
llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=53610&r1=53609&r2=53610&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Tue Jul 15 09:42:31 2008
@@ -601,8 +601,6 @@
const Type *RetTy = FTy->getReturnType();
const Type *NRetTy = NULL;
unsigned RetCount = NumRetVals(F);
- // Explicitly track if anything changed, for debugging.
- bool Changed = false;
// -1 means unused, other numbers are the new index
SmallVector<int, 5> NewRetIdxs(RetCount, -1);
std::vector<const Type*> RetTypes;
@@ -621,7 +619,6 @@
++NumRetValsEliminated;
DOUT << "DAE - Removing return value " << i << " from "
<< F->getNameStart() << "\n";
- Changed = true;
}
}
else
@@ -633,9 +630,8 @@
DOUT << "DAE - Removing return value from " << F->getNameStart()
<< "\n";
++NumRetValsEliminated;
- Changed = true;
}
- if (RetTypes.size() > 1 || (STy && STy->getNumElements()==RetTypes.size()))
+ if (RetTypes.size() > 1)
// More than one return type? Return a struct with them. Also, if we used
// to return a struct and didn't change the number of return values,
// return a struct again. This prevents changing {something} into
@@ -688,7 +684,6 @@
++NumArgumentsEliminated;
DOUT << "DAE - Removing argument " << i << " (" << I->getNameStart()
<< ") from " << F->getNameStart() << "\n";
- Changed = true;
}
}
@@ -714,11 +709,6 @@
if (NFTy == FTy)
return false;
- // The function type is only allowed to be different if we actually left out
- // an argument or return value.
- assert(Changed && "Function type changed while no arguments or return values"
- "were removed!");
-
// Create the new function body and insert it into the module...
Function *NF = Function::Create(NFTy, F->getLinkage());
NF->copyAttributesFrom(F);
More information about the llvm-commits
mailing list