MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / compareFunctions

Method compareFunctions

llvm_util/compare.cpp:99–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97} // namespace
98
99bool Verifier::compareFunctions(llvm::Function &F1, llvm::Function &F2) {
100 auto r = verify(F1, F2, TLI, smt_init, out, !config::quiet, always_verify);
101 if (r.status == Results::ERROR) {
102 out << "ERROR: " << r.error;
103 ++num_errors;
104 return true;
105 }
106
107 if (print_dot) {
108 r.t.src.writeDot("src");
109 r.t.tgt.writeDot("tgt");
110 }
111
112 if (r.errs.hasWarnings())
113 r.errs.printWarnings(out);
114
115 switch (r.status) {
116 case Results::ERROR:
117 UNREACHABLE();
118 break;
119
120 case Results::SYNTACTIC_EQ:
121 out << "Transformation seems to be correct! (syntactically equal)\n\n";
122 ++num_correct;
123 break;
124
125 case Results::CORRECT:
126 out << "Transformation seems to be correct!\n\n";
127 ++num_correct;
128 break;
129
130 case Results::TYPE_CHECKER_FAILED:
131 out << "Transformation doesn't verify!\n"
132 "ERROR: program doesn't type check!\n\n";
133 ++num_errors;
134 return true;
135
136 case Results::UNSOUND:
137 out << "Transformation doesn't verify!\n\n";
138 if (!config::quiet)
139 out << r.errs << endl;
140 ++num_unsound;
141 return false;
142
143 case Results::FAILED_TO_PROVE:
144 out << r.errs << endl;
145 ++num_failed;
146 return true;
147 }
148
149 if (bidirectional) {
150 r = verify(F2, F1, TLI, smt_init, out, false, always_verify);
151 switch (r.status) {
152 case Results::ERROR:
153 case Results::TYPE_CHECKER_FAILED:
154 UNREACHABLE();
155 break;
156

Callers 2

mainFunction · 0.80
mainFunction · 0.80

Calls 4

verifyFunction · 0.85
writeDotMethod · 0.80
hasWarningsMethod · 0.80
printWarningsMethod · 0.80

Tested by

no test coverage detected