[AArch64] Simplify the logic for computing in bounds offset. NFC.
authorChad Rosier <mcrosier@codeaurora.org>
Tue, 18 Aug 2015 16:20:03 +0000 (16:20 +0000)
committerChad Rosier <mcrosier@codeaurora.org>
Tue, 18 Aug 2015 16:20:03 +0000 (16:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245307 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp

index b84eb36dc229c092bd55a53a5389bd6540e05189..b67d2e2acf9c0122bfd2bcebcfc21eaf80abb517 100644 (file)
@@ -492,16 +492,12 @@ static void trackRegDefsUses(const MachineInstr *MI, BitVector &ModifiedRegs,
 }
 
 static bool inBoundsForPair(bool IsUnscaled, int Offset, int OffsetStride) {
-  if (!IsUnscaled && (Offset > 63 || Offset < -64))
-    return false;
-  if (IsUnscaled) {
-    // Convert the byte-offset used by unscaled into an "element" offset used
-    // by the scaled pair load/store instructions.
-    int ElemOffset = Offset / OffsetStride;
-    if (ElemOffset > 63 || ElemOffset < -64)
-      return false;
-  }
-  return true;
+  // Convert the byte-offset used by unscaled into an "element" offset used
+  // by the scaled pair load/store instructions.
+  if (IsUnscaled)
+    Offset /= OffsetStride;
+
+  return Offset <= 63 && Offset >= -64;
 }
 
 // Do alignment, specialized to power of 2 and for signed ints,