MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / CompareAndPrintDifferences

Function CompareAndPrintDifferences

source/opt/def_use_manager.cpp:262–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262bool CompareAndPrintDifferences(const DefUseManager& lhs,
263 const DefUseManager& rhs) {
264 bool same = true;
265
266 if (lhs.id_to_def_ != rhs.id_to_def_) {
267 for (auto p : lhs.id_to_def_) {
268 if (rhs.id_to_def_.find(p.first) == rhs.id_to_def_.end()) {
269 printf("Diff in id_to_def: missing value in rhs\n");
270 }
271 }
272 for (auto p : rhs.id_to_def_) {
273 if (lhs.id_to_def_.find(p.first) == lhs.id_to_def_.end()) {
274 printf("Diff in id_to_def: missing value in lhs\n");
275 }
276 }
277 same = false;
278 }
279
280 if (lhs.id_to_users_ != rhs.id_to_users_) {
281 for (auto p : lhs.id_to_users_) {
282 if (rhs.id_to_users_.count(p) == 0) {
283 printf("Diff in id_to_users: missing value in rhs\n");
284 }
285 }
286 for (auto p : rhs.id_to_users_) {
287 if (lhs.id_to_users_.count(p) == 0) {
288 printf("Diff in id_to_users: missing value in lhs\n");
289 }
290 }
291 same = false;
292 }
293
294 if (lhs.inst_to_used_ids_ != rhs.inst_to_used_ids_) {
295 for (auto p : lhs.inst_to_used_ids_) {
296 if (rhs.inst_to_used_ids_.count(p.first) == 0) {
297 printf("Diff in inst_to_used_ids: missing value in rhs\n");
298 }
299 }
300 for (auto p : rhs.inst_to_used_ids_) {
301 if (lhs.inst_to_used_ids_.count(p.first) == 0) {
302 printf("Diff in inst_to_used_ids: missing value in lhs\n");
303 }
304 }
305 same = false;
306 }
307
308 return same;
309}
310
311} // namespace analysis
312} // namespace opt

Callers 1

IsConsistentMethod · 0.85

Calls 2

endMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected