[CodeGenPrepare] Fix the check of the legality of an instruction.

The API expects an ISD opcode, not an IR opcode.
Fixes a regression for R600.

Related to <rdar://problem/15519855>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201923 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Quentin Colombet
2014-02-22 01:06:41 +00:00
parent c94f3ae027
commit a6e734d2ed
2 changed files with 13 additions and 5 deletions
+6 -1
View File
@@ -1756,7 +1756,12 @@ AddressingModeMatcher::IsPromotionProfitable(unsigned MatchedSize,
Instruction *PromotedInst = dyn_cast<Instruction>(PromotedOperand);
if (!PromotedInst)
return false;
return TLI.isOperationLegalOrCustom(PromotedInst->getOpcode(),
int ISDOpcode = TLI.InstructionOpcodeToISD(PromotedInst->getOpcode());
// If the ISDOpcode is undefined, it was undefined before the promotion.
if (!ISDOpcode)
return true;
// Otherwise, check if the promoted instruction is legal or not.
return TLI.isOperationLegalOrCustom(ISDOpcode,
EVT::getEVT(PromotedInst->getType()));
}