[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Oct 26 22:06:49 PDT 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.55 -> 1.56
---
Log message:
Add a simple xform that is useful for bitfield operations.
---
Diffs of the changes: (+9 -0)
DAGCombiner.cpp | 9 +++++++++
1 files changed, 9 insertions(+)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.55 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.56
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.55 Tue Oct 25 13:57:30 2005
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Oct 27 00:06:38 2005
@@ -1103,7 +1103,16 @@
if (N01C)
return DAG.getNode(ISD::OR, VT, N0.getOperand(0),
DAG.getConstant(N1C->getValue()|N01C->getValue(), VT));
+ } else if (N1C && N0.getOpcode() == ISD::AND && N0.Val->hasOneUse() &&
+ isa<ConstantSDNode>(N0.getOperand(1))) {
+ // Canonicalize (or (and X, c1), c2) -> (and (or X, c2), c1|c2)
+ ConstantSDNode *C1 = cast<ConstantSDNode>(N0.getOperand(1));
+ return DAG.getNode(ISD::AND, VT, DAG.getNode(ISD::OR, VT, N0.getOperand(0),
+ N1),
+ DAG.getConstant(N1C->getValue() | C1->getValue(), VT));
}
+
+
// fold (or (setcc x), (setcc y)) -> (setcc (or x, y))
if (isSetCCEquivalent(N0, LL, LR, CC0) && isSetCCEquivalent(N1, RL, RR, CC1)){
ISD::CondCode Op0 = cast<CondCodeSDNode>(CC0)->get();
More information about the llvm-commits
mailing list