[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Evan Cheng
evan.cheng at apple.com
Mon Oct 16 15:49:51 PDT 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.225 -> 1.226
---
Log message:
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.
---
Diffs of the changes: (+11 -2)
DAGCombiner.cpp | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.225 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.226
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.225 Mon Oct 16 15:52:31 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Oct 16 17:49:37 2006
@@ -3108,8 +3108,17 @@
// 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) {
More information about the llvm-commits
mailing list