[llvm-dev] Running DCE after my pass

Jingyue Wu via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 29 10:29:16 PST 2015


Hi Tehila,

LLVM should not unconditionally remove such a function call because @foo
may have side effects. IIRC, if you mark @foo as "readonly" (
http://llvm.org/docs/LangRef.html#function-attributes), then DCE should be
able to remove the call.

On Tue, Dec 29, 2015 at 8:55 AM, Tehila Mayzels via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi,
>
>
>
> I wrote an IR pass and it adds some instructions that are not used.
>
> For example:
>
>
>
> %1 = call i64 @foo()
>
>
>
> When %1 is not used at all.
>
>
>
> I thought that running DCE (-dce) or DIE (-die) after my pass will remove
> such instructions, but it didn't.
>
>
>
> Why? And is there a way to do that?
>
>
>
> Thanks,
>
> Tehila.
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151229/c217147f/attachment-0001.html>


More information about the llvm-dev mailing list