diff options
| author | Quentin Colombet <qcolombet@apple.com> | 2017-07-07 19:25:45 +0000 |
|---|---|---|
| committer | Quentin Colombet <qcolombet@apple.com> | 2017-07-07 19:25:45 +0000 |
| commit | 868ef847a627b95c93d0eac5080cdcc3f989f56e (patch) | |
| tree | 34c977444b329c4cee54ca7c9435ed05a1f1e5f7 /llvm/lib/CodeGen/RegAllocFast.cpp | |
| parent | 81551148b72f46760db75e4fa5cb85b82bbc766b (diff) | |
| download | bcm5719-llvm-868ef847a627b95c93d0eac5080cdcc3f989f56e.tar.gz bcm5719-llvm-868ef847a627b95c93d0eac5080cdcc3f989f56e.zip | |
[RegAllocFast] Don't insert kill flags of super-register for partial kill
When reusing a register for a new definition, the fast register allocator
used to insert a kill flag at the previous last use of that register to
inform later passes that this register is free between the redef and the
last use. However, this may be wrong when subregisters are involved.
Indeed, a partially redef would have trigger a kill of the full super
register, potentially wrongly marking all the other subregisters as
free. Given we don't track which lanes are still live, we cannot set the
kill flag in such case.
Note: This bug has been latent for about 7 years (r104056).
llvmg.org/PR33677
llvm-svn: 307428
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocFast.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/RegAllocFast.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp index 7d9bc8cba21..d5538be4bba 100644 --- a/llvm/lib/CodeGen/RegAllocFast.cpp +++ b/llvm/lib/CodeGen/RegAllocFast.cpp @@ -246,8 +246,15 @@ void RAFast::addKillFlag(const LiveReg &LR) { if (MO.isUse() && !LR.LastUse->isRegTiedToDefOperand(LR.LastOpNum)) { if (MO.getReg() == LR.PhysReg) MO.setIsKill(); - else - LR.LastUse->addRegisterKilled(LR.PhysReg, TRI, true); + // else, don't do anything we are problably redefining a + // subreg of this register and given we don't track which + // lanes are actually dead, we cannot insert a kill flag here. + // Otherwise we may end up in a situation like this: + // ... = (MO) physreg:sub1, physreg <implicit-use, kill> + // ... <== Here we would allow later pass to reuse physreg:sub1 + // which is potentially wrong. + // LR:sub0 = ... + // ... = LR.sub1 <== This is going to use physreg:sub1 } } |

