<div dir="ltr">Err, then the algorithm is broken somewhere.<div><br></div><div>This is definitely not the right fix from what i've seen so far.</div><div>Can you see what decides to insert this?</div><div><br></div><div>I suspect, based on your failure mode, that the leader table is not ordered locally by dominance, only by bb, and so when it calls findLeader, it grabs the first thing it finds, and does a broken thing.</div><div><br></div><div>It would only work in the processInstruction case because processInstrucion goes in dominance order.</div><div><br></div><div>If so, that would be bad (and hard to fix well without serious surgery), and we should probably declare it broken, revert your set of patches, and just abort PRE  (IE the other option i suggested where we set success=false and bailing)</div><div> </div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 13, 2015 at 5:30 PM, Weiming Zhao <span dir="ltr"><<a href="mailto:weimingz@codeaurora.org" target="_blank">weimingz@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">weimingz added a comment.<br>
<br>
This patch adds a reduced test from SPASS.<br>
<br>
we need the check:<br>
<br>
  if (Num >= NextNum)<br>
          addToLeaderTable(Num, I, I->getParent());<br>
<br>
Otherwise, BB %wile.end (see line 91) will become :<br>
<br>
while.end:                                        ; preds = %while.cond.16<br>
<br>
  %add.ptr = getelementptr inbounds i8, i8* %v2, i32 undef<br>
  store i8* %add.ptr, i8** @dfg_text, align 4<br>
  %sub.ptr.sub26 = sub i32 0, %0  ==> use here<br>
  %0 = ptrtoint i8* %add.ptr to i32  ==> def here<br>
  switch i32 undef, label %sw.default [<br>
    i32 65, label %while.bodythread-pre-split<br>
<br>
<br>
<a href="http://reviews.llvm.org/D14670" rel="noreferrer" target="_blank">http://reviews.llvm.org/D14670</a><br>
<br>
<br>
<br>
</blockquote></div><br></div>