|
|
97e156a |
From 85259e7305201764ae9d85a7cbf2809da779bf5c Mon Sep 17 00:00:00 2001
|
|
|
97e156a |
From: tstellar <tstellar@91177308-0d34-0410-b5e6-96231b3b80d8>
|
|
|
97e156a |
Date: Wed, 2 Jan 2013 22:13:01 +0000
|
|
|
97e156a |
Subject: [PATCH] DAGCombiner: Avoid generating illegal vector INT_TO_FP nodes
|
|
|
97e156a |
|
|
|
97e156a |
DAGCombiner::reduceBuildVecConvertToConvertBuildVec() was making two
|
|
|
97e156a |
mistakes:
|
|
|
97e156a |
|
|
|
97e156a |
1. It was checking the legality of scalar INT_TO_FP nodes and then generating
|
|
|
97e156a |
vector nodes.
|
|
|
97e156a |
|
|
|
97e156a |
2. It was passing the result value type to
|
|
|
97e156a |
TargetLoweringInfo::getOperationAction() when it should have been
|
|
|
97e156a |
passing the value type of the first operand.
|
|
|
97e156a |
|
|
|
97e156a |
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171420 91177308-0d34-0410-b5e6-96231b3b80d8
|
|
|
97e156a |
---
|
|
|
97e156a |
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 9 +++---
|
|
|
97e156a |
.../R600/dagcombiner-bug-illegal-vec4-int-to-fp.ll | 33 ++++++++++++++++++++++
|
|
|
97e156a |
test/CodeGen/R600/vec4-expand.ll | 3 --
|
|
|
97e156a |
test/CodeGen/X86/cvtv2f32.ll | 4 +++
|
|
|
97e156a |
4 files changed, 42 insertions(+), 7 deletions(-)
|
|
|
97e156a |
create mode 100644 test/CodeGen/R600/dagcombiner-bug-illegal-vec4-int-to-fp.ll
|
|
|
97e156a |
|
|
|
97e156a |
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
|
|
|
97e156a |
index 37d7731..d0ca5c0 100644
|
|
|
97e156a |
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
|
|
|
97e156a |
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
|
|
|
97e156a |
@@ -8514,11 +8514,8 @@ SDValue DAGCombiner::reduceBuildVecConvertToConvertBuildVec(SDNode *N) {
|
|
|
97e156a |
if (Opcode == ISD::DELETED_NODE &&
|
|
|
97e156a |
(Opc == ISD::UINT_TO_FP || Opc == ISD::SINT_TO_FP)) {
|
|
|
97e156a |
Opcode = Opc;
|
|
|
97e156a |
- // If not supported by target, bail out.
|
|
|
97e156a |
- if (TLI.getOperationAction(Opcode, VT) != TargetLowering::Legal &&
|
|
|
97e156a |
- TLI.getOperationAction(Opcode, VT) != TargetLowering::Custom)
|
|
|
97e156a |
- return SDValue();
|
|
|
97e156a |
}
|
|
|
97e156a |
+
|
|
|
97e156a |
if (Opc != Opcode)
|
|
|
97e156a |
return SDValue();
|
|
|
97e156a |
|
|
|
97e156a |
@@ -8543,6 +8540,10 @@ SDValue DAGCombiner::reduceBuildVecConvertToConvertBuildVec(SDNode *N) {
|
|
|
97e156a |
assert(SrcVT != MVT::Other && "Cannot determine source type!");
|
|
|
97e156a |
|
|
|
97e156a |
EVT NVT = EVT::getVectorVT(*DAG.getContext(), SrcVT, NumInScalars);
|
|
|
97e156a |
+
|
|
|
97e156a |
+ if (!TLI.isOperationLegalOrCustom(Opcode, NVT))
|
|
|
97e156a |
+ return SDValue();
|
|
|
97e156a |
+
|
|
|
97e156a |
SmallVector<SDValue, 8> Opnds;
|
|
|
97e156a |
for (unsigned i = 0; i != NumInScalars; ++i) {
|
|
|
97e156a |
SDValue In = N->getOperand(i);
|
|
|
97e156a |
|