diff options
author | Quentin Colombet <qcolombet@apple.com> | 2014-02-22 01:06:41 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2014-02-22 01:06:41 +0000 |
commit | 1627a4159ea473e1cac14ad057b01d68daef5bb2 (patch) | |
tree | 33f44a4249d74d1958f9056a7827bd72eca78b55 /llvm/lib/CodeGen | |
parent | 438f8db6d52680c372de208b7c9d55d2a604385d (diff) | |
download | bcm5719-llvm-1627a4159ea473e1cac14ad057b01d68daef5bb2.tar.gz bcm5719-llvm-1627a4159ea473e1cac14ad057b01d68daef5bb2.zip |
[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>.
llvm-svn: 201923
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index e81a9098ef5..0c765b64313 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -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())); } |