diff --git a/llvm/utils/TableGen/CodeGenRegisters.cpp b/llvm/utils/TableGen/CodeGenRegisters.cpp index 2d5f5c841a17..a53f3cb6305e 100644 --- a/llvm/utils/TableGen/CodeGenRegisters.cpp +++ b/llvm/utils/TableGen/CodeGenRegisters.cpp @@ -2124,7 +2124,7 @@ void CodeGenRegBank::computeRegUnitLaneMasks() { // Create an initial lane mask for all register units. const auto &RegUnits = Register.getRegUnits(); CodeGenRegister::RegUnitLaneMaskList RegUnitLaneMasks( - RegUnits.count(), LaneBitmask::getAll()); + RegUnits.count(), LaneBitmask::getNone()); // Iterate through SubRegisters. typedef CodeGenRegister::SubRegMap SubRegMap; const SubRegMap &SubRegs = Register.getSubRegs(); @@ -2143,7 +2143,7 @@ void CodeGenRegBank::computeRegUnitLaneMasks() { unsigned u = 0; for (unsigned RU : RegUnits) { if (SUI == RU) { - RegUnitLaneMasks[u] &= LaneMask; + RegUnitLaneMasks[u] |= LaneMask; assert(!Found); Found = true; } @@ -2153,6 +2153,10 @@ void CodeGenRegBank::computeRegUnitLaneMasks() { assert(Found); } } + for (auto &Mask : RegUnitLaneMasks) { + if (Mask.none()) + Mask = LaneBitmask::getAll(); + } Register.setRegUnitLaneMasks(RegUnitLaneMasks); } }