[llvm-commits] [llvm] r52537 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp

Chris Lattner clattner at apple.com
Tue Jun 24 10:55:50 PDT 2008


On Jun 20, 2008, at 8:16 AM, Matthijs Kooijman wrote:

> 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.

Out of curiosity, why not?  {x} -> x would eliminate extractvalue  
instructions, so it seems that it would reduce the size of the IR.

> +++ 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

typo: chaning -> changing

-Chris



More information about the llvm-commits mailing list