[PATCH] D75993: [Target][ARM] Improvements to the VPT Block Insertion Pass
Pierre van Houtryve via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 24 05:21:02 PDT 2020
Pierre-vh marked 6 inline comments as done.
Pierre-vh added inline comments.
================
Comment at: llvm/lib/Target/ARM/MVEVPTBlockPass.cpp:134
+// Iter didn't point to a predicated instruction.
+static bool SkipPredicatedInstrs(MachineBasicBlock::instr_iterator &Iter,
+ MachineBasicBlock::instr_iterator EndIter,
----------------
dmgreen wrote:
> Pierre-vh wrote:
> > dmgreen wrote:
> > > Maybe name this "AddPredicatedInstruction", as we conceptually "adding" them to the block, as opposed to skipping them.
> > I named the function "Skip" because it advances the iterator (it skips the predicated instruction in front of the iterator), this function doesn't really "care" about the block as a whole, so for me calling it "AddPredicatedInstructions" doesn't make sense.
> Hmm. "Skip" implied to me that we would not end up doing anything with these instructions. Like we would skip instructions between VPT blocks that are not predicated. We just leave them alone.
>
> How about "StepOver" instead?
`StepOverPredicatedInstrs` is good I think. I'll change it.
================
Comment at: llvm/lib/Target/ARM/MVEVPTBlockPass.cpp:283-284
- LLVM_DEBUG(dbgs() << "VPT block created for: "; MI->dump());
- int VPTInstCnt = 1;
- ARMVCC::VPTCodes NextPred;
-
- // Look at subsequent instructions, checking if they can be in the same VPT
- // block.
- ++MBIter;
- while (MBIter != EndIter && VPTInstCnt < 4) {
- NextPred = getVPTInstrPredicate(*MBIter, PredReg);
- assert(NextPred != ARMVCC::Else &&
- "VPT block pass does not expect Else preds");
- if (NextPred != Pred)
- break;
- LLVM_DEBUG(dbgs() << " adding : "; MBIter->dump());
- ++VPTInstCnt;
- ++MBIter;
- };
-
- unsigned BlockMask = getARMVPTBlockMask(VPTInstCnt);
+ uint64_t BlockMask =
+ (uint64_t)CreateVPTBlock(MBIter, EndIter, DeadInstructions);
----------------
dmgreen wrote:
> Pierre-vh wrote:
> > dmgreen wrote:
> > > Why use a uint64_t?
> > It's the type of the argument of `addImm` below.
> > Of course I can also use `unsigned` if you prefer, or I can change this to `ARM::PredBlockMask` and convert to `uint64_t` when calling `addImm`.
> unsigned is probably fine, it will fit in either case. If the printing is still simple, PredBlockMask would probably be best. Up to you.
I'll do something like this then:
```
ARM::PredBlockMask BlockMask = CreateVPTBlock(MBIter, EndIter, DeadInstructions);
// ...
MIBuilder.addImm((uint64_t)BlockMask);
// ...
MIBuilder.addImm((uint64_t)BlockMask);
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75993/new/
https://reviews.llvm.org/D75993
More information about the llvm-commits
mailing list