[llvm-commits] [llvm] r39823 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Dan Gohman
djg at cray.com
Fri Jul 13 13:03:40 PDT 2007
Author: djg
Date: Fri Jul 13 15:03:40 2007
New Revision: 39823
URL: http://llvm.org/viewvc/llvm-project?rev=39823&view=rev
Log:
Don't call SimplifyVBinOp for non-vector operations, following earlier review
feedback. This theoretically makes the common (scalar) case more efficient.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=39823&r1=39822&r2=39823&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Jul 13 15:03:40 2007
@@ -851,8 +851,10 @@
MVT::ValueType VT = N0.getValueType();
// fold vector ops
- SDOperand FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (MVT::isVector(VT)) {
+ SDOperand FoldedVOp = SimplifyVBinOp(N);
+ if (FoldedVOp.Val) return FoldedVOp;
+ }
// fold (add x, undef) -> undef
if (N0.getOpcode() == ISD::UNDEF)
@@ -1007,8 +1009,10 @@
MVT::ValueType VT = N0.getValueType();
// fold vector ops
- SDOperand FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (MVT::isVector(VT)) {
+ SDOperand FoldedVOp = SimplifyVBinOp(N);
+ if (FoldedVOp.Val) return FoldedVOp;
+ }
// fold (sub x, x) -> 0
if (N0 == N1)
@@ -1047,8 +1051,10 @@
MVT::ValueType VT = N0.getValueType();
// fold vector ops
- SDOperand FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (MVT::isVector(VT)) {
+ SDOperand FoldedVOp = SimplifyVBinOp(N);
+ if (FoldedVOp.Val) return FoldedVOp;
+ }
// fold (mul x, undef) -> 0
if (N0.getOpcode() == ISD::UNDEF || N1.getOpcode() == ISD::UNDEF)
@@ -1129,8 +1135,10 @@
MVT::ValueType VT = N->getValueType(0);
// fold vector ops
- SDOperand FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (MVT::isVector(VT)) {
+ SDOperand FoldedVOp = SimplifyVBinOp(N);
+ if (FoldedVOp.Val) return FoldedVOp;
+ }
// fold (sdiv c1, c2) -> c1/c2
if (N0C && N1C && !N1C->isNullValue())
@@ -1205,8 +1213,10 @@
MVT::ValueType VT = N->getValueType(0);
// fold vector ops
- SDOperand FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (MVT::isVector(VT)) {
+ SDOperand FoldedVOp = SimplifyVBinOp(N);
+ if (FoldedVOp.Val) return FoldedVOp;
+ }
// fold (udiv c1, c2) -> c1/c2
if (N0C && N1C && !N1C->isNullValue())
@@ -1416,8 +1426,10 @@
MVT::ValueType VT = N1.getValueType();
// fold vector ops
- SDOperand FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (MVT::isVector(VT)) {
+ SDOperand FoldedVOp = SimplifyVBinOp(N);
+ if (FoldedVOp.Val) return FoldedVOp;
+ }
// fold (and x, undef) -> 0
if (N0.getOpcode() == ISD::UNDEF || N1.getOpcode() == ISD::UNDEF)
@@ -1604,8 +1616,10 @@
unsigned OpSizeInBits = MVT::getSizeInBits(VT);
// fold vector ops
- SDOperand FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (MVT::isVector(VT)) {
+ SDOperand FoldedVOp = SimplifyVBinOp(N);
+ if (FoldedVOp.Val) return FoldedVOp;
+ }
// fold (or x, undef) -> -1
if (N0.getOpcode() == ISD::UNDEF || N1.getOpcode() == ISD::UNDEF)
@@ -1890,8 +1904,10 @@
MVT::ValueType VT = N0.getValueType();
// fold vector ops
- SDOperand FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (MVT::isVector(VT)) {
+ SDOperand FoldedVOp = SimplifyVBinOp(N);
+ if (FoldedVOp.Val) return FoldedVOp;
+ }
// fold (xor x, undef) -> undef
if (N0.getOpcode() == ISD::UNDEF)
@@ -3009,8 +3025,10 @@
MVT::ValueType VT = N->getValueType(0);
// fold vector ops
- SDOperand FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (MVT::isVector(VT)) {
+ SDOperand FoldedVOp = SimplifyVBinOp(N);
+ if (FoldedVOp.Val) return FoldedVOp;
+ }
// fold (fadd c1, c2) -> c1+c2
if (N0CFP && N1CFP)
@@ -3042,8 +3060,10 @@
MVT::ValueType VT = N->getValueType(0);
// fold vector ops
- SDOperand FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (MVT::isVector(VT)) {
+ SDOperand FoldedVOp = SimplifyVBinOp(N);
+ if (FoldedVOp.Val) return FoldedVOp;
+ }
// fold (fsub c1, c2) -> c1-c2
if (N0CFP && N1CFP)
@@ -3069,8 +3089,10 @@
MVT::ValueType VT = N->getValueType(0);
// fold vector ops
- SDOperand FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (MVT::isVector(VT)) {
+ SDOperand FoldedVOp = SimplifyVBinOp(N);
+ if (FoldedVOp.Val) return FoldedVOp;
+ }
// fold (fmul c1, c2) -> c1*c2
if (N0CFP && N1CFP)
@@ -3113,8 +3135,10 @@
MVT::ValueType VT = N->getValueType(0);
// fold vector ops
- SDOperand FoldedVOp = SimplifyVBinOp(N);
- if (FoldedVOp.Val) return FoldedVOp;
+ if (MVT::isVector(VT)) {
+ SDOperand FoldedVOp = SimplifyVBinOp(N);
+ if (FoldedVOp.Val) return FoldedVOp;
+ }
// fold (fdiv c1, c2) -> c1/c2
if (N0CFP && N1CFP)
@@ -4146,7 +4170,7 @@
if (AfterLegalize) return SDOperand();
MVT::ValueType VT = N->getValueType(0);
- if (!MVT::isVector(VT)) return SDOperand();
+ assert(MVT::isVector(VT) && "SimplifyVBinOp only works on vectors!");
MVT::ValueType EltType = MVT::getVectorElementType(VT);
SDOperand LHS = N->getOperand(0);
More information about the llvm-commits
mailing list