Guard call to getRegForValue with isTypeLegal check to avoid unnecessary work/dead code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144959 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chad Rosier 2011-11-18 01:17:34 +00:00
parent ce35d8b5a1
commit 424fe0e422

View File

@ -2108,9 +2108,6 @@ bool ARMFastISel::SelectCall(const Instruction *I,
if (IntrMemName && e-i <= 2)
break;
unsigned Arg = getRegForValue(*i);
if (Arg == 0)
return false;
ISD::ArgFlagsTy Flags;
unsigned AttrInd = i - CS.arg_begin() + 1;
if (CS.paramHasAttr(AttrInd, Attribute::SExt))
@ -2130,6 +2127,11 @@ bool ARMFastISel::SelectCall(const Instruction *I,
if (!isTypeLegal(ArgTy, ArgVT) && ArgVT != MVT::i16 && ArgVT != MVT::i8 &&
ArgVT != MVT::i1)
return false;
unsigned Arg = getRegForValue(*i);
if (Arg == 0)
return false;
unsigned OriginalAlignment = TD.getABITypeAlignment(ArgTy);
Flags.setOrigAlign(OriginalAlignment);