[llvm] r260272 - [AArch64] Add an assert to ensure we don't scale an offset that can't be scaled.

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


Author: mcrosier
Date: Tue Feb  9 14:18:07 2016
New Revision: 260272

URL: http://llvm.org/viewvc/llvm-project?rev=260272&view=rev
Log:
[AArch64] Add an assert to ensure we don't scale an offset that can't be scaled.

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=260272&r1=260271&r2=260272&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Tue Feb  9 14:18:07 2016
@@ -842,8 +842,10 @@ AArch64LoadStoreOpt::mergePairedInsns(Ma
   }
   int OffsetImm = getLdStOffsetOp(RtMI).getImm();
   // Handle Unscaled.
-  if (IsUnscaled)
+  if (IsUnscaled) {
+    assert (!(OffsetImm % OffsetStride) && "Unscaled offset cannot be scaled.");
     OffsetImm /= OffsetStride;
+  }
 
   // Construct the new instruction.
   MachineInstrBuilder MIB;




More information about the llvm-commits mailing list