@@ -128,13 +128,16 @@ static std::optional<unsigned> findOneNVVMAnnotation(const GlobalValue *gv,
128128 auto &AC = getAnnotationCache ();
129129 std::lock_guard<sys::Mutex> Guard (AC.Lock );
130130 const Module *m = gv->getParent ();
131- if (AC.Cache .find (m) == AC.Cache .end ())
131+ auto ACIt = AC.Cache .find (m);
132+ if (ACIt == AC.Cache .end ())
132133 cacheAnnotationFromMD (m, gv);
133- else if (AC. Cache [m]. find (gv) == AC. Cache [m] .end ())
134+ else if (ACIt-> second . find (gv) == ACIt-> second .end ())
134135 cacheAnnotationFromMD (m, gv);
135- if (AC.Cache [m][gv].find (prop) == AC.Cache [m][gv].end ())
136+ auto &KVP = AC.Cache [m][gv];
137+ auto It = KVP.find (prop);
138+ if (It == KVP.end ())
136139 return std::nullopt ;
137- return AC. Cache [m][gv][prop] [0 ];
140+ return It-> second [0 ];
138141}
139142
140143static bool findAllNVVMAnnotation (const GlobalValue *gv,
@@ -143,13 +146,16 @@ static bool findAllNVVMAnnotation(const GlobalValue *gv,
143146 auto &AC = getAnnotationCache ();
144147 std::lock_guard<sys::Mutex> Guard (AC.Lock );
145148 const Module *m = gv->getParent ();
146- if (AC.Cache .find (m) == AC.Cache .end ())
149+ auto ACIt = AC.Cache .find (m);
150+ if (ACIt == AC.Cache .end ())
147151 cacheAnnotationFromMD (m, gv);
148- else if (AC. Cache [m]. find (gv) == AC. Cache [m] .end ())
152+ else if (ACIt-> second . find (gv) == ACIt-> second .end ())
149153 cacheAnnotationFromMD (m, gv);
150- if (AC.Cache [m][gv].find (prop) == AC.Cache [m][gv].end ())
154+ auto &KVP = AC.Cache [m][gv];
155+ auto It = KVP.find (prop);
156+ if (It == KVP.end ())
151157 return false ;
152- retval = AC. Cache [m][gv][prop] ;
158+ retval = It-> second ;
153159 return true ;
154160}
155161
0 commit comments