[llvm] 46f1e83 - [DAG] visitBSWAP - pull out repeated SDLoc. NFC
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 21 05:08:22 PST 2022
Author: Simon Pilgrim
Date: 2022-02-21T13:08:01Z
New Revision: 46f1e8359eb43c5510c0515ed05bbf7c76b82f89
URL: https://github.com/llvm/llvm-project/commit/46f1e8359eb43c5510c0515ed05bbf7c76b82f89
DIFF: https://github.com/llvm/llvm-project/commit/46f1e8359eb43c5510c0515ed05bbf7c76b82f89.diff
LOG: [DAG] visitBSWAP - pull out repeated SDLoc. NFC
Cleanup for D120192
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 52a0330e1473c..3196ba9f7689d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -9570,20 +9570,20 @@ SDValue DAGCombiner::visitABS(SDNode *N) {
SDValue DAGCombiner::visitBSWAP(SDNode *N) {
SDValue N0 = N->getOperand(0);
EVT VT = N->getValueType(0);
+ SDLoc DL(N);
// fold (bswap c1) -> c2
if (DAG.isConstantIntBuildVectorOrConstantInt(N0))
- return DAG.getNode(ISD::BSWAP, SDLoc(N), VT, N0);
+ return DAG.getNode(ISD::BSWAP, DL, VT, N0);
// fold (bswap (bswap x)) -> x
if (N0.getOpcode() == ISD::BSWAP)
- return N0->getOperand(0);
+ return N0.getOperand(0);
// Canonicalize bswap(bitreverse(x)) -> bitreverse(bswap(x)). If bitreverse
// isn't supported, it will be expanded to bswap followed by a manual reversal
// of bits in each byte. By placing bswaps before bitreverse, we can remove
// the two bswaps if the bitreverse gets expanded.
if (N0.getOpcode() == ISD::BITREVERSE && N0.hasOneUse()) {
- SDLoc DL(N);
SDValue BSwap = DAG.getNode(ISD::BSWAP, DL, VT, N0.getOperand(0));
return DAG.getNode(ISD::BITREVERSE, DL, VT, BSwap);
}
More information about the llvm-commits
mailing list