Commit dd7b846c by Jim Stichnoth

Subzero: Make sure register preferences obey register class constraints.

The bug was first spotted in the optimized gl_Color4ub() from spec2k's mesa. The lowering sequences for fptosi and fptoui with i8 or i16 include "mov T_2, T_1" where T_1 and T_2 may have different integer types, and the statement: T_2->setPreferredRegister(T_1, true); If T_2's type is i8 and T_1 is assigned a register that has no 8-bit version, then T_2 gets an unsuitable register. The fix is to honor RegisterOverlap only when RegMask allows. It's hard to construct a good test for this, since it depends heavily on register allocation decisions, which will change over time. BUG= none R=jvoung@chromium.org Review URL: https://codereview.chromium.org/544713002
parent cabfa304
...@@ -233,6 +233,7 @@ void LinearScan::scan(const llvm::SmallBitVector &RegMaskFull) { ...@@ -233,6 +233,7 @@ void LinearScan::scan(const llvm::SmallBitVector &RegMaskFull) {
: Variable::NoRegister; : Variable::NoRegister;
bool AllowedToOverlap = Cur.Var->getRegisterOverlap() && bool AllowedToOverlap = Cur.Var->getRegisterOverlap() &&
PreferReg != Variable::NoRegister && PreferReg != Variable::NoRegister &&
RegMask[PreferReg] &&
!PrecoloredUnhandled[PreferReg]; !PrecoloredUnhandled[PreferReg];
if (PreferReg != Variable::NoRegister && if (PreferReg != Variable::NoRegister &&
(AllowedToOverlap || Free[PreferReg])) { (AllowedToOverlap || Free[PreferReg])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment