mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-29 22:30:33 +00:00
Know some simple identities. This improves codegen for (1LL << N).
llvm-svn: 19698
This commit is contained in:
parent
6534e1ede3
commit
7114e8a527
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user