Index: docs/CodeGenerator.rst =================================================================== --- docs/CodeGenerator.rst +++ docs/CodeGenerator.rst @@ -579,15 +579,18 @@ register MachineOperand's that represent the cumulative inputs and outputs of the bundled MIs. -Packing / bundling of MachineInstr's should be done as part of the register -allocation super-pass. More specifically, the pass which determines what MIs -should be bundled together must be done after code generator exits SSA form -(i.e. after two-address pass, PHI elimination, and copy coalescing). Bundles -should only be finalized (i.e. adding BUNDLE MIs and input and output register -MachineOperands) after virtual registers have been rewritten into physical -registers. This requirement eliminates the need to add virtual register operands -to BUNDLE instructions which would effectively double the virtual register def -and use lists. +Packing / bundling of MachineInstrs for VLIW architectures should +generally be done as part of the register allocation super-pass. More +specifically, the pass which determines what MIs should be bundled +together should be done after code generator exits SSA form +(i.e. after two-address pass, PHI elimination, and copy coalescing). +Such bundles should be finalized (i.e. adding BUNDLE MIs and input and +output register MachineOperands) after virtual registers have been +rewritten into physical registers. This eliminates the need to add +virtual register operands to BUNDLE instructions which would +effectively double the virtual register def and use lists. Bundles may +use virtual registers and be formed in SSA form, but may not be +appropriate for all use cases. .. _MC Layer: Index: lib/CodeGen/MachineInstrBundle.cpp =================================================================== --- lib/CodeGen/MachineInstrBundle.cpp +++ lib/CodeGen/MachineInstrBundle.cpp @@ -157,7 +157,7 @@ unsigned Reg = MO.getReg(); if (!Reg) continue; - assert(TargetRegisterInfo::isPhysicalRegister(Reg)); + if (LocalDefSet.count(Reg)) { MO.setIsInternalRead(); if (MO.isKill()) @@ -194,7 +194,7 @@ DeadDefSet.erase(Reg); } - if (!MO.isDead()) { + if (!MO.isDead() && TargetRegisterInfo::isPhysicalRegister(Reg)) { for (MCSubRegIterator SubRegs(Reg, TRI); SubRegs.isValid(); ++SubRegs) { unsigned SubReg = *SubRegs; if (LocalDefSet.insert(SubReg).second)