[llvm-bugs] [Bug 28037] New: Bad PHI node after loop distribute

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 7 02:32:51 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28037

            Bug ID: 28037
           Summary: Bad PHI node after loop distribute
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mikael.holmen at ericsson.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16486
  --> https://llvm.org/bugs/attachment.cgi?id=16486&action=edit
Reproducer ll file

We've stumled upon a case where loop-distribute produces wrong code:

opt -loop-distribute loopdistbad.ll

gives

PHINode should have one entry for each predecessor of its parent basic block!
%split = phi i16 [ undef, %bb6 ]
LLVM ERROR: Broken function found, compilation aborted!

It's after LoopVersioning that the code looks bad. Specifically after the call
to

LVer.versionLoop(DefsUsedOutside);


Before bb5.bb7_crit_edge looks like:

bb5.bb7_crit_edge: ; preds = %bb6
%_tmp142.lcssa = phi i16 [ %_tmp142, %bb6 ]
%split = phi i16 [ %_tmp12114, %bb6 ]
store i16 %_tmp142.lcssa, i16* %k.19
br label %bb7

and after:

bb5.bb7_crit_edge: ; preds = %bb6.lver.orig, %bb6
%_tmp142.lcssa = phi i16 [ %_tmp142, %bb6 ], [ %_tmp142.lver.orig,
%bb6.lver.orig ]
%split = phi i16 [ %_tmp12114, %bb6 ]
store i16 %_tmp142.lcssa, i16* %k.19
br label %bb7

The PHI

%_tmp142.lcssa = phi i16 [ %_tmp142, %bb6 ]

is rewritten by LoopVersioning::addPHINodes to add the new incoming edge, but
DefsUsedOutside doesn't contain the other PHI so that one isn't rewritten and
thus is left in a bad state.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160607/0c2cde63/attachment.html>


More information about the llvm-bugs mailing list