Skip to content

Commit 4230858

Browse files
[ARM] Avoid repeated map lookups (NFC) (#131420)
1 parent f83726e commit 4230858

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

llvm/lib/Target/ARM/ARMParallelDSP.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -715,10 +715,14 @@ void ARMParallelDSP::InsertParallelMACs(Reduction &R) {
715715
MulCandidate *RHSMul = Pair.second;
716716
LoadInst *BaseLHS = LHSMul->getBaseLoad();
717717
LoadInst *BaseRHS = RHSMul->getBaseLoad();
718-
LoadInst *WideLHS = WideLoads.count(BaseLHS) ?
719-
WideLoads[BaseLHS]->getLoad() : CreateWideLoad(LHSMul->VecLd, Ty);
720-
LoadInst *WideRHS = WideLoads.count(BaseRHS) ?
721-
WideLoads[BaseRHS]->getLoad() : CreateWideLoad(RHSMul->VecLd, Ty);
718+
auto LIt = WideLoads.find(BaseLHS);
719+
LoadInst *WideLHS = LIt != WideLoads.end()
720+
? LIt->second->getLoad()
721+
: CreateWideLoad(LHSMul->VecLd, Ty);
722+
auto RIt = WideLoads.find(BaseRHS);
723+
LoadInst *WideRHS = RIt != WideLoads.end()
724+
? RIt->second->getLoad()
725+
: CreateWideLoad(RHSMul->VecLd, Ty);
722726

723727
Instruction *InsertAfter = GetInsertPoint(WideLHS, WideRHS);
724728
InsertAfter = GetInsertPoint(InsertAfter, Acc);

0 commit comments

Comments
 (0)