Teach ARM isLegalAddressingMode to handle unknown type without crashing. This fixes pr2589.

llvm-svn: 54004
This commit is contained in:
Evan Cheng 2008-07-25 00:55:17 +00:00
parent 2a343479f2
commit c90a11256e
2 changed files with 10 additions and 1 deletions

View File

@ -1598,7 +1598,7 @@ 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), Subtarget))
if (!isLegalAddressImmediate(AM.BaseOffs, getValueType(Ty, true), Subtarget))
return false;
// Can never fold addr of global into load/store.

View File

@ -0,0 +1,9 @@
; RUN: llvm-as < %s | llc -march=arm
; PR2589
define void @main({ i32 }*) {
entry:
%sret1 = alloca { i32 } ; <{ i32 }*> [#uses=1]
load { i32 }* %sret1 ; <{ i32 }>:1 [#uses=0]
ret void
}