Fix PR3795: Apply Dan's suggested fix for
authorBob Wilson <bob.wilson@apple.com>
Wed, 8 Apr 2009 17:55:28 +0000 (17:55 +0000)
committerBob Wilson <bob.wilson@apple.com>
Wed, 8 Apr 2009 17:55:28 +0000 (17:55 +0000)
ARMTargetLowering::isLegalAddressingMode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68619 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMISelLowering.cpp

index 79a75863487f628fc471c007c334cad2183835c5..d018796a4b4866f14ec8f74b24ef7f84b3c6b706 100644 (file)
@@ -1759,7 +1759,8 @@ static bool isLegalAddressImmediate(int64_t V, MVT VT,
 /// by AM is legal for this target, for a load/store of the specified type.
 bool ARMTargetLowering::isLegalAddressingMode(const AddrMode &AM,
                                               const Type *Ty) const {
-  if (!isLegalAddressImmediate(AM.BaseOffs, getValueType(Ty, true), Subtarget))
+  MVT VT = getValueType(Ty, true);
+  if (!isLegalAddressImmediate(AM.BaseOffs, VT, Subtarget))
     return false;
 
   // Can never fold addr of global into load/store.
@@ -1778,8 +1779,11 @@ bool ARMTargetLowering::isLegalAddressingMode(const AddrMode &AM,
     if (AM.BaseOffs)
       return false;
 
+    if (!VT.isSimple())
+      return false;
+
     int Scale = AM.Scale;
-    switch (getValueType(Ty).getSimpleVT()) {
+    switch (VT.getSimpleVT()) {
     default: return false;
     case MVT::i1:
     case MVT::i8: