From 868d47300900bdbcaa2e166b4e9c411ac48a436e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 18 Apr 2005 04:11:19 +0000 Subject: Another simple xform llvm-svn: 21317 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'llvm/lib') diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 3058ceafe27..a52289fb387 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -964,6 +964,14 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, return getSetCC(Result, LHS->getValueType(0), LL, LR); } } + + // and/or zext(a), zext(b) -> zext(and/or a, b) + if (N1.getOpcode() == ISD::ZERO_EXTEND && + N2.getOpcode() == ISD::ZERO_EXTEND && + N1.getOperand(0).getValueType() == N2.getOperand(0).getValueType()) + return getNode(ISD::ZERO_EXTEND, VT, + getNode(Opcode, N1.getOperand(0).getValueType(), + N1.getOperand(0), N2.getOperand(0))); break; case ISD::XOR: if (N1 == N2) return getConstant(0, VT); // xor X, Y -> 0 -- cgit v1.2.3