diff --git a/llvm/lib/CodeGen/DetectDeadLanes.cpp b/llvm/lib/CodeGen/DetectDeadLanes.cpp --- a/llvm/lib/CodeGen/DetectDeadLanes.cpp +++ b/llvm/lib/CodeGen/DetectDeadLanes.cpp @@ -340,8 +340,8 @@ llvm_unreachable("function must be called with COPY-like instruction"); } - assert(Def.getSubReg() == 0 && - "Should not have subregister defs in machine SSA phase"); + unsigned SubIdx = Def.getSubReg(); + DefinedLanes = TRI->composeSubRegIndexLaneMask(SubIdx, DefinedLanes); DefinedLanes &= MRI->getMaxLaneMaskForVReg(Def.getReg()); return DefinedLanes; } @@ -406,9 +406,9 @@ if (DefMI.isImplicitDef() || Def.isDead()) return LaneBitmask::getNone(); - assert(Def.getSubReg() == 0 && - "Should not have subregister defs in machine SSA phase"); - return MRI->getMaxLaneMaskForVReg(Reg); + unsigned SubReg = Def.getSubReg(); + return SubReg != 0 ? TRI->getSubRegIndexLaneMask(SubReg) + : MRI->getMaxLaneMaskForVReg(Reg); } LaneBitmask DetectDeadLanes::determineInitialUsedLanes(unsigned Reg) {