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

Matthijs Kooijman matthijs at stdin.nl
Tue Jul 15 07:47:54 PDT 2008


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 :-)

Gr.

Matthijs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20080715/a91a4888/attachment.sig>


More information about the llvm-commits mailing list