From d3f64274462e500724ae2df9d7b590094eff87b4 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sat, 13 Jun 2015 16:25:12 +0000 Subject: [DAGCombiner] Added BSWAP(BSWAP(x)) -> x combine pattern. llvm-svn: 239682 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/CodeGen') diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 1e33f1ed10f..33f5f52332a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -4773,6 +4773,9 @@ SDValue DAGCombiner::visitBSWAP(SDNode *N) { // fold (bswap c1) -> c2 if (isConstantIntBuildVectorOrConstantInt(N0)) return DAG.getNode(ISD::BSWAP, SDLoc(N), VT, N0); + // fold (bswap (bswap x)) -> x + if (N0.getOpcode() == ISD::BSWAP) + return N0->getOperand(0); return SDValue(); } -- cgit v1.2.3