[llvm] a8ae41f - [SelectionDAGBuilder] Save iterator to avoid second DenseMap lookup. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 10 22:38:16 PDT 2021
Author: Craig Topper
Date: 2021-08-10T22:37:48-07:00
New Revision: a8ae41fb518768fcc385b31fa1b16b20817cc1e7
URL: https://github.com/llvm/llvm-project/commit/a8ae41fb518768fcc385b31fa1b16b20817cc1e7
DIFF: https://github.com/llvm/llvm-project/commit/a8ae41fb518768fcc385b31fa1b16b20817cc1e7.diff
LOG: [SelectionDAGBuilder] Save iterator to avoid second DenseMap lookup. NFC
We were calling find and then using operator[]. Instead keep the
iterator from find and use it to get the value.
Just happened to notice while investigating how we decide what extends
to use between basic blocks.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 514b215eeb707..074ddaf4848a3 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -9873,10 +9873,10 @@ SelectionDAGBuilder::CopyValueToVirtualRegister(const Value *V, unsigned Reg) {
None); // This is not an ABI copy.
SDValue Chain = DAG.getEntryNode();
- ISD::NodeType ExtendType = (FuncInfo.PreferredExtendType.find(V) ==
- FuncInfo.PreferredExtendType.end())
- ? ISD::ANY_EXTEND
- : FuncInfo.PreferredExtendType[V];
+ ISD::NodeType ExtendType = ISD::ANY_EXTEND;
+ auto PreferredExtendIt = FuncInfo.PreferredExtendType.find(V);
+ if (PreferredExtendIt != FuncInfo.PreferredExtendType.end())
+ ExtendType = PreferredExtendIt->second;
RFV.getCopyToRegs(Op, DAG, getCurSDLoc(), Chain, nullptr, V, ExtendType);
PendingExports.push_back(Chain);
}
More information about the llvm-commits
mailing list