[LLVMdev] extracting data and operands

Devang Patel devang.patel at gmail.com
Mon Nov 16 14:19:14 PST 2009


Hersh,

On Mon, Nov 16, 2009 at 11:25 AM, Hersh.S. Iyer <coolhersh at gmail.com> wrote:
> Hi,
>
> I wish to implement dead code elimination as a pass in llvm. This is not the
> same as unreachable block.
> For this, I plan to go ahead like this :
> In each function
>     Identify the store and branch operations
>     Identify the operands involved in these operations.
>     Build the UD chain of these and check if there is any variable that is
> not used and mark its definition (the entire instruction)
> Delete all marked instructions.
>
> I have no clue how to do this using llvm. Any help would be greatly
> appreciated.
>

Read  lib/Transforms/Scalar/DCE.html. It'll help you understand how to
write such transformations in LLVM.
-
Devang




More information about the llvm-dev mailing list