[PATCH] Fix use-after-kill in TailDuplication

Keno Fischer kfischer at college.harvard.edu
Thu Nov 13 22:10:41 PST 2014


If a register that was the result of a PHI instruction is killed in
the same basic block, TailDuplication sill tries to insert a COPY
at the end of the new basic block, causing a verifier failure like so (i.e. when run with `llc -fast-isel -O3 -verify-machineinstrs`):

```
    *** Bad machine code: Using a killed virtual register ***
    - function:    julia_anonymous1421
    - basic block: BB#4 isf (0x17d84d0)
    - instruction: %vreg12<def> = COPY %vreg7; GR64:%vreg12,%vreg7
    - operand 1:   %vreg7

    *** Bad machine code: Using a killed virtual register ***
    - function:    julia_anonymous1421
    - basic block: BB#6 notf (0x17d8630)
    - instruction: %vreg14<def> = COPY %vreg6; GR64:%vreg14,%vreg6
    - operand 1:   %vreg6
    LLVM ERROR: Found 2 machine code errors.
```

http://reviews.llvm.org/D6263

Files:
  lib/CodeGen/TailDuplication.cpp
  test/CodeGen/Generic/taildup-kill.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6263.16198.patch
Type: text/x-patch
Size: 2994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141114/53ef2d96/attachment.bin>


More information about the llvm-commits mailing list