- if (!BugpointIsInterrupted && !DisableLoopExtraction &&
- ExtractLoops(BD, TestFn, MiscompiledFunctions)) {
- // Okay, we extracted some loops and the problem still appears. See if we
- // can eliminate some of the created functions from being candidates.
-
- // Loop extraction can introduce functions with the same name (foo_code).
- // Make sure to disambiguate the symbols so that when the program is split
- // apart that we can link it back together again.
- DisambiguateGlobalSymbols(BD.getProgram());
-
- // Do the reduction...
- if (!BugpointIsInterrupted)
- ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions);
-
- std::cout << "\n*** The following function"
- << (MiscompiledFunctions.size() == 1 ? " is" : "s are")
- << " being miscompiled: ";
- PrintFunctionList(MiscompiledFunctions);
- std::cout << '\n';
+ if (!BugpointIsInterrupted && !DisableLoopExtraction) {
+ bool Ret = ExtractLoops(BD, TestFn, MiscompiledFunctions, Error);
+ if (!Error.empty())
+ return MiscompiledFunctions;
+ if (Ret) {
+ // Okay, we extracted some loops and the problem still appears. See if
+ // we can eliminate some of the created functions from being candidates.
+ DisambiguateGlobalSymbols(BD.getProgram());
+
+ // Do the reduction...
+ if (!BugpointIsInterrupted)
+ ReduceMiscompilingFunctions(BD, TestFn).reduceList(MiscompiledFunctions,
+ Error);
+ if (!Error.empty())
+ return MiscompiledFunctions;
+
+ outs() << "\n*** The following function"
+ << (MiscompiledFunctions.size() == 1 ? " is" : "s are")
+ << " being miscompiled: ";
+ PrintFunctionList(MiscompiledFunctions);
+ outs() << '\n';
+ }