Add support for fp tolerances
authorChris Lattner <sabre@nondot.org>
Sun, 23 Jan 2005 03:45:26 +0000 (03:45 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 23 Jan 2005 03:45:26 +0000 (03:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19774 91177308-0d34-0410-b5e6-96231b3b80d8

tools/bugpoint/ExecutionDriver.cpp

index 1dcb69a1c88ea1cecb245d984eb57a41a8ad4136..966902cec89345014ca7717b14b1b63d7f89bbc5 100644 (file)
@@ -29,6 +29,13 @@ namespace {
     AutoPick, RunLLI, RunJIT, RunLLC, RunCBE
   };
 
+  cl::opt<double>
+  AbsTolerance("abs-tolerance", cl::desc("Absolute error tolerated"),
+               cl::init(0.0));
+  cl::opt<double>
+  RelTolerance("rel-tolerance", cl::desc("Relative error tolerated"),
+               cl::init(0.0));
+
   cl::opt<OutputType>
   InterpreterSel(cl::desc("Specify how LLVM code should be executed:"),
                  cl::values(clEnumValN(AutoPick, "auto", "Use best guess"),
@@ -303,9 +310,10 @@ bool BugDriver::diffProgram(const std::string &BytecodeFile,
 
   std::string Error;
   bool FilesDifferent = false;
-  if (DiffFilesWithTolerance(ReferenceOutputFile, Output.toString(), 0, 0,
-                             &Error)) {
-    if (!Error.empty()) {
+  if (int Diff = DiffFilesWithTolerance(sys::Path(ReferenceOutputFile),
+                                        sys::Path(Output.toString()),
+                                        AbsTolerance, RelTolerance, &Error)) {
+    if (Diff == 2) {
       std::cerr << "While diffing output: " << Error << '\n';
       exit(1);
     }