[llvm-dev] Bundling MachineInstr instructions before register allocation seems to always give errors

Alex Susu via llvm-dev llvm-dev at lists.llvm.org
Thu Feb 23 06:45:05 PST 2017

     I am having difficulties to bundle MachineInstr instructions, before register 
allocation (RA).
     More exactly, I registered a simple pass in addPreRegAlloc() that is trying to create 

     I see that it is written at http://llvm.org/docs/CodeGenerator.html#machineinstr-bundles:
       <<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.>>

     I presume this is the reason why I'm getting always errors after creating bundles in 
the pass registered in addPreRegAlloc().
     More exactly, my pass seems to be invoked before the "Eliminate PHI nodes for 
register allocation" pass.

     If however, there is a simple possibility to bundle MachineInstr before RA, please 
let me know.

   Thank you,

PS: Is there a possibility to bundle MachineInstr instructions before RA and use 
llvm::finalizeBundle() on these bundles in a pass invoked after RA?

More information about the llvm-dev mailing list