summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2014-02-22 01:06:41 +0000
committerQuentin Colombet <qcolombet@apple.com>2014-02-22 01:06:41 +0000
commita6e734d2ed962c914005e9a5fe8a14fbc9707884 (patch)
tree506758f9d42a7cd52bcdd17f3c36e782ab228066 /lib/CodeGen/CodeGenPrepare.cpp
parentc94f3ae0278dc781cd60051790bf8a8003a13873 (diff)
downloadllvm-a6e734d2ed962c914005e9a5fe8a14fbc9707884.tar.gz
llvm-a6e734d2ed962c914005e9a5fe8a14fbc9707884.tar.bz2
llvm-a6e734d2ed962c914005e9a5fe8a14fbc9707884.tar.xz
[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
Diffstat (limited to 'lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--lib/CodeGen/CodeGenPrepare.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenPrepare.cpp b/lib/CodeGen/CodeGenPrepare.cpp
index e81a9098ef..0c765b6431 100644
--- a/lib/CodeGen/CodeGenPrepare.cpp
+++ b/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()));
}