[llvm] r245307 - [AArch64] Simplify the logic for computing in bounds offset. NFC.

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 09:20:03 PDT 2015


Author: mcrosier
Date: Tue Aug 18 11:20:03 2015
New Revision: 245307

URL: http://llvm.org/viewvc/llvm-project?rev=245307&view=rev
Log:
[AArch64] Simplify the logic for computing in bounds offset. 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=245307&r1=245306&r2=245307&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Tue Aug 18 11:20:03 2015
@@ -492,16 +492,12 @@ static void trackRegDefsUses(const Machi
 }
 
 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,




More information about the llvm-commits mailing list