summaryrefslogtreecommitdiffstats
path: root/llvm/tools/bugpoint
Commit message (Collapse)AuthorAgeFilesLines
* [NFC] Remove multiple semicolonsMandeep Singh Grang2017-06-281-1/+1
| | | | | | | | | | | | Reviewers: bogner, whitequark, mgrang Reviewed By: mgrang Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34785 llvm-svn: 306613
* [bugpoint] Do not initialize disassembler passesTobias Grosser2017-06-261-1/+0
| | | | | | | | | | | We added the initilization of disassembler passes in r306208 with the goal to bring bugpoint in line with 'opt'. However, 'opt' does itself not initialize dissassembler passes. As our goal was consistency, we drop the initialization of dissassembler passes again from bugpoint. Thanks to Chandler for pointing this out! llvm-svn: 306275
* Ensure backends available in 'opt' are also available in 'bugpoint'Tobias Grosser2017-06-243-0/+11
| | | | | | | | | | | | | | | | | | | | | | This patch links LLVM back-ends into bugpoint the same way they are already available in 'opt' and 'clang'. This resolves an inconsistency that allowed the use of LLVM backends in loadable modules that run in 'opt', but that would prevent the debugging of these modules with bugpoint due to unavailable / unresolved symbols. For e.g. In D31859, Polly requires the NVPTX back-end. Reviewers: hfinkel, bogner, chandlerc, grosser, Meinersbur Subscribers: bollu, mgorny, grosser, Meinersbur Tags: #polly Contributed by: Singapuram Sanjay Differential Revision: https://reviews.llvm.org/D32003 llvm-svn: 306208
* bugpoint: disabling symbolication of bugpoint-executed programsDavid Blaikie2017-06-091-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initial implementation - needs similar work/testing for other tools bugpoint invokes (llc, lli I think, maybe more). Alternatively (as suggested by chandlerc@) an environment variable could be used. This would allow the option to pass transparently through user scripts, pass to compilers if they happened to be LLVM-ish, etc. I worry a bit about using cl::opt in the crash handling code - LLVM might crash early, perhaps before the cl::opt is properly initialized? Or at least before arguments have been parsed? - should be OK since it defaults to "pretty", so if the crash is very early in opt parsing, etc, then crash reports will still be symbolized. I shyed away from doing this with an environment variable when I realized that would require copying the existing environment and appending the env variable of interest. But it seems there's no existing LLVM API for accessing the environment (even the Support tests for process launching have their own ifdefs for getting the environment). It could be added, but seemed like a higher bar/untested codepath to actually add environment variables. Most importantly, this reduces the runtime of test/BugPoint/metadata.ll in a split-dwarf Debug build from 1m34s to 6.5s by avoiding a lot of symbolication. (this wasn't a problem for non-split-dwarf builds only because the executable was too large to map into memory (due to bugpoint setting a 400MB memory (including address space - not sure why? Going to remove that) limit on the child process) so symbolication would fail fast & wouldn't spend all that time parsing DWARF, etc) Reviewers: chandlerc, dannyb Differential Revision: https://reviews.llvm.org/D33804 llvm-svn: 305056
* Prefer static namespace-scoped variables over anon namespacing per style guideDavid Blaikie2017-06-011-6/+5
| | | | | | | Also for consistency with the immediately preceeding variable definition. llvm-svn: 304457
* Suppress all uses of LLVM_END_WITH_NULL. NFC.Serge Guelton2017-05-091-2/+1
| | | | | | | | | Use variadic templates instead of relying on <cstdarg> + sentinel. This enforces better type checking and makes code more readable. Differential Revision: https://reviews.llvm.org/D32541 llvm-svn: 302571
* [Bugpoint] Use boolean AND instead of bitwise AND (PR32660)Simon Pilgrim2017-04-141-1/+1
| | | | llvm-svn: 300327
* Module::getOrInsertFunction is using C-style vararg instead of variadic ↵Serge Guelton2017-04-111-1/+1
| | | | | | | | | | | templates. From a user prospective, it forces the use of an annoying nullptr to mark the end of the vararg, and there's not type checking on the arguments. The variadic template is an obvious solution to both issues. Differential Revision: https://reviews.llvm.org/D31070 llvm-svn: 299949
* [bugpoint] Also remove comdat's from externalized GVsHal Finkel2017-04-111-0/+1
| | | | | | | | We were removing comdats from externalized functions (function declarations can't be comdat), but were not doing the same for variable. Failure to do this would cause bugpoint to fail ("Declaration may not be in a Comdat!"). llvm-svn: 299908
* [Bugpoint] Use `unique_ptr` correctly.Bryant Wong2017-04-051-11/+12
| | | | | | | | | | Moving Modules into `testMergedProgram` is incorrect (and causes segmentation faults) since all callers expect to retain ownership. This is evidenced by the later calls to `unique_ptr<Module>::get` in the same function. Differential Revision: https://reviews.llvm.org/D31727 llvm-svn: 299596
* Do not inline hot callsites for samplepgo in thinlto compile phase.Dehao Chen2017-03-211-1/+2
| | | | | | | | | | | | | | Summary: Because SamplePGO passes will be invoked twice in ThinLTO build: once at compile phase, the other at backend. We want to make sure the IR at the 2nd phase matches the hot part in profile, thus we do not want to inline hot callsites in the first phase. Reviewers: tejohnson, eraman Reviewed By: tejohnson Subscribers: mehdi_amini, llvm-commits, Prazek Differential Revision: https://reviews.llvm.org/D31201 llvm-svn: 298428
* Fix bugpoint to work with swifterror valuesArnold Schwaighofer2017-03-071-2/+4
| | | | llvm-svn: 297196
* Allow use of spaces in Bugpoint ‘--compile-command’ argumentDavid Bozier2017-03-021-21/+46
| | | | | | | | | | | | | | | | | Bug-Point functionality needs extending due to the patch D29185 by bd1976llvm (Allow llvm's build and test systems to support paths with spaces ). It requires Bugpoint to accept the use of spaces within ‘--compile-command’ tokens. Details Bugpoint uses the argument ‘--compile-command’ to pass in a command line argument as a string, the string is tokenized by the ‘lexCommand’ function using spaces as a delimiter. Patch D29185 will cause the unit test compile-custom.ll to fail as spaces are now required within tokens and as a delimiter. This patch allows the use of escape characters as below: Two consecutive '\' evaluate to a single '\'. A space after a '\' evaluates to a space that is not interpreted as a delimiter. Any other instances of the '\' character are removed. Committed on behalf of Owen Reynolds Differential revision: https://reviews.llvm.org/D29940 llvm-svn: 296763
* Remove uses of deprecated std::random_shuffle in the LLVM code base. ↵Marshall Clow2017-02-162-5/+6
| | | | | | Reviewed as https://reviews.llvm.org/D29780. llvm-svn: 295325
* Fix spelling mistakes in Tools/Tests comments. NFC.Simon Pilgrim2016-11-201-2/+2
| | | | | | Identified by Pedro Giffuni in PR27636. llvm-svn: 287489
* [CMake] bugpoint depends on intrinsics_genChris Bieneman2016-11-181-0/+3
| | | | | | | | | | | | | | | CrashDebugger.cpp has the following include chain: llvm/Analysis/TargetTransformInfo.h llvm/IR/IntrinsicInst.h llvm/IR/Function.h llvm/IR/Argument.h llvm/IR/Attributes.h llvm/IR/Attributes.gen This means bugpoint needs to depend on intrinsics_gen. llvm-svn: 287402
* Split Bitcode/ReaderWriter.h into separate reader and writer headersTeresa Johnson2016-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Split ReaderWriter.h which contains the APIs into both the BitReader and BitWriter libraries into BitcodeReader.h and BitcodeWriter.h. This is to address Chandler's concern about sharing the same API header between multiple libraries (BitReader and BitWriter). That concern is why we create a single bitcode library in our downstream build of clang, which led to r286297 being reverted as it added a dependency that created a cycle only when there is a single bitcode library (not two as in upstream). Reviewers: mehdi_amini Subscribers: dlj, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D26502 llvm-svn: 286566
* [Polly] Remove the unused POLLY_LINK_LIBS for linking polly intoHongbin Zheng2016-10-301-5/+0
| | | | | | | | tools Differential Revision: https://reviews.llvm.org/D25861 llvm-svn: 285514
* Add -strip-nonlinetable-debuginfo capabilityMichael Ilseman2016-10-251-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | This adds a new function to DebugInfo.cpp that takes an llvm::Module as input and removes all debug info metadata that is not directly needed for line tables, thus effectively stripping all type and variable information from the module. The primary motivation for this feature was the bitcode work flow (cf. http://lists.llvm.org/pipermail/llvm-dev/2016-June/100643.html for more background). This is not wired up yet, but will be in subsequent patches. For testing, the new functionality is exposed to opt with a -strip-nonlinetable-debuginfo option. The secondary use-case (and one that works right now!) is as a reduction pass in bugpoint. I added two new bugpoint options (-disable-strip-debuginfo and -disable-strip-debug-types) to control the new features. By default it will first attempt to remove all debug information, then only the type info, and then proceed to hack at any remaining MDNodes. Thanks to Adrian Prantl for stewarding this patch! llvm-svn: 285094
* Disable fatal errors in the Verifier instantiated by bugpoint's crashAdrian Prantl2016-10-181-3/+3
| | | | | | | | | | | debugger. When bugpoint hacks at a testcase it may at one point create illegal debug info metadata that won't even pass the Verifier. A bugpoint *driver* built with assertions should not assert on it, but reject the malformed intermediate step and continue to do its job. llvm-svn: 284490
* Turn cl::values() (for enum) from a vararg function to using C++ variadic ↵Mehdi Amini2016-10-081-4/+2
| | | | | | | | | | | | | | | template The core of the change is supposed to be NFC, however it also fixes what I believe was an undefined behavior when calling: va_start(ValueArgs, Desc); with Desc being a StringRef. Differential Revision: https://reviews.llvm.org/D25342 llvm-svn: 283671
* Revert "Add -strip-nonlinetable-debuginfo capability"Michael Ilseman2016-10-061-31/+0
| | | | | | | | This reverts commit r283473. Reverted until review is completed. llvm-svn: 283478
* Add -strip-nonlinetable-debuginfo capabilityMichael Ilseman2016-10-061-0/+31
| | | | | | | | | | | | | | | | | | | | | | This adds a new function to DebugInfo.cpp that takes an llvm::Module as input and removes all debug info metadata that is not directly needed for line tables, thus effectively stripping all type and variable information from the module. The primary motivation for this feature was the bitcode work flow (cf. http://lists.llvm.org/pipermail/llvm-dev/2016-June/100643.html for more background). This is not wired up yet, but will be in subsequent patches. For testing, the new functionality is exposed to opt with a -strip-nonlinetable-debuginfo option. The secondary use-case (and one that works right now!) is as a reduction pass in bugpoint. I added two new bugpoint options (-disable-strip-debuginfo and -disable-strip-debug-types) to control the new features. By default it will first attempt to remove all debug information, then only the type info, and then proceed to hack at any remaining MDNodes. llvm-svn: 283473
* Retire bugpoint's -R. hack.Joerg Sonnenberger2016-10-012-9/+2
| | | | | | | | | It got disconnected during the cmake conversion. For Miscompilation.cpp, it was purely advisory for the user and the ToolRunner.cpp version was trying to compensate for libs and bins in the same directory, which hasn't been the case for a very long time. llvm-svn: 283022
* HAVE_LINK_R is not the only reason why this needs config.h.Joerg Sonnenberger2016-09-301-1/+1
| | | | llvm-svn: 282923
* Don't create a SymbolTable in Function when the LLVMContext discards value ↵Mehdi Amini2016-09-171-6/+3
| | | | | | | | | | | | | | names (NFC) The ValueSymbolTable is used to detect name conflict and rename instructions automatically. This is not needed when the value names are automatically discarded by the LLVMContext. No functional change intended, just saving a little bit of memory. This is a recommit of r281806 after fixing the accessor to return a pointer instead of a reference and updating all the call-sites. llvm-svn: 281813
* Ensure Polly linking works without BUILD_SHARED_LIBSTobias Grosser2016-09-141-0/+2
| | | | | | | | | This change ensures all necessary symbols are resolved correctly. Before this change on some systems, the linker may have eliminated some symbols not directly used in bugpoint, but used in Polly. Suggested-by: Michael Kruse <lvm@meinersbur.de> llvm-svn: 281438
* bugpoint: Return Errors instead of passing around stringsJustin Bogner2016-09-0610-543/+558
| | | | | | | | | | | | | 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
* Revert "bugpoint: Stop threading errors through APIs that never fail"Justin Bogner2016-09-067-90/+112
| | | | | | | | | | | | | 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
* bugpoint: Stop threading errors through APIs that never failJustin Bogner2016-09-067-112/+90
| | | | | | | | | | | | | 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
* bugpoint: clang-format all of bugpoint. NFCJustin Bogner2016-09-0211-1157/+1088
| | | | | | | I'm going to clean up the APIs here a bit and touch many many lines anyway. llvm-svn: 280450
* bugpoint: clang-format and modernize comments in ListReducer. NFCJustin Bogner2016-09-011-36/+32
| | | | llvm-svn: 280414
* [PM] Port the always inliner to the new pass manager in a much moreChandler Carruth2016-08-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | minimal and boring form than the old pass manager's version. This pass does the very minimal amount of work necessary to inline functions declared as always-inline. It doesn't support a wide array of things that the legacy pass manager did support, but is alse ... about 20 lines of code. So it has that going for it. Notably things this doesn't support: - Array alloca merging - To support the above, bottom-up inlining with careful history tracking and call graph updates - DCE of the functions that become dead after this inlining. - Inlining through call instructions with the always_inline attribute. Instead, it focuses on inlining functions with that attribute. The first I've omitted because I'm hoping to just turn it off for the primary pass manager. If that doesn't pan out, I can add it here but it will be reasonably expensive to do so. The second should really be handled by running global-dce after the inliner. I don't want to re-implement the non-trivial logic necessary to do comdat-correct DCE of functions. This means the -O0 pipeline will have to be at least 'always-inline,global-dce', but that seems reasonable to me. If others are seriously worried about this I'd like to hear about it and understand why. Again, this is all solveable by factoring that logic into a utility and calling it here, but I'd like to wait to do that until there is a clear reason why the existing pass-based factoring won't work. The final point is a serious one. I can fairly easily add support for this, but it seems both costly and a confusing construct for the use case of the always inliner running at -O0. This attribute can of course still impact the normal inliner easily (although I find that a questionable re-use of the same attribute). I've started a discussion to sort out what semantics we want here and based on that can figure out if it makes sense ta have this complexity at O0 or not. One other advantage of this design is that it should be quite a bit faster due to checking for whether the function is a viable candidate for inlining exactly once per function instead of doing it for each call site. Anyways, hopefully a reasonable starting point for this pass. Differential Revision: https://reviews.llvm.org/D23299 llvm-svn: 278896
* Use the range variant of find instead of unpacking begin/endDavid Majnemer2016-08-111-3/+1
| | | | | | | | | If the result of the find is only used to compare against end(), just use is_contained instead. No functionality change is intended. llvm-svn: 278433
* [bugpoint] Add a -Os optionDavid Majnemer2016-07-311-2/+6
| | | | llvm-svn: 277295
* Rework CFG simplification in bugpointDaniel Berlin2016-07-281-48/+164
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Depends on D22841 We now use a much simpler CFG simplification routine for bugpoint, because SimplifyCFG is no longer a good match for what bugpoint wants to do. At the same time, to make sure we don't lose anything valuable it was doing, SimplifyCFG is now run as a per-BB reduction pass. With this and D22841 combined, bugpoint operates both much faster on the large testcases i have, and reduces them to pretty much minimal testcases (in one case, bugpoint used to leave about 6000 useless blocks, and now it leaves 3 ...) Reviewers: chandlerc, majnemer Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D22845 llvm-svn: 277063
* Make bugpoint transform conditional jumps into unconditional jumps.Daniel Berlin2016-07-271-0/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add a pass to bugpoint to make it transform conditional jumps into unconditional jumps. Often, bugpoint generates output that has large numbers of br undef jumps, where one side is dead. What is happening is two fold: 1. It never tries to just pick a direction for the jump, and just see what happens <<<< this patch 2. SimplifyCFG no longer is a good match for bugpoint's usecase. It does too much. Even things in SimplifyCFG, like removeUnreachableBlocks, go to great lengths to transform undefined behavior into blocks and kill large parts of the CFG. This is great for regular code, not so much for bugpoint, which often generates UB on purpose (store undef is a great example). <<<< a followup patch that is coming, to move simplifycfg into a separate reduction pass, and move the existing reduceCrashingBlocks pass to use simpleSimplifyCFG. Both of these patches significantly reduce the size and complexity of bugpoint generated testcases. Reviewers: chandlerc, majnemer Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D22841 llvm-svn: 276884
* bugpoint: add flag -verbose-errorsSebastian Pop2016-07-151-1/+7
| | | | | | | | | | | | The default behavior of bugpoint is to print "<crash>" when it finds a reduced test that crashes compilation. With this flag we now can see the output of the crashing program. This is useful to make sure it is the same error being tracked down and not a different error that happens to crash the compiler as well. Differential Revision: https://reviews.llvm.org/D22411 llvm-svn: 275646
* [bugpoint] Delete a stale comment.Philip Reames2016-06-291-3/+0
| | | | llvm-svn: 274093
* [bugpoint] Unwrap one level of wrapper functions [NFC]Philip Reames2016-06-292-18/+11
| | | | llvm-svn: 274092
* [bugpoint] Extract helper functions for readability [NFCI]Philip Reames2016-06-291-51/+64
| | | | | | And remove the use of a label(!) in the process. llvm-svn: 274087
* [bugpoint] Simplify code by moving exception to only callerPhilip Reames2016-06-294-12/+10
| | | | llvm-svn: 274083
* [bugpoint] Treat token type the same as ehpad w.r.t deletionPhilip Reames2016-06-291-4/+4
| | | | llvm-svn: 274082
* [bugpoint] Disabling one transform shouldn't prevent reporting the progress ↵Philip Reames2016-06-291-2/+2
| | | | | | of the former llvm-svn: 274081
* [Bugpoint] Erase comdat annotations after removing a global's initializer.Justin Lebar2016-06-152-0/+4
| | | | | | | | | | | | | | | Summary: This is necessary to keep the verifier happy after bugpoint removes an initializer from a global variable with a comdat annotation, because globals without initializers may not have comdats. Reviewers: majnemer, rnk Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D21274 llvm-svn: 272854
* Search for llvm-symbolizer binary in the same directory as argv[0], beforeRichard Smith2016-06-091-1/+1
| | | | | | | looking for it along $PATH. This allows installs of LLVM tools outside of $PATH to find the symbolizer and produce pretty backtraces if they crash. llvm-svn: 272232
* Apply most suggestions of clang-tidy's performance-unnecessary-value-paramBenjamin Kramer2016-06-082-3/+3
| | | | | | | Avoids unnecessary copies. All changes audited & pass tests with asan. No functional change intended. llvm-svn: 272190
* Apply clang-tidy's misc-move-constructor-init throughout LLVM.Benjamin Kramer2016-05-271-6/+7
| | | | | | No functionality change intended, maybe a tiny performance improvement. llvm-svn: 270997
* [GlobalDCE, Misc] Don't remove functions referenced by ifuncsDavid Majnemer2016-05-041-2/+2
| | | | | | | | | | | | We forgot to consider the target of ifuncs when considering if a function was alive or dead. N.B. Also update a few auxiliary tools like bugpoint and verify-uselistorder. This fixes PR27593. llvm-svn: 268468
* Remove every uses of getGlobalContext() in LLVM (but the C API)Mehdi Amini2016-04-141-1/+1
| | | | | | | | | | | At the same time, fixes InstructionsTest::CastInst unittest: yes you can leave the IR in an invalid state and exit when you don't destroy the context (like the global one), no longer now. This is the first part of http://reviews.llvm.org/D19094 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266379
OpenPOWER on IntegriCloud