diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-01-19 17:29:49 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-01-19 17:29:49 +0000 |
| commit | 32a5f02598a815b3add3a8e42fb58504201d0b5d (patch) | |
| tree | e226089241078be5fe1c55fd54d8b26b476b7c3f /llvm/lib/CodeGen/SelectionDAG | |
| parent | 474aac4da92875cb2826b6654b90821b10ebf65b (diff) | |
| download | bcm5719-llvm-32a5f02598a815b3add3a8e42fb58504201d0b5d.tar.gz bcm5719-llvm-32a5f02598a815b3add3a8e42fb58504201d0b5d.zip | |
Know some simple identities. This improves codegen for (1LL << N).
llvm-svn: 19698
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 3da2f5fe7ab..3b106d192d1 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -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) { |

