[llvm-bugs] [Bug 40683] New: [OptimizePHIs + Expensive Checks] Bad machine code: Virtual register killed in block, but needed live out.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 10 19:24:07 PST 2019


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

            Bug ID: 40683
           Summary: [OptimizePHIs + Expensive Checks]  Bad machine code:
                    Virtual register killed in block, but needed live out.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: paulsson at linux.vnet.ibm.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 21465
  --> https://bugs.llvm.org/attachment.cgi?id=21465&action=edit
reduced testcase

bin/llc -mcpu=z10 -O3 tc_vregkill_liveout.ll -o -

*** Bad machine code: Virtual register killed in block, but needed live out.
***
- function:    main
- basic block: %bb.2  (0x2aa66bceb88)
Virtual register %1 is used after the block.
LLVM ERROR: Found 1 machine code errors.

It seems that "Optimize machine instruction PHIs" is transforming this block,
which is inside a loop:

bb.2 (%ir-block.3):
; predecessors: %bb.1, %bb.3
  successors: %bb.4(0x40000000), %bb.5(0x40000000); %bb.4(50.00%),
%bb.5(50.00%)

  %3:gr32bit = PHI %1:gr32bit, %bb.1, %0:gr32bit, %bb.3
  %4:gr32bit = IMPLICIT_DEF
  CR killed %3:gr32bit, %4:gr32bit, implicit-def $cc
  %5:gr32bit = LHI 0
  %6:gr32bit = LHI -10
  BRC 14, 4, %bb.4, implicit $cc

to

bb.2 (%ir-block.3):
; predecessors: %bb.1, %bb.3
  successors: %bb.4(0x40000000), %bb.5(0x40000000); %bb.4(50.00%),
%bb.5(50.00%)

  %4:gr32bit = IMPLICIT_DEF
  CR killed %1:gr32bit, %4:gr32bit, implicit-def $cc
  %5:gr32bit = LHI 0
  %6:gr32bit = LHI -10
  BRC 14, 4, %bb.4, implicit $cc

Both %1 and %0 are defined outside the loop, and %0 is a copy of %1. %1 should
not have the kill flag since it is used in the next iteration as well.

-- 
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/20190211/e305a646/attachment.html>


More information about the llvm-bugs mailing list