summaryrefslogtreecommitdiff
path: root/llvm/tools/bugpoint/BugDriver.cpp
AgeCommit message (Collapse)Author
2025-10-13[NFC][LLVM] Code cleanup in bugpoint (#162909)Rahul Joshi
- Move file local variables and functions out of anonymous namespace and mark them static. - Change a few function names to conform to LLVM coding standard (camelCase). - Add end of namespace comments for anonymous namespaces.
2025-03-06[IR] Store Triple in Module (NFC) (#129868)Nikita Popov
The module currently stores the target triple as a string. This means that any code that wants to actually use the triple first has to instantiate a Triple, which is somewhat expensive. The change in #121652 caused a moderate compile-time regression due to this. While it would be easy enough to work around, I think that architecturally, it makes more sense to store the parsed Triple in the module, so that it can always be directly queried. For this change, I've opted not to add any magic conversions between std::string and Triple for backwards-compatibilty purses, and instead write out needed Triple()s or str()s explicitly. This is because I think a decent number of them should be changed to work on Triple as well, to avoid unnecessary conversions back and forth. The only interesting part in this patch is that the default triple is Triple("") instead of Triple() to preserve existing behavior. The former defaults to using the ELF object format instead of unknown object format. We should fix that as well.
2024-07-06[llvm] Remove redundant calls to std::unique_ptr<T>::get (NFC) (#97778)Kazu Hirata
2023-02-10[NFC][TargetParser] Replace uses of llvm/Support/Host.hArchibald Elliott
The forwarding header is left in place because of its use in `polly/lib/External/isl/interface/extract_interface.cc`, but I have added a GCC warning about the fact it is deprecated, because it is used in `isl` from where it is included by Polly.
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-02-14Change the BugDriver to store the current module with std::unique_ptr.Rafael Espindola
While there, change a bunch of helper functions to take references to avoid adding calls to get(). This should conclude the bugpoint yak shaving. llvm-svn: 325177
2017-11-16Convert another use of createUniqueFile to TempFile::create.Rafael Espindola
This one requires a new small feature in TempFile: the ability to keep the temporary file with the temporary name. llvm-svn: 318458
2017-11-16Convert another use of createUniqueFile to TempFile::create.Rafael Espindola
llvm-svn: 318427
2016-09-06bugpoint: Return Errors instead of passing around stringsJustin Bogner
This replaces the threading of `std::string &Error` through all of these APIs with checked Error returns instead. There are very few places here that actually emit any errors right now, but threading the APIs through will allow us to replace a bunch of exit(1)'s that are scattered through this code with proper error handling. This is more or less NFC, but does move around where a couple of error messages are printed out. llvm-svn: 280720
2016-09-06Revert "bugpoint: Stop threading errors through APIs that never fail"Justin Bogner
This isn't the right thing to do - it turns out a number of the APIs that "never fail" just exit(1) if something bad happens. We can and should thread Error through this instead. That diff will make more sense with this reverted. Sorry for the noise. This reverts r280690 llvm-svn: 280691
2016-09-06bugpoint: Stop threading errors through APIs that never failJustin Bogner
This simplifies ListReducer and most of its subclasses by removing the std::string &Error that was threaded through all of them but almost never used. If we end up needing error handling in more places here we can reinstate it using llvm::Error instead of these unwieldy strings. The 2 cases (out of 12) that actually can hit the error cases are a little bit awkward now, but those will clean up as I refactor this API further. llvm-svn: 280690
2016-09-02bugpoint: clang-format all of bugpoint. NFCJustin Bogner
I'm going to clean up the APIs here a bit and touch many many lines anyway. llvm-svn: 280450
2015-12-16Change linkInModule to take a std::unique_ptr.Rafael Espindola
Passing in a std::unique_ptr should help find errors when the module is used after being linked into another module. llvm-svn: 255842
2015-12-14Use diagnostic handler in the LLVMContextRafael Espindola
This patch converts code that has access to a LLVMContext to not take a diagnostic handler. This has a few advantages * It is easier to use a consistent diagnostic handler in a single program. * Less clutter since we are not passing a handler around. It does make it a bit awkward to implement some C APIs that return a diagnostic string. I will propose new versions of these APIs and deprecate the current ones. llvm-svn: 255571
2015-12-04Always pass a diagnostic handler to the linker.Rafael Espindola
Before this patch the diagnostic handler was optional. If it was not passed, the one in the LLVMContext was used. That is probably not a pattern we want to follow. If each area has an optional callback, there is a sea of callbacks and it is hard to follow which one is called. Doing this also found cases where the callback is a nice addition, like testing that no errors or warnings are reported. The other option is to always use the diagnostic handler in the LLVMContext. That has a few problems * To implement the C API we would have to set the diag handler and then set it back to the original value. * Code that creates the context might be far away from code that wants the diagnostics. I do have a patch that implements the second option and will send that as an RFC. llvm-svn: 254777
2015-12-01Use references now that it is natural to do so.Rafael Espindola
The linker never takes ownership of a module or changes which module it is refering to, making it natural to use references. llvm-svn: 254449
2015-10-14[Bugpoint] Use 'CC' instead of 'GCC' for variable naming.Davide Italiano
We now use clang by default and fallback to gcc when requested. With this commit, names reflect reality. No functional change intended. Discussed with: Rafael Espindola. llvm-svn: 250321
2015-03-31tools: Unify how verifyModule() is calledDuncan P. N. Exon Smith
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! llvm-svn: 233667
2015-03-26bugpoint: Verify input filesDuncan P. N. Exon Smith
Like r233229 for `llvm-link`, start verifying input files to `bugpoint`. llvm-svn: 233253
2015-03-26bugpoint: Return early after error, NFCDuncan P. N. Exon Smith
llvm-svn: 233252
2014-10-28Remove the PreserveSource linker mode.Rafael Espindola
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. llvm-svn: 220741
2014-10-25Update the error handling of lib/Linker.Rafael Espindola
Instead of passing a std::string&, use the new diagnostic infrastructure. llvm-svn: 220608
2014-08-26Return a std::unique_ptr from the IRReader.h functions. NFC.Rafael Espindola
llvm-svn: 216466
2014-08-26Return a std::unique_ptr from parseInputFile and propagate. NFC.Rafael Espindola
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. llvm-svn: 216464
2014-04-28[C++] Use 'nullptr'.Craig Topper
llvm-svn: 207394
2014-04-25BugPoint: Fix some memory leaks.David Blaikie
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. llvm-svn: 207265
2014-04-25[C++] Use 'nullptr'. Tools edition.Craig Topper
llvm-svn: 207176
2014-03-06Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles
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. llvm-svn: 203083
2014-03-06[Layering] Sink Linker.h into a Linker subdirectory to make itChandler Carruth
consistent with every other sub-library header in LLVM. llvm-svn: 203065
2013-06-18Remove PathV1.h use from BugDriver.cpp.Rafael Espindola
llvm-svn: 184203
2013-06-17Don't use PathV1.h in ToolRunner.h.Rafael Espindola
llvm-svn: 184107
2013-04-12Replace uses of the deprecated std::auto_ptr with OwningPtr.Andy Gibbs
llvm-svn: 179373
2013-03-26Split out the IRReader header and the utility functions it provides intoChandler Carruth
its own library. These functions are bridging between the bitcode reader and the ll parser which are in different libraries. Previously we didn't have any good library to do this, and instead played fast and loose with a "header only" set of interfaces in the Support library. This really doesn't work well as evidenced by the recent attempt to add timing logic to the these routines. As part of this, make them normal functions rather than weird inline functions, and sink the implementation into the library. Also clean up the header to be nice and minimal. This requires updating lots of build system dependencies to specify that the IRReader library is needed, and several source files to not implicitly rely upon the header file to transitively include all manner of other headers. If you are using IRReader.h, this commit will break you (the header moved) and you'll need to also update your library usage to include 'irreader'. I will commit the corresponding change to Clang momentarily. llvm-svn: 177971
2013-01-02Move all of the header files which are involved in modelling the LLVM IRChandler Carruth
into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. llvm-svn: 171366
2012-12-04Sort the #include lines for tools/...Chandler Carruth
Again, tools are trickier to pick the main module header for than library source files. I've started to follow the pattern of using LLVMContext.h when it is included as a stub for program source files. llvm-svn: 169252
2012-07-23Fix a typo (the the => the)Sylvestre Ledru
llvm-svn: 160621
2011-11-01rename getHostTriple into getDefaultTargetTripleSebastian Pop
llvm-svn: 143502
2011-10-16Enhance llvm::SourceMgr to support diagnostic ranges, the same way clang ↵Chris Lattner
does. Enhance the X86 asmparser to produce ranges in the one case that was annoying me, for example: test.s:10:15: error: invalid operand for instruction movl 0(%rax), 0(%edx) ^~~~~~~ It should be straight-forward to enhance filecheck, tblgen, and/or the .ll parser to use ranges where appropriate if someone is interested. llvm-svn: 142106
2011-10-11Make it possible to use the linker without destroying the source module. ↵Tanya Lattner
This is so the source module can be linked to multiple other destination modules. For all that used LinkModules() before, they will continue to destroy the source module as before. This line, and those below, will be ignored-- M include/llvm/Linker.h M tools/bugpoint/Miscompilation.cpp M tools/bugpoint/BugDriver.cpp M tools/llvm-link/llvm-link.cpp M lib/Linker/LinkModules.cpp llvm-svn: 141606
2011-03-31Fix whitespace.Michael J. Spencer
llvm-svn: 128631
2011-03-31Switch FileRemover from PathV1 to V2.Michael J. Spencer
llvm-svn: 128630
2010-11-29Merge System into Support.Michael J. Spencer
llvm-svn: 120298
2010-08-08Most of bugpoint now only needs to know the pass names.Rafael Espindola
llvm-svn: 110534
2010-08-07Run opt instead of bugpoint itself.Rafael Espindola
llvm-svn: 110524
2010-08-05Revert bugpoint change due to buildbot breakage.Bob Wilson
--- Reverse-merging r110333 into '.': U tools/bugpoint/BugDriver.h U tools/bugpoint/OptimizerDriver.cpp U tools/bugpoint/bugpoint.cpp U tools/bugpoint/BugDriver.cpp llvm-svn: 110341
2010-08-05Run opt instead of bugpoint itself.Rafael Espindola
Fixes PR753. llvm-svn: 110333
2010-08-05Add a Module argument to the remaining runPasses methods and mark getContextRafael Espindola
const. llvm-svn: 110300
2010-07-30Add a Program argument to diffProgram to avoid a use of swapProgramIn.Rafael Espindola
llvm-svn: 109859
2010-07-20Speculatively revert r108813, in an attempt to get the self-host buildbots ↵Owen Anderson
working again. I don't see why this patch would cause them to fail the way they are, but none of the other intervening patches seem likely either. llvm-svn: 108818
2010-07-20Reapply r108794, a fix for the failing test from last time.Owen Anderson
llvm-svn: 108813