[llvm-commits] [llvm] r52537 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
Matthijs Kooijman
matthijs at stdin.nl
Fri Jun 20 08:16:45 PDT 2008
Author: matthijs
Date: Fri Jun 20 10:16:45 2008
New Revision: 52537
URL: http://llvm.org/viewvc/llvm-project?rev=52537&view=rev
Log:
Don't let DeadArgElimination change the return type ({} into void and {T}
into T) when no return values are actually dead.
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=52537&r1=52536&r2=52537&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Fri Jun 20 10:16:45 2008
@@ -598,15 +598,21 @@
++NumRetValsEliminated;
Changed = true;
}
- if (RetTypes.size() == 0)
- // No return types? Make it void
- NRetTy = Type::VoidTy;
+ if (RetTypes.size() > 1 || (STy && STy->getNumElements() == RetTypes.size()))
+ // 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 chaning {something} into something
+ // and {} into void.
+ // Make the new struct packed if we used to return a packed struct
+ // already.
+ NRetTy = StructType::get(RetTypes, STy->isPacked());
else if (RetTypes.size() == 1)
- // One return type? Just a simple value then
+ // One return type? Just a simple value then, but only if we didn't use to
+ // return a struct with that simple value before.
NRetTy = RetTypes.front();
- else
- // More return types? Return a struct with them
- NRetTy = StructType::get(RetTypes);
+ else if (RetTypes.size() == 0)
+ // No return types? Make it void, but only if we didn't use to return {}
+ NRetTy = Type::VoidTy;
} else {
NRetTy = Type::VoidTy;
}
More information about the llvm-commits
mailing list