<div dir="ltr">Hello there,<div><br></div><div>I'm writing a transformation pass for LLVM, and I hoped to use dce to clean up the resulting code after my pass. I just have some questions about LLVM's dce implementation.</div>

<div><br></div><div>Well, my transformation is a function pass, and, after the changes are made, some instructions are not needed anymore. In order to easily get rid of those instructions, I'm setting all their uses to UndefValue. This is necessary because some of the instructions I want to erase are inside loops, and, therefore, there might be a circular dependence between the instruction I want to delete and a PHINode, for example, when both of them are not useful anymore.</div>

<div><br></div><div>Ok, the problem is: I've always had explicitly invoked opt enabling, at least, -dce -adce -globaldce and -die, and I'm still getting a resultant code with some instructions like:</div><div><br>

</div><div><font color="#0000ff">store i8 </font><font color="#ff0000">undef</font><font color="#0000ff">, i8* %out.1107, align 1, !tbaa !1</font></div><div><br></div><div>and</div><div><font color="#0000ff"><br></font></div>

<div><font color="#0000ff">%storemerge = phi i8 [ %conv46, %if.else ], [ %call, %if.then ]</font>,</div><div>where <font color="#ff0000">%storemerge</font> has no uses.</div><div><br></div><div style>So, is there any other dce variant I should be enabling for opt? Better yet, is this the correct behavior for all the dce variants I enabled in opt?</div>

<div><br></div><div>Thanks,<br><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>


</div></div>