Skip to content

Commit

Permalink
LivePhysRegs: removeReg() must remove aliased registers
Browse files Browse the repository at this point in the history
We must remove all aliased registers which may be more than the all sub
and super registers combined.

Bug found while reading the code. The bug does not affect any existing
target as the only use of register aliases I could found were control
registers on ARM and Hexagon which are all reserved.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265510 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
MatzeB committed Apr 6, 2016
1 parent 1685c6f commit 72b4fa0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions include/llvm/CodeGen/LivePhysRegs.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,8 @@ class LivePhysRegs {
void removeReg(unsigned Reg) {
assert(TRI && "LivePhysRegs is not initialized.");
assert(Reg <= TRI->getNumRegs() && "Expected a physical register.");
for (MCSubRegIterator SubRegs(Reg, TRI, /*IncludeSelf=*/true);
SubRegs.isValid(); ++SubRegs)
LiveRegs.erase(*SubRegs);
for (MCSuperRegIterator SuperRegs(Reg, TRI, /*IncludeSelf=*/false);
SuperRegs.isValid(); ++SuperRegs)
LiveRegs.erase(*SuperRegs);
for (MCRegAliasIterator R(Reg, TRI, true); R.isValid(); ++R)
LiveRegs.erase(*R);
}

/// \brief Removes physical registers clobbered by the regmask operand @p MO.
Expand Down

0 comments on commit 72b4fa0

Please sign in to comment.