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

Method IsConsistent

source/opt/ir_context.cpp:384–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384bool IRContext::IsConsistent() {
385#ifndef SPIRV_CHECK_CONTEXT
386 return true;
387#else
388 if (AreAnalysesValid(kAnalysisDefUse)) {
389 analysis::DefUseManager new_def_use(module());
390 if (!CompareAndPrintDifferences(*get_def_use_mgr(), new_def_use)) {
391 return false;
392 }
393 }
394
395 return true;
396 if (AreAnalysesValid(kAnalysisIdToFuncMapping)) {
397 for (auto& fn : *module_) {
398 if (id_to_func_[fn.result_id()] != &fn) {
399 return false;
400 }
401 }
402 }
403
404 if (AreAnalysesValid(kAnalysisIdToGraphMapping)) {
405 for (auto& g : module_->graphs()) {
406 if (id_to_graph_[g->DefInst().result_id()] != g.get()) {
407 return false;
408 }
409 }
410 }
411
412 if (AreAnalysesValid(kAnalysisInstrToBlockMapping)) {
413 for (auto& func : *module()) {
414 for (auto& block : func) {
415 if (!block.WhileEachInst([this, &block](Instruction* inst) {
416 if (get_instr_block(inst) != &block) {
417 return false;
418 }
419 return true;
420 })) {
421 return false;
422 }
423 }
424 }
425 }
426
427 if (!CheckCFG()) {
428 return false;
429 }
430
431 if (AreAnalysesValid(kAnalysisDecorations)) {
432 analysis::DecorationManager* dec_mgr = get_decoration_mgr();
433 analysis::DecorationManager current(module());
434
435 if (*dec_mgr != current) {
436 return false;
437 }
438 }
439
440 if (feature_mgr_ != nullptr) {
441 FeatureManager current(grammar_);

Callers 2

RunMethod · 0.80
TESTFunction · 0.80

Calls 5

getMethod · 0.80
result_idMethod · 0.45
WhileEachInstMethod · 0.45
AnalyzeMethod · 0.45

Tested by 1

TESTFunction · 0.64