[llvm-commits] [llvm] r112622 - /llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp

Jim Grosbach grosbach at apple.com
Tue Aug 31 11:49:31 PDT 2010


Author: grosbach
Date: Tue Aug 31 13:49:31 2010
New Revision: 112622

URL: http://llvm.org/viewvc/llvm-project?rev=112622&view=rev
Log:
this assert should just be a condition, since this function is just asking if
the offset is legally encodable, not actually trying to do the encoding.

Modified:
    llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=112622&r1=112621&r2=112622&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMBaseRegisterInfo.cpp Tue Aug 31 13:49:31 2010
@@ -1605,11 +1605,14 @@
   }
 
   Offset += getFrameIndexInstrOffset(MI, i);
-  assert((Offset & (Scale-1)) == 0 && "Can't encode this offset!");
+  // Make sure the offset is encodable for instructions that scale the
+  // immediate.
+  if ((Offset & (Scale-1)) != 0)
+    return false;
+
   if (isSigned && Offset < 0)
     Offset = -Offset;
 
-
   unsigned Mask = (1 << NumBits) - 1;
   if ((unsigned)Offset <= Mask * Scale)
     return true;





More information about the llvm-commits mailing list