[lld] r204772 - Remove safeguard from RoundTripYAML pass.

Rui Ueyama ruiu at google.com
Tue Mar 25 17:21:12 PDT 2014


Author: ruiu
Date: Tue Mar 25 19:21:11 2014
New Revision: 204772

URL: http://llvm.org/viewvc/llvm-project?rev=204772&view=rev
Log:
Remove safeguard from RoundTripYAML pass.

RoundTripYAML pass is removed from the regular execution pass in r204296,
so the safeguard to protect it from OOM error is no longer needed, because
we are sure that the pass is only used for tests, and test files are all
small.

We also want to see RoundTripYAML pass to fail in tests if it fails,
rather than silently skipping failing tests.

Modified:
    lld/trunk/lib/Passes/RoundTripYAMLPass.cpp

Modified: lld/trunk/lib/Passes/RoundTripYAMLPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/RoundTripYAMLPass.cpp?rev=204772&r1=204771&r2=204772&view=diff
==============================================================================
--- lld/trunk/lib/Passes/RoundTripYAMLPass.cpp (original)
+++ lld/trunk/lib/Passes/RoundTripYAMLPass.cpp Tue Mar 25 19:21:11 2014
@@ -18,11 +18,6 @@
 
 #include <memory>
 
-// Skip YAML files larger than this to avoid OOM error. The YAML reader consumes
-// excessively large amount of memory when parsing a large file.
-// TODO: Fix the YAML reader to reduce memory footprint.
-static const size_t MAX_YAML_FILE_SIZE = 50 * 1024 * 1024;
-
 using namespace lld;
 
 /// Perform the actual pass
@@ -45,15 +40,12 @@ void RoundTripYAMLPass::perform(std::uni
   if (MemoryBuffer::getFile(tmpYAMLFile.str(), mb))
     return;
 
-  if (mb->getBufferSize() < MAX_YAML_FILE_SIZE) {
-    error_code ec = _context.registry().parseFile(mb, _yamlFile);
-    if (ec) {
-      // Note: we need a way for Passes to report errors.
-      llvm_unreachable("yaml reader not registered or read error");
-    }
-    File *objFile = _yamlFile[0].get();
-    mergedFile.reset(new FileToMutable(_context, *objFile));
+  error_code ec = _context.registry().parseFile(mb, _yamlFile);
+  if (ec) {
+    // Note: we need a way for Passes to report errors.
+    llvm_unreachable("yaml reader not registered or read error");
   }
-
+  File *objFile = _yamlFile[0].get();
+  mergedFile.reset(new FileToMutable(_context, *objFile));
   llvm::sys::fs::remove(tmpYAMLFile.str());
 }





More information about the llvm-commits mailing list