diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-10-16 22:49:37 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-10-16 22:49:37 +0000 |
commit | f3ae00a64a1e55f5f9078c137979896175792913 (patch) | |
tree | e2fbf5ab4a0eff6705c9eb5ab6f40184ecc07ddb /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | afdd47ace4055cff4ad0ac4670455bc211c065c2 (diff) | |
download | bcm5719-llvm-f3ae00a64a1e55f5f9078c137979896175792913.tar.gz bcm5719-llvm-f3ae00a64a1e55f5f9078c137979896175792913.zip |
Be careful when looking through a vbit_convert. Optimizing this:
(vector_shuffle
(vbitconvert (vbuildvector (copyfromreg v4f32), 1, v4f32), 4, f32),
(undef, undef, undef, undef), (0, 0, 0, 0), 4, f32)
to the
vbitconvert
is a very bad idea.
llvm-svn: 30989
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index ba90e23b04e..a27adba33b0 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -3108,8 +3108,17 @@ SDOperand DAGCombiner::visitVVECTOR_SHUFFLE(SDNode *N) { // all scalar elements the same. if (isSplat) { SDNode *V = N0.Val; - if (V->getOpcode() == ISD::VBIT_CONVERT) - V = V->getOperand(0).Val; + + // If this is a vbit convert that changes the element type of the vector but + // not the number of vector elements, look through it. Be careful not to + // look though conversions that change things like v4f32 to v2f64. + if (V->getOpcode() == ISD::VBIT_CONVERT) { + SDOperand ConvInput = V->getOperand(0); + if (NumElts == + ConvInput.getConstantOperandVal(ConvInput.getNumOperands()-2)) + V = ConvInput.Val; + } + if (V->getOpcode() == ISD::VBUILD_VECTOR) { unsigned NumElems = V->getNumOperands()-2; if (NumElems > BaseIdx) { |