Skip to content

Commit 3747ba4

Browse files
[SPIRV] Avoid repeated hash lookups (NFC) (llvm#128303)
1 parent 48bccee commit 3747ba4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/lib/Target/SPIRV/SPIRVDuplicatesTracker.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,22 +154,23 @@ template <typename KeyTy> class SPIRVDuplicatesTrackerBase {
154154
if (find(V, MF).isValid())
155155
return;
156156

157-
Storage[V][MF] = R;
157+
auto &S = Storage[V];
158+
S[MF] = R;
158159
if (std::is_same<Function,
159160
typename std::remove_const<
160161
typename std::remove_pointer<KeyTy>::type>::type>() ||
161162
std::is_same<Argument,
162163
typename std::remove_const<
163164
typename std::remove_pointer<KeyTy>::type>::type>())
164-
Storage[V].setIsFunc(true);
165+
S.setIsFunc(true);
165166
if (std::is_same<GlobalVariable,
166167
typename std::remove_const<
167168
typename std::remove_pointer<KeyTy>::type>::type>())
168-
Storage[V].setIsGV(true);
169+
S.setIsGV(true);
169170
if (std::is_same<Constant,
170171
typename std::remove_const<
171172
typename std::remove_pointer<KeyTy>::type>::type>())
172-
Storage[V].setIsConst(true);
173+
S.setIsConst(true);
173174
}
174175

175176
Register find(KeyTy V, const MachineFunction *MF) const {

0 commit comments

Comments
 (0)