[sva-commits] r150182 - /safecode/trunk/tools/LTO/LTOCodeGenerator.cpp

John Criswell criswell at uiuc.edu
Thu Feb 9 10:18:07 CST 2012


Author: criswell
Date: Thu Feb  9 10:18:06 2012
New Revision: 150182

URL: http://llvm.org/viewvc/llvm-project?rev=150182&view=rev
Log:
Only run the SAFECode transforms if there are run-time checks in the program.

Modified:
    safecode/trunk/tools/LTO/LTOCodeGenerator.cpp

Modified: safecode/trunk/tools/LTO/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/safecode/trunk/tools/LTO/LTOCodeGenerator.cpp?rev=150182&r1=150181&r2=150182&view=diff
==============================================================================
--- safecode/trunk/tools/LTO/LTOCodeGenerator.cpp (original)
+++ safecode/trunk/tools/LTO/LTOCodeGenerator.cpp Thu Feb  9 10:18:06 2012
@@ -411,11 +411,17 @@
       return true;
     }
 
-    // Add the SAFECode optimization/finalization passes
-    passes.add(new TargetData(*_target->getTargetData()));
-    passes.add(new ExactCheckOpt());
-    if (mergedModule->getFunction("main")) {
-      passes.add(new CompleteChecks());
+    // Add the SAFECode optimization/finalization passes.
+    // Note that we only run these passes (which require DSA) if we detect
+    // that run-time checks have been added to the code.
+    for (unsigned index = 0; index < numChecks; ++index) {
+      if (mergedModule->getFunction(RuntimeChecks[index].name)) {
+        passes.add(new TargetData(*_target->getTargetData()));
+        passes.add(new ExactCheckOpt());
+        if (mergedModule->getFunction("main")) {
+          passes.add(new CompleteChecks());
+        }
+      }
     }
 
     // Run our queue of passes all at once now, efficiently.




More information about the sva-commits mailing list