<div dir="ltr">I am probably stating the obvious, but if the function is side-effect free (onlyReadsMemory) it is valid to remove it.<div><br></div><div>But I am guessing that does not belong to this pass.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 24, 2016 at 8:38 AM, Sanjoy Das via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Btw, looks like the bug is in runSCCP in<br>
<br>
    for (BasicBlock::iterator BI = BB.begin(), E = BB.end(); BI != E;) {<br>
      Instruction *Inst = &*BI++;<br>
      if (Inst->getType()->isVoidTy() || isa<TerminatorInst>(Inst))<br>
        continue;<br>
<br>
      if (tryToReplaceInstWithConstant(<wbr>Solver, Inst,<br>
                                       true /* shouldEraseFromParent */)) {<br>
        // Hey, we just changed something!<br>
        MadeChanges = true;<br>
        ++NumInstRemoved;<br>
      }<br>
<br>
It should not be passing in true for shouldEraseFromParent.  I think<br>
the right fix here is to not have the shouldEraseFromParent parameter<br>
at all, but in tryToReplaceInstWithConstant to do:<br>
<br>
  // replace Inst with constant<br>
  llvm::<wbr>RecursivelyDeleteTriviallyDead<wbr>Instructions(Inst, TLI);<br>
<br>
Let me know if you want to take a crack at this, otherwise I'll get to<br>
it this week.<br>
<br>
-- Sanjoy<br>
<span class="im HOEnZb"><br>
<br>
On Wed, Aug 24, 2016 at 12:12 AM, Sanjoy Das<br>
<<a href="mailto:sanjoy@playingwithpointers.com">sanjoy@playingwithpointers.<wbr>com</a>> wrote:<br>
> Hi Félix,<br>
><br>
> Sanjoy Das wrote:<br>
>> Félix Cloutier via llvm-dev wrote:<br>
>>  > Assuming that this is a bug, what are the next steps?<br>
>><br>
>> Looks like you already have a very small test case -- have you tried<br>
>> sticking it in a debugger to see why SCCP thinks removing the call is<br>
>> okay?<br>
>><br>
>> Alternatively, file a bug at <a href="http://llvm.org/bugs" rel="noreferrer" target="_blank">llvm.org/bugs</a> and someone will get to it.<br>
><br>
> The third thing you can do is run a bisection to find the problematic<br>
> commit, since you said this was a regression.<br>
><br>
> -- Sanjoy<br>
<br>
<br>
<br>
</span><span class="HOEnZb"><font color="#888888">--<br>
Sanjoy Das<br>
<a href="http://playingwithpointers.com" rel="noreferrer" target="_blank">http://playingwithpointers.com</a><br>
</font></span><div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><b>Alexandre Isoard</b><br></div></div>
</div>