diff options
| author | Matthijs Kooijman <matthijs@stdin.nl> | 2008-07-15 14:42:31 +0000 | 
|---|---|---|
| committer | Matthijs Kooijman <matthijs@stdin.nl> | 2008-07-15 14:42:31 +0000 | 
| commit | c893bf472d8b55b1efa17a712f2a6118601fd78f (patch) | |
| tree | 2157dd92de235c49972c016680d8cb48729f3244 /llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp | |
| parent | 5e8c022e2160eb65ca6a2e6cbcd6372544c607c6 (diff) | |
| download | bcm5719-llvm-c893bf472d8b55b1efa17a712f2a6118601fd78f.tar.gz bcm5719-llvm-c893bf472d8b55b1efa17a712f2a6118601fd78f.zip  | |
Allow deadargelim to change return types even though now values were dead. This
again canonicalizes {i32} into i32 and {} into void.
llvm-svn: 53610
Diffstat (limited to 'llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp')
| -rw-r--r-- | llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp | 12 | 
1 files changed, 1 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp index c6d6fec7b87..5f1920b0618 100644 --- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -601,8 +601,6 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {    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 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {            ++NumRetValsEliminated;            DOUT << "DAE - Removing return value " << i << " from "                 << F->getNameStart() << "\n"; -          Changed = true;          }        }      else @@ -633,9 +630,8 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {          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 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {        ++NumArgumentsEliminated;        DOUT << "DAE - Removing argument " << i << " (" << I->getNameStart()             << ") from " << F->getNameStart() << "\n"; -      Changed = true;      }    } @@ -714,11 +709,6 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {    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);  | 

