[LLVMdev] Intrinsics and dead instruction/code elimination

Chris Lattner clattner at apple.com
Wed May 19 15:46:17 PDT 2010


On May 19, 2010, at 3:13 PM, o.j.sivart at gmail.com wrote:

>> 
>> Intrinsics should be optimized as well as instructions.  In this specific case, these intrinsics should be marked readnone, which means that load/store optimization will ignore them.  Dead code elimination will delete the intrinsic if it is dead etc.
> 
> I understand that dead code elimination is able to delete the intrinsic if it is dead. What I'm interested in is whether or not, despite the entire intrinsic not being dead, anything is able to eliminate the setcc on overflow instruction part of the first intrinsic given that the store of obit1 is dead, thus obit1 is not needed, thus extracting the overflow bit from the CFLAGS register via a setcc instruction is no longer needed. I assume nothing is able to perform such optimisation on intrinsics and my guess is that the only option is, as I said, a pass which rewrites the first intrinsic to just its corresponding arithmetic instruction once a pass has dead store eliminated the first store. Is this the case?

I believe so, but you should write a testcase and see for yourself.

-Chris



More information about the llvm-dev mailing list