[LLVMdev] Removing dead code

Fernando Magno Quintao Pereira fernando at CS.UCLA.EDU
Fri Jun 30 16:42:47 PDT 2006


> > where %reg1032 is dead.
>
> Right.  One of the jobs of the register allocator is to coallesce register
> copies.  Once coallesced, they can be removed.
>
> > I'm removing these instructions. In Linear scan, they are removed too.
> > I'm removing all the dead definitions from instructions that are not
> > function calls, and the resulting programs seem to work fine. The ratio
>
> I suggest you do more testing.  For copies, this is clearly fine, but for
> general instructions, it isn't.
>
> Again, how many of these are copies?  We expect that the register
> allocator will make copies dead and remove them.  Are you removing any
> non-copy instructions?
>

I think this is not a coalescing issue. The coalesced copies are removed
by the code generator of LLVM, and do not appear in the final assembly
code. I think that these dead definitions are due to function calls that
return void. In the programs that I tested, the only dead definitions were
in copy instructions (but I am not able yet to run the RA in big
programs). I will do as you guys suggested and will replace the test for
non-function call for a test for copy instructions. Actually, there are
other instructions besides CALLs that can also produce side effects, such
as DIVs.

Fernando



More information about the llvm-dev mailing list