Silly bug fix: Machine code vector could be empty for a no-op cast instruction,

e.g., cast double to double.

llvm-svn: 3633
This commit is contained in:
Vikram S. Adve 2002-09-09 14:54:21 +00:00
parent e40840b26b
commit d50fb11d18
1 changed files with 9 additions and 5 deletions

View File

@ -1562,12 +1562,16 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
// In the future, we'll want to do the same for the FdMULq instruction,
// so do the check here instead of only for ToFloatTy(reg).
//
if (subtreeRoot->parent() != NULL &&
MachineCodeForInstruction::get(((InstructionNode*)subtreeRoot->parent())->getInstruction())[0]->getOpCode() == FSMULD)
if (subtreeRoot->parent() != NULL)
{
const MachineCodeForInstruction& mcfi =
MachineCodeForInstruction::get(
cast<InstructionNode>(subtreeRoot->parent())->getInstruction());
if (mcfi.size() == 0 || mcfi.front()->getOpCode() == FSMULD)
forwardOperandNum = 0; // forward first operand to user
}
else
if (forwardOperandNum != 0) // we do need the cast
{
Value* leftVal = subtreeRoot->leftChild()->getValue();
const Type* opType = leftVal->getType();