Know some simple identities. This improves codegen for (1LL << N).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19698 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-01-19 17:29:49 +00:00
parent c3c021bcad
commit 88218ef706

View File

@ -615,6 +615,19 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
std::swap(N1, N2);
}
}
switch (Opcode) {
default: break;
case ISD::SHL: // shl 0, X -> 0
if (N1C->isNullValue()) return N1;
break;
case ISD::SRL: // srl 0, X -> 0
if (N1C->isNullValue()) return N1;
break;
case ISD::SRA: // sra -1, X -> -1
if (N1C->isAllOnesValue()) return N1;
break;
}
}
if (N2C) {