Skip to content

Commit 71b7b1f

Browse files
[GlobalISel] Avoid repeated hash lookups (NFC) (#128461)
1 parent 4db54e9 commit 71b7b1f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

llvm/lib/CodeGen/GlobalISel/LegacyLegalizerInfo.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,17 +305,15 @@ LegacyLegalizerInfo::findScalarLegalAction(const InstrAspect &Aspect) const {
305305
if (Aspect.Opcode < FirstOp || Aspect.Opcode > LastOp)
306306
return {NotFound, LLT()};
307307
const unsigned OpcodeIdx = getOpcodeIdxForOpcode(Aspect.Opcode);
308+
ArrayRef<SizeAndActionsVec> Actions;
308309
if (Aspect.Type.isPointer()) {
309310
auto &PA = AddrSpace2PointerActions[OpcodeIdx];
310311
if (PA.find(Aspect.Type.getAddressSpace()) == PA.end())
311312
return {NotFound, LLT()};
313+
Actions = PA.find(Aspect.Type.getAddressSpace())->second;
314+
} else {
315+
Actions = ScalarActions[OpcodeIdx];
312316
}
313-
const SmallVector<SizeAndActionsVec, 1> &Actions =
314-
Aspect.Type.isPointer()
315-
? AddrSpace2PointerActions[OpcodeIdx]
316-
.find(Aspect.Type.getAddressSpace())
317-
->second
318-
: ScalarActions[OpcodeIdx];
319317
if (Aspect.Idx >= Actions.size())
320318
return {NotFound, LLT()};
321319
const SizeAndActionsVec &Vec = Actions[Aspect.Idx];

0 commit comments

Comments
 (0)