<div dir="ltr">Hi Duncan,<div><br></div><div style>Sorry for my late reply.</div><div style><br></div><div style>First, since I had already the information about which instructions should be deleted, I ended up writing a function that just erase all the useless instructions. Besides that, I actually think the problem with dce was being cause by my pass: I forgot to return "true" at the end of it, and I guess the PassManager was not calling dce after it because my pass was telling the PassManager the code was not being modified. If this is the case, there is no bug to report, right?</div>

<div style><br></div><div style>Either way, thank you for your reply =),</div></div><div class="gmail_extra"><br clear="all"><div><br>--<br>Cristianno Martins<br>PhD Student of Computer Science<br>University of Campinas<br>

<a href="mailto:cmartins@ic.unicamp.br" target="_blank">cmartins@ic.unicamp.br</a><br><a href="mailto:cristiannomartins@hotmail.com" target="_blank"></a></div>
<br><br><div class="gmail_quote">On Fri, May 31, 2013 at 10:26 PM, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr" target="_blank">baldrick@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi Cristianno,<div><div class="h5"><br>
<br>
On 01/06/13 01:49, Cristianno Martins wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello there,<br>
<br>
I'm writing a transformation pass for LLVM, and I hoped to use dce to clean up<br>
the resulting code after my pass. I just have some questions about LLVM's dce<br>
implementation.<br>
<br>
Well, my transformation is a function pass, and, after the changes are made,<br>
some instructions are not needed anymore. In order to easily get rid of those<br>
instructions, I'm setting all their uses to UndefValue. This is necessary<br>
because some of the instructions I want to erase are inside loops, and,<br>
therefore, there might be a circular dependence between the instruction I want<br>
to delete and a PHINode, for example, when both of them are not useful anymore.<br>
<br>
Ok, the problem is: I've always had explicitly invoked opt enabling, at least,<br>
-dce -adce -globaldce and -die, and I'm still getting a resultant code with some<br>
instructions like:<br>
<br>
store i8 undef, i8* %out.1107, align 1, !tbaa !1<br>
<br>
and<br>
<br>
%storemerge = phi i8 [ %conv46, %if.else ], [ %call, %if.then ],<br>
where %storemerge has no uses.<br>
<br>
So, is there any other dce variant I should be enabling for opt? Better yet, is<br>
this the correct behavior for all the dce variants I enabled in opt?<br>
</blockquote>
<br></div></div>
try running the instcombine pass too.  I'm surprised that dce didn't get the phi<br>
node though, want to open a bugreport about that?<br>
<br>
Ciao, Duncan.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
Thanks,<br>
<br>
--<br>
Cristianno Martins<br>
PhD Student of Computer Science<br>
University of Campinas<br>
</div><a href="mailto:cmartins@ic.unicamp.br" target="_blank">cmartins@ic.unicamp.br</a> <mailto:<a href="mailto:cmartins@ic.unicamp.br" target="_blank">cmartins@ic.unicamp.br</a><u></u>><br>
<mailto:<a href="mailto:cristiannomartins@hotmail.com" target="_blank">cristiannomartins@<u></u>hotmail.com</a>><br>
<br>
<br>
______________________________<u></u>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvmdev</a><br>
<br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div>