Alex Susu via llvm-dev
2017-Feb-23 14:45 UTC
[llvm-dev] Bundling MachineInstr instructions before register allocation seems to always give errors
Hello. 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 bundles. 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, Alex PS: Is there a possibility to bundle MachineInstr instructions before RA and use llvm::finalizeBundle() on these bundles in a pass invoked after RA?
Matthias Braun via llvm-dev
2017-Feb-24 04:09 UTC
[llvm-dev] Bundling MachineInstr instructions before register allocation seems to always give errors
In theory it should be possible. In practice you will run into issues because nobody is really doing that right now so some things like liveness updates are semi-broken. I am currently working on some patches myself for bundling some things pre-ra myself. I should put up some fixes for the infrastructure soon(ish). - Matthias> On Feb 23, 2017, at 6:45 AM, Alex Susu via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hello. > 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 bundles. > > 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, > Alex > > PS: Is there a possibility to bundle MachineInstr instructions before RA and use llvm::finalizeBundle() on these bundles in a pass invoked after RA? > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Alex Susu via llvm-dev
2018-Aug-11 12:06 UTC
[llvm-dev] Bundling MachineInstr instructions before register allocation seems to always give errors
Hello. I come back to this more than 1 year old topic on bundles. I need to create bundles before register allocation to avoid generating COPY instructions in the bundle. Is now the bundles API more reliable - were the patches for pre-ra support discussed below made mainstream? I ask because, as already discussed, the solution to avoid generating COPY instructions, etc in a block of MachineInstr is to bundle them - this was discussed also at http://lists.llvm.org/pipermail/llvm-dev/2016-October/106553.html ("spills, reloads, splits or further scheduling sneaking instruction in between"). Thank you, Alex On 2/24/2017 6:09 AM, Matthias Braun wrote:> In theory it should be possible. In practice you will run into issues because nobody is > really doing that right now so some things like liveness updates are semi-broken. I am > currently working on some patches myself for bundling some things pre-ra myself. I > should put up some fixes for the infrastructure soon(ish). > > - Matthias > >> On Feb 23, 2017, at 6:45 AM, Alex Susu via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> Hello. 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 bundles. >> >> 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, Alex >> >> PS: Is there a possibility to bundle MachineInstr instructions before RA and use >> llvm::finalizeBundle() on these bundles in a pass invoked after RA? >> _______________________________________________ LLVM Developers mailing list >> llvm-dev at lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >
Possibly Parallel Threads
- Understanding and Cleaning Up Machine Instruction Bundles
- Understanding and Cleaning Up Machine Instruction Bundles
- [LLVMdev] basic block missing after MachineInstr packetizing
- Enforcing in post-RA scheduling to keep (two) MachineInstrs together
- Understanding and Cleaning Up Machine Instruction Bundles