diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-01-16 13:39:00 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-01-16 13:39:00 +0000 |
commit | db73dbcc7cfd6f7b7692027de785b8f428dc8ef2 (patch) | |
tree | fa399c4af5c08c6b026d185158b2a59f5851d057 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | eb9dd5aec88393c63e57eaec209546d42f7a3f97 (diff) | |
download | bcm5719-llvm-db73dbcc7cfd6f7b7692027de785b8f428dc8ef2.tar.gz bcm5719-llvm-db73dbcc7cfd6f7b7692027de785b8f428dc8ef2.zip |
[SelectionDAG] Add support for BITREVERSE constant folding
We were relying on constant folding of the legalized instructions to do what constant folding we had previously
llvm-svn: 292114
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index fb64fa3667f..dad94c58ce9 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -5217,7 +5217,11 @@ SDValue DAGCombiner::visitBSWAP(SDNode *N) { SDValue DAGCombiner::visitBITREVERSE(SDNode *N) { SDValue N0 = N->getOperand(0); + EVT VT = N->getValueType(0); + // fold (bitreverse c1) -> c2 + if (DAG.isConstantIntBuildVectorOrConstantInt(N0)) + return DAG.getNode(ISD::BITREVERSE, SDLoc(N), VT, N0); // fold (bitreverse (bitreverse x)) -> x if (N0.getOpcode() == ISD::BITREVERSE) return N0.getOperand(0); |