Skip to content

Commit 7a0d8c6

Browse files
committed
Do type checks before we bother to do everything else.
llvm-svn: 112039
1 parent aab3e41 commit 7a0d8c6

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

llvm/lib/Target/ARM/ARMFastISel.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -415,14 +415,19 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg,
415415
}
416416

417417
bool ARMFastISel::ARMSelectLoad(const Instruction *I) {
418-
// Our register and offset with innocuous defaults.
419-
unsigned Reg = 0;
420-
int Offset = 0;
421-
422418
// If we're an alloca we know we have a frame index and can emit the load
423419
// directly in short order.
424420
if (ARMLoadAlloca(I))
425421
return true;
422+
423+
// Verify we have a legal type before going any further.
424+
EVT VT;
425+
if (!isTypeLegal(I->getType(), VT))
426+
return false;
427+
428+
// Our register and offset with innocuous defaults.
429+
unsigned Reg = 0;
430+
int Offset = 0;
426431

427432
// See if we can handle this as Reg + Offset
428433
if (!ARMComputeRegOffset(I->getOperand(0), Reg, Offset))
@@ -445,10 +450,6 @@ bool ARMFastISel::ARMSelectLoad(const Instruction *I) {
445450
static_cast<const ARMBaseInstrInfo&>(TII));
446451
}
447452

448-
EVT VT;
449-
if (!isTypeLegal(I->getType(), VT))
450-
return false;
451-
452453
unsigned ResultReg;
453454
// TODO: Verify the additions above work, otherwise we'll need to add the
454455
// offset instead of 0 and do all sorts of operand munging.

0 commit comments

Comments
 (0)