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

Chris Lattner clattner at apple.com
Thu Jul 17 12:55:11 PDT 2008


On Jul 15, 2008, at 7:47 AM, Matthijs Kooijman wrote:

> Hi Chris,
>
>> I still think it would be preferable to lower this into:
>>
>> %S = call i32 @foo()
>> %t = insertvalue {i32} undef, 0, i32 %S
>> call void @bar({ i32 } %t)
>>
>> This is not an "optimization" by itself persay, but it *is* a
>> canonicalization, and it is useful to have canonical forms for code.
> I've restructured the code a bit and it now does exactly this. This  
> is mainly
> due to making deadargelim less smart: Instead of trying to replace all
> extractvalue instructions that use the result of a function, it now  
> simply
> rebuilds the old struct that was returned (with undef gaps wherever  
> the unused
> values were). This allows instcombine to turn the result into the  
> above.
>
>>> However, I'm not really sure this is worth the effort. Perhaps this
>>> should be done in a different pass, really?
>> Why in a different pass?
> Because I didn't think I could fit it into deadargelim elegantly.  
> But it
> worked out after all :-)

Very nice Matthijs!

-Chris




More information about the llvm-commits mailing list