[llvm-bugs] [Bug 36902] New: [PostRA Machine Sink] Sunk instruction corrupts liveness tracking

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 26 04:49:57 PDT 2018


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

            Bug ID: 36902
           Summary: [PostRA Machine Sink]  Sunk instruction corrupts
                    liveness tracking
           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 20123
  --> https://bugs.llvm.org/attachment.cgi?id=20123&action=edit
reduced testcase (for clang)

This instruction:

renamable $r0l = COPY renamable $r12l, implicit killed $r12q

copies a subreg ($r12l) of $r12q which is killed. It is sunk into this block:

bb.8..preheader26:
; predecessors: %bb.6
successors: %bb.10(0x50000000), %bb.9(0x30000000)
liveins: $r4d, $r0l, $r13l
renamable $r0d = LGFR killed renamable $r0l
renamable $r11d = LGFR killed renamable $r13l
CHIMux renamable $r4l, 0, implicit-def $cc, implicit killed $r4d
BRC 14, 10, %bb.10, implicit killed $cc

like

bb.8..preheader26:
; predecessors: %bb.6
successors: %bb.10(0x50000000), %bb.9(0x30000000)
liveins: $r4d, $r13l, $r12l
renamable $r0l = COPY renamable $r12l, implicit killed $r12q
renamable $r0d = LGFR killed renamable $r0l
renamable $r11d = LGFR killed renamable $r13l
CHIMux renamable $r4l, 0, implicit-def $cc, implicit killed $r4d
BRC 14, 10, %bb.10, implicit killed $cc

Note that another subreg of $r12q was already live into this MBB
($r13l). Since the sunk instruction now kills $r13l before its use,
machine veririer says:

*** Bad machine code: Using an undefined physical register ***
- function:    decode_one_b8block
- basic block: %bb.8 .preheader26 (0x2aa41875a08)
- instruction: renamable $r11d = LGFR killed renamable $r13l

- operand 1:   killed renamable $r13l


clang line:

bin/clang -march=z13  -mllvm -disable-machine-dce -mllvm -disable-machine-sink
-mllvm -extra-vectorizer-passes  -mllvm -enable-tbaa=false -mllvm
-verify-machineinstrs   -O3  -w  -o ./out.ll  ./tc_machinesink.ll

llc line:

bin/llc -mtriple=s390x-linux-gnu -mcpu=z13 -start-before=postra-machine-sink
./tc_machinesink.mir -O3 -verify-machineinstrs

-- 
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/20180326/5ce3abf2/attachment.html>


More information about the llvm-bugs mailing list