[PATCH] Improve performance of vector code on A15

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Mar 8 13:54:38 PST 2013


On Mar 8, 2013, at 10:32 AM, Silviu Baranga <silbar01 at arm.com> wrote:

> I've applied most of Tim's comments so I'm attaching the new version of
> the patch. More tests would be good, but I still have to figure out a
> meaningful way of writing them.
> 
> The widened load has been changed from a vldr to an adr + vld1 (all lanes)
> sequence in order to avoid accessing invalid memory.

+  if (TargetRegisterInfo::isVirtualRegister(Reg))
+    return MRI->getRegClass(Reg)->hasSuperClassEq(TRC);
+  else
+    return ARM::SPRRegClass.contains(Reg);

Pasto.

+  MI->getParent()->insertAfter(MI, NewMI);
+  MI->getParent()->insertAfter(MI, AdrMI);

You should simply use the variant of BuildMI that also inserts the new instructions.

+        // Find the thing we're subreg copying out of - is it of the same
+        // regclass as DPRMI? (i.e. a DPR or QPR).
+        unsigned FullReg = SPRMI->getOperand(1).getReg();
+        if (MRI->getRegClass(MI->getOperand(1).getReg()) ==
+            MRI->getRegClass(FullReg)) {

It's usually not correct to compare register classes by identity. You had a hasSuperClassEq() call above, I think you could use something similar here.

+      if (MRI->getUniqueVRegDef(MI->getOperand(I).getReg())->isImplicitDef())

Don't assume getUniqueVRegDef() is non-null.

Also, use getVRegDef while in SSA form.

+  // The only way we can do a partial register update is through a COPY,
+  // INSERT_SUBREG or REG_SEQUENCE.
+  if (MI->isCopy() && usesRegClass(MI->getOperand(1), &ARM::SPRRegClass))
+    return true;

Wouldn't this also catch normal S-S copies? Are they not allowed?

+void A15SDOptimizer::elideCopiesAndPHIs(MachineInstr *MI,
+                                        SmallVector<MachineInstr*, 8> &Outs) {

Always use SmallVectorImpl for references.

+unsigned
+A15SDOptimizer::createRegSequence(unsigned Reg1, unsigned Reg2,
+                               MachineBasicBlock::iterator &InsertAfter) {

Please use the normal pattern of passing an iterator to insert *before*, and don't pass it by reference.

Many of these comments apply in multiple places. I only listed the first.

/jakob




More information about the llvm-commits mailing list