[llvm] r260257 - [AArch64] Hoist now common logic. NFC.

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 11:17:18 PST 2016


Author: mcrosier
Date: Tue Feb  9 13:17:18 2016
New Revision: 260257

URL: http://llvm.org/viewvc/llvm-project?rev=260257&view=rev
Log:
[AArch64] Hoist now common logic. NFC.

Modified:
    llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp

Modified: llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp?rev=260257&r1=260256&r2=260257&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Tue Feb  9 13:17:18 2016
@@ -650,8 +650,8 @@ AArch64LoadStoreOpt::mergeNarrowInsns(Ma
     ++NextI;
 
   unsigned Opc = I->getOpcode();
-  bool IsUnscaled = isUnscaledLdSt(Opc);
-  int OffsetStride = IsUnscaled ? getMemScale(I) : 1;
+  bool IsScaled = !isUnscaledLdSt(Opc);
+  int OffsetStride = IsScaled ? 1 : getMemScale(I);
 
   bool MergeForward = Flags.getMergeForward();
   // Insert our new paired instruction after whichever of the paired
@@ -674,12 +674,13 @@ AArch64LoadStoreOpt::mergeNarrowInsns(Ma
   }
 
   int OffsetImm = getLdStOffsetOp(RtMI).getImm();
+  // Change the scaled offset from small to large type.
+  if (IsScaled) {
+    assert(((OffsetImm & 1) == 0) && "Unexpected offset to merge");
+    OffsetImm /= 2;
+  }
+
   if (isNarrowLoad(Opc)) {
-    // Change the scaled offset from small to large type.
-    if (!IsUnscaled) {
-      assert(((OffsetImm & 1) == 0) && "Unexpected offset to merge");
-      OffsetImm /= 2;
-    }
     MachineInstr *RtNewDest = MergeForward ? I : MergeMI;
     // When merging small (< 32 bit) loads for big-endian targets, the order of
     // the component parts gets swapped.
@@ -770,15 +771,10 @@ AArch64LoadStoreOpt::mergeNarrowInsns(Ma
     MergeMI->eraseFromParent();
     return NextI;
   }
+  assert(isNarrowStore(Opc) && "Expected narrow store");
 
   // Construct the new instruction.
   MachineInstrBuilder MIB;
-  assert(isNarrowStore(Opc) && "Expected narrow store");
-  // Change the scaled offset from small to large type.
-  if (!IsUnscaled) {
-    assert(((OffsetImm & 1) == 0) && "Unexpected offset to merge");
-    OffsetImm /= 2;
-  }
   MIB = BuildMI(*I->getParent(), InsertionPoint, I->getDebugLoc(),
                 TII->get(getMatchingWideOpcode(Opc)))
             .addOperand(getLdStRegOp(I))




More information about the llvm-commits mailing list