summaryrefslogtreecommitdiff
path: root/tools/bugpoint
AgeCommit message (Collapse)AuthorFilesLines
2015-05-05[bugpoint] Increase default memory limit to 400MB to fix bugpoint tests.Daniel Sanders1-2/+2
I tracked down the bug to an unchecked malloc in SmallVectorBase::grow_pod(). This malloc is returning NULL on my machine when running under bugpoint but not when -enable-valgrind is given. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236504 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-20bugpoint Enhancement.JF Bastien1-7/+79
Summary: This patch adds two flags to `bugpoint`: "-replace-funcs-with-null" and "-disable-pass-list-reduction". When "-replace-funcs-with-null" is specified, bugpoint will, instead of simply deleting function bodies, replace all uses of functions and then will delete functions completely from the test module, correctly handling aliasing and @llvm.used && @llvm.compiler.used. This part was conceived while trying to debug the PNaCl IR simplification passes, which don't allow undefined functions (ie no declarations). With "-disable-pass-list-reduction", bugpoint won't try to reduce the set of passes causing the "crash". This is needed in cases where one is trying to debug an issue inside the PNaCl IR simplification passes which is causing an PNaCl ABI verification error, for example. Reviewers: jfb Reviewed By: jfb Subscribers: jfb, llvm-commits Differential Revision: http://reviews.llvm.org/D8555 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235362 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-15uselistorder: Remove the global bitsDuncan P. N. Exon Smith2-8/+7
Remove all the global bits to do with preserving use-list order by moving the `cl::opt`s to the individual tools that want them. There's a minor functionality change to `libLTO`, in that you can't send in `-preserve-bc-uselistorder=false`, but making that bit settable (if it's worth doing) should be through explicit LTO API. As a drive-by fix, I removed some includes of `UseListOrder.h` that were made unnecessary by recent commits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234973 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-15uselistorder: Pull the bit through WriteToBitcodFile()Duncan P. N. Exon Smith1-2/+3
Change the callers of `WriteToBitcodeFile()` to pass `true` or `shouldPreserveBitcodeUseListOrder()` explicitly. I left the callers that want to send `false` alone. I'll keep pushing the bit higher until hopefully I can delete the global `cl::opt` entirely. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234957 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-14IR: Set -preserve-bc-uselistorder=false by defaultDuncan P. N. Exon Smith1-0/+5
But keep it on by default in `llvm-as`, `opt`, `bugpoint`, `llvm-link`, `llvm-extract`, and `LTOCodeGenerator`. Part of PR5680. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234921 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-11Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko1-1/+1
The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' \ -j=32 -fix -format http://reviews.llvm.org/D8925 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234679 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-02[opaque pointer type] API migration for GEP constant factoriesDavid Blaikie1-1/+2
Require the pointee type to be passed explicitly and assert that it is correct. For now it's possible to pass nullptr here (and I've done so in a few places in this patch) but eventually that will be disallowed once all clients have been updated or removed. It'll be a long road to get all the way there... but if you have the cahnce to update your callers to pass the type explicitly without depending on a pointer's element type, that would be a good thing to do soon and a necessary thing to do eventually. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233938 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-31tools: Unify how verifyModule() is calledDuncan P. N. Exon Smith1-1/+1
Unify the error messages for the various tools when `verifyModule()` fails on an input module. The "brave new way" is: lltool: path/to/input.ll: error: input module is broken! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233667 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26bugpoint: Verify input filesDuncan P. N. Exon Smith1-0/+6
Like r233229 for `llvm-link`, start verifying input files to `bugpoint`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233253 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-26bugpoint: Return early after error, NFCDuncan P. N. Exon Smith1-10/+10
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233252 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-19Verifier: Remove the separate -verify-di passDuncan P. N. Exon Smith1-1/+0
Remove `DebugInfoVerifierLegacyPass` and the `-verify-di` pass. Instead, call into the `DebugInfoVerifier` from inside `VerifierLegacyPass::finalizeModule()`. This better matches the logic in `verifyModule()` (used by the new PassManager), avoids requiring two separate passes to verify the IR, and makes the API for "add a pass to verify the IR" simple. Note: the `-verify-debug-info` flag still works (for now, at least; eventually it might make sense to just remove it). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232772 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-18CMake: Disable ENABLE_EXPORTS for executables with MSVCReid Kleckner1-1/+1
The MSVC linker won't produce a .lib file for an executable that doesn't export anything, and LLVM doesn't maintain dllexport annotations or .def files listing all C++ symbols. It also doesn't support exporting all symbols, like binutils ld. CMake 3.2 changed the Ninja generator to list both the .exe and .lib files as outputs of executable build targets. Ninja would always re-link executables with ENABLE_EXPORTS because the .lib output file was not present, and therefore the target was out of date. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232662 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-10Teach raw_ostream to accept SmallString.Yaron Keren1-7/+7
Saves adding .str() call to any raw_ostream << SmallString usage and a small step towards making .str() consistent in the ADTs by removing one of the SmallString::str() use cases, discussion at http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141013/240026.html I'll update the Phabricator patch http://reviews.llvm.org/D6372 for review of the Twine SmallString support, it's more complex than this one. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231763 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-26Replace a few instances of NULL with nullptr.David Majnemer1-2/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230599 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13[PM] Remove the old 'PassManager.h' header file at the top level ofChandler Carruth4-6/+6
LLVM's include tree and the use of using declarations to hide the 'legacy' namespace for the old pass manager. This undoes the primary modules-hostile change I made to keep out-of-tree targets building. I sent an email inquiring about whether this would be reasonable to do at this phase and people seemed fine with it, so making it a reality. This should allow us to start bootstrapping with modules to a certain extent along with making it easier to mix and match headers in general. The updates to any code for users of LLVM are very mechanical. Switch from including "llvm/PassManager.h" to "llvm/IR/LegacyPassManager.h". Qualify the types which now produce compile errors with "legacy::". The most common ones are "PassManager", "PassManagerBase", and "FunctionPassManager". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229094 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-07Fix style.Michael J. Spencer1-8/+6
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221547 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-04Use findProgramByName.Michael J. Spencer2-17/+41
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221221 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-28Remove the PreserveSource linker mode.Rafael Espindola2-7/+5
I noticed that it was untested, and forcing it on caused some tests to fail: LLVM :: Linker/metadata-a.ll LLVM :: Linker/prefixdata.ll LLVM :: Linker/type-unique-odr-a.ll LLVM :: Linker/type-unique-simple-a.ll LLVM :: Linker/type-unique-simple2-a.ll LLVM :: Linker/type-unique-simple2.ll LLVM :: Linker/type-unique-type-array-a.ll LLVM :: Linker/unnamed-addr1-a.ll LLVM :: Linker/visibility1.ll If it is to be resurrected, it has to be fixed and we should probably have a -preserve-source command line option in llvm-mc and run tests with and without it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220741 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-25Update the error handling of lib/Linker.Rafael Espindola2-29/+8
Instead of passing a std::string&, use the new diagnostic infrastructure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220608 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-16Delete -std-compile-opts.Rafael Espindola1-10/+0
These days -std-compile-opts was just a silly alias for -O3. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219951 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-07[Bugpoint] Close error log in ProcessFailure. Bugpoint had been failing to closeLang Hames1-9/+1
this, and in some circumstances (e.g. reducing particularly large test-cases) this was causing bugpoint to be killed for hitting open file-handle limits. No test case: I was only able to trigger this with test cases taking upwards of 10 mins to run. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219244 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26Return a std::unique_ptr from the IRReader.h functions. NFC.Rafael Espindola1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216466 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26Return a std::unique_ptr from parseInputFile and propagate. NFC.Rafael Espindola6-110/+89
The memory management in BugPoint is fairly convoluted, so this just unwraps one layer by changing the return type of functions that always return owned Modules. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216464 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25Modernize raw_fd_ostream's constructor a bit.Rafael Espindola1-5/+5
Take a StringRef instead of a "const char *". Take a "std::error_code &" instead of a "std::string &" for error. A create static method would be even better, but this patch is already a bit too big. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216393 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-24Use range based for loops to avoid needing to re-mention SmallPtrSet size.Craig Topper1-7/+5
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216351 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-21Handle inlining in populateLTOPassManager like in populateModulePassManager.Rafael Espindola1-1/+2
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216178 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-21Move DisableGVNLoadPRE from populateLTOPassManager to PassManagerBuilder.Rafael Espindola1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216174 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13Canonicalize header guards into a common format.Benjamin Kramer3-6/+6
Add header guards to files that were missing guards. Remove #endif comments as they don't seem common in LLVM (we can easily add them back if we decide they're useful) Changes made by clang-tidy with minor tweaks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215558 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-05Don't internalize all but main by default.Rafael Espindola1-2/+1
This is mostly a cleanup, but it changes a fairly old behavior. Every "real" LTO user was already disabling the silly internalize pass and creating the internalize pass itself. The difference with this patch is for "opt -std-link-opts" and the C api. Now to get a usable behavior out of opt one doesn't need the funny looking command line: opt -internalize -disable-internalize -internalize-public-api-list=foo,bar -std-link-opts git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214919 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-21Revert "[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) ↵Duncan P. N. Exon Smith1-2/+2
iterator ranges." This reverts commit r213474 (and r213475), which causes a miscompile on a stage2 LTO build. I'll reply on the list in a moment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213562 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-20[C++11] Add predecessors(BasicBlock *) / successors(BasicBlock *) iterator ↵Manuel Jacob1-2/+2
ranges. Summary: This patch introduces two new iterator ranges and updates existing code to use it. No functional change intended. Test Plan: All tests (make check-all) still pass. Reviewers: dblaikie Reviewed By: dblaikie Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D4481 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213474 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-13bugpoint/ToolRunner.cpp: ProcessFailure(): Close ErrorFD immediately, or it ↵NAKAMURA Takumi1-0/+8
couldn't be reopened on Win32. FIXME: We may have an option in openFileForWrite(), not to use ResultFD but to close it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212902 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-13Remove 'using std::error_code' from tools.Rafael Espindola5-18/+13
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210876 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-12Don't use 'using std::error_code' in include/llvm.Rafael Espindola5-0/+5
This should make sure that most new uses use the std prefix. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210835 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-28[C++] Use 'nullptr'.Craig Topper3-11/+13
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207394 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-25BugPoint: Fix some memory leaks.David Blaikie1-0/+4
Patch by Kostya Serebryany. unique_ptr would be nice, but it's a bit too much work for an area I'm not familiar with, nor invested in, unfortunately. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207265 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-25[C++] Use 'nullptr'. Tools edition.Craig Topper9-52/+52
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207176 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-22[Modules] Fix potential ODR violations by sinking the DEBUG_TYPEChandler Carruth1-1/+2
definition below all of the header #include lines, tools edition. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206848 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-21[Modules] Make Support/Debug.h modular. This requires it to not changeChandler Carruth2-0/+4
behavior based on other files defining DEBUG_TYPE, which means it cannot define DEBUG_TYPE at all. This is actually better IMO as it forces folks to define relevant DEBUG_TYPEs for their files. However, it requires all files that currently use DEBUG(...) to define a DEBUG_TYPE if they don't already. I've updated all such files in LLVM and will do the same for other upstream projects. This still leaves one important change in how LLVM uses the DEBUG_TYPE macro going forward: we need to only define the macro *after* header files have been #include-ed. Previously, this wasn't possible because Debug.h required the macro to be pre-defined. This commit removes that. By defining DEBUG_TYPE after the includes two things are fixed: - Header files that need to provide a DEBUG_TYPE for some inline code can do so by defining the macro before their inline code and undef-ing it afterward so the macro does not escape. - We no longer have rampant ODR violations due to including headers with different DEBUG_TYPE definitions. This may be mostly an academic violation today, but with modules these types of violations are easy to check for and potentially very relevant. Where necessary to suppor headers with DEBUG_TYPE, I have moved the definitions below the includes in this commit. I plan to move the rest of the DEBUG_TYPE macros in LLVM in subsequent commits; this one is big enough. The comments in Debug.h, which were hilariously out of date already, have been updated to reflect the recommended practice going forward. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206822 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-15verify-di: Implement DebugInfoVerifierDuncan P. N. Exon Smith1-0/+1
Implement DebugInfoVerifier, which steals verification relying on DebugInfoFinder from Verifier. - Adds LegacyDebugInfoVerifierPassPass, a ModulePass which wraps DebugInfoVerifier. Uses -verify-di command-line flag. - Change verifyModule() to invoke DebugInfoVerifier as well as Verifier. - Add a call to createDebugInfoVerifierPass() wherever there was a call to createVerifierPass(). This implementation as a module pass should sidestep efficiency issues, allowing us to turn debug info verification back on. <rdar://problem/15500563> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206300 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-14Fix a bug introduced during the transition to PathV2.Rafael Espindola1-1/+1
sys::fs::createUniqueFile returns an absolute path, so MakeSharedObject does too and we don't need to add a './' prefix. Patch by Jon McLachlan. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203931 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-14static link polly into toolsSebastian Pop2-0/+19
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203886 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-08[C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper5-89/+89
class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203345 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-08[bugpoint] Don't ignore arg in -compile-commad="tool arg"Adam Nemet1-1/+1
Args is an output parameter of the function lexCommand but the reference operator was missed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203343 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2-4/+5
This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203083 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06[Layering] Sink Linker.h into a Linker subdirectory to make itChandler Carruth2-2/+2
consistent with every other sub-library header in LLVM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203065 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05[C++11] Replace OwningPtr::take() with OwningPtr::release().Ahmed Charles1-2/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202957 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04[Modules] Move the PassNameParser to the IR library as it deals in theChandler Carruth1-1/+1
PassInfo structures of the legacy pass manager. Also give it the Legacy prefix as it is not a particularly widely used header. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202839 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04[Modules] Move CFG.h to the IR library as it defines graph traits overChandler Carruth1-1/+1
IR types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202827 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04[Modules] Move ValueMap to the IR library. While this class does notChandler Carruth1-1/+1
directly care about the Value class (it is templated so that the key can be any arbitrary Value subclass), it is in fact concretely tied to the Value class through the ValueHandle's CallbackVH interface which relies on the key type being some Value subclass to establish the value handle chain. Ironically, the unittest is already in the right library. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202824 91177308-0d34-0410-b5e6-96231b3b80d8