Skip to content

Commit a8ae41f

Browse files
committed
[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.
1 parent 510402c commit a8ae41f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9873,10 +9873,10 @@ SelectionDAGBuilder::CopyValueToVirtualRegister(const Value *V, unsigned Reg) {
98739873
None); // This is not an ABI copy.
98749874
SDValue Chain = DAG.getEntryNode();
98759875

9876-
ISD::NodeType ExtendType = (FuncInfo.PreferredExtendType.find(V) ==
9877-
FuncInfo.PreferredExtendType.end())
9878-
? ISD::ANY_EXTEND
9879-
: FuncInfo.PreferredExtendType[V];
9876+
ISD::NodeType ExtendType = ISD::ANY_EXTEND;
9877+
auto PreferredExtendIt = FuncInfo.PreferredExtendType.find(V);
9878+
if (PreferredExtendIt != FuncInfo.PreferredExtendType.end())
9879+
ExtendType = PreferredExtendIt->second;
98809880
RFV.getCopyToRegs(Op, DAG, getCurSDLoc(), Chain, nullptr, V, ExtendType);
98819881
PendingExports.push_back(Chain);
98829882
}

0 commit comments

Comments
 (0)