[llvm-dev] Running DCE after my pass

Tehila Mayzels via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 29 12:36:26 PST 2015

I understand. Thanks a lot!


From: Jingyue Wu [mailto:jingyue at google.com] 
Sent: Tuesday, December 29, 2015 8:29 PM
To: Tehila Mayzels
Cc: llvm-dev
Subject: Re: [llvm-dev] Running DCE after my pass


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:



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?




LLVM Developers mailing list
llvm-dev at lists.llvm.org


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151229/7144c8c3/attachment.html>

More information about the llvm-dev mailing list