summaryrefslogtreecommitdiffstats
path: root/llvm/tools/bugpoint
Commit message (Collapse)AuthorAgeFilesLines
...
* Pass a module reference to CloneModule.Rafael Espindola2018-02-143-25/+25
| | | | | | | It can never be null and most callers were already using references or std::unique_ptr. llvm-svn: 325160
* Pass a reference to a module to the bitcode writer.Rafael Espindola2018-02-141-3/+3
| | | | | | | This simplifies most callers as they are already using references or std::unique_ptr. llvm-svn: 325155
* [bugpoint] Report non-existent opt binaryVedant Kumar2018-02-091-0/+4
| | | | | | | | Bugpoint will keep going even if the opt binary it's given doesn't exist. It should at least alert the user, so it's clear why reductions are failing. llvm-svn: 324713
* [bugpoint] Simplify reducers which can fail verification, NFCVedant Kumar2018-02-092-47/+41
| | | | | | More unique_ptr-ification, ranged for loops, etc. llvm-svn: 324705
* [bugpoint] Delete a dead cl::opt (-child-output)Vedant Kumar2018-02-091-3/+0
| | | | | | This option isn't used anywhere, as far as I can tell. llvm-svn: 324704
* [bugpoint] Simplify the global initializer reducer, NFCVedant Kumar2018-02-081-61/+59
| | | | | | | | | | | | Fix the comments, use early exits, use unique_ptr, and use ranged for loops. This is in preparation for a global *variable* reducer, which, with any luck will help us clean up test cases. Differential Revision: https://reviews.llvm.org/D43084 llvm-svn: 324649
* Simplify function prototypes in bugpoint, NFCVedant Kumar2018-02-081-31/+21
| | | | llvm-svn: 324633
* [llvm-extract] Support extracting basic blocksVolkan Keles2018-01-231-3/+9
| | | | | | | | | | | | | | | | Summary: Currently, there is no way to extract a basic block from a function easily. This patch extends llvm-extract to extract the specified basic block(s). Reviewers: loladiro, rafael, bogner Reviewed By: bogner Subscribers: hintonda, mgorny, qcolombet, llvm-commits Differential Revision: https://reviews.llvm.org/D41638 llvm-svn: 323266
* Remove redundant includes from tools.Michael Zolotukhin2017-12-132-8/+0
| | | | llvm-svn: 320631
* [CMake] Use PRIVATE in target_link_libraries for executablesShoaib Meenai2017-12-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently use target_link_libraries without an explicit scope specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables. Dependencies added in this way apply to both the target and its dependencies, i.e. they become part of the executable's link interface and are transitive. Transitive dependencies generally don't make sense for executables, since you wouldn't normally be linking against an executable. This also causes issues for generating install export files when using LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM library dependencies, which are currently added as interface dependencies. If clang is in the distribution components but the LLVM libraries it depends on aren't (which is a perfectly legitimate use case if the LLVM libraries are being built static and there are therefore no run-time dependencies on them), CMake will complain about the LLVM libraries not being in export set when attempting to generate the install export file for clang. This is reasonable behavior on CMake's part, and the right thing is for LLVM's build system to explicitly use PRIVATE dependencies for executables. Unfortunately, CMake doesn't allow you to mix and match the keyword and non-keyword target_link_libraries signatures for a single target; i.e., if a single call to target_link_libraries for a particular target uses one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must also be updated to use those keywords. This means we must do this change in a single shot. I also fully expect to have missed some instances; I tested by enabling all the projects in the monorepo (except dragonegg), and configuring both with and without shared libraries, on both Darwin and Linux, but I'm planning to rely on the buildbots for other configurations (since it should be pretty easy to fix those). Even after this change, we still have a lot of target_link_libraries calls that don't specify a scope keyword, mostly for shared libraries. I'm thinking about addressing those in a follow-up, but that's a separate change IMO. Differential Revision: https://reviews.llvm.org/D40823 llvm-svn: 319840
* Remove unnecessary code.Rafael Espindola2017-11-221-3/+0
| | | | | | There is already an RAII in place to discard the temporary. llvm-svn: 318868
* Convert the last use of sys::fs::createUniqueFile in bugpoint.Rafael Espindola2017-11-161-14/+8
| | | | llvm-svn: 318459
* Convert another use of createUniqueFile to TempFile::create.Rafael Espindola2017-11-164-12/+25
| | | | | | | This one requires a new small feature in TempFile: the ability to keep the temporary file with the temporary name. llvm-svn: 318458
* Convert another use of createUniqueFile to TempFile::create.Rafael Espindola2017-11-164-22/+22
| | | | llvm-svn: 318427
* Convert a use of createUniqueFile to TempFile::create.Rafael Espindola2017-11-161-19/+20
| | | | llvm-svn: 318361
* [SimplifyCFG] put the optional assumption cache pointer in the options ↵Sanjay Patel2017-10-041-1/+1
| | | | | | | | | | | | struct; NFCI This is a follow-up to https://reviews.llvm.org/D38138. I fixed the capitalization of some functions because we're changing those lines anyway and that helped verify that we weren't accidentally dropping any options by using default param values. llvm-svn: 314930
* [SimplifyCFG] add a struct to house optional folds (PR34603)Sanjay Patel2017-09-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was intended to be no-functional-change, but it's not - there's a test diff. So I thought I should stop here and post it as-is to see if this looks like what was expected based on the discussion in PR34603: https://bugs.llvm.org/show_bug.cgi?id=34603 Notes: 1. The test improvement occurs because the existing 'LateSimplifyCFG' marker is not carried through the recursive calls to 'SimplifyCFG()->SimplifyCFGOpt().run()->SimplifyCFG()'. The parameter isn't passed down, so we pick up the default value from the function signature after the first level. I assumed that was a bug, so I've passed 'Options' down in all of the 'SimplifyCFG' calls. 2. I split 'LateSimplifyCFG' into 2 bits: ConvertSwitchToLookupTable and KeepCanonicalLoops. This would theoretically allow us to differentiate the transforms controlled by those params independently. 3. We could stash the optional AssumptionCache pointer and 'LoopHeaders' pointer in the struct too. I just stopped here to minimize the diffs. 4. Similarly, I stopped short of messing with the pass manager layer. I have another question that could wait for the follow-up: why is the new pass manager creating the pass with LateSimplifyCFG set to true no matter where in the pipeline it's creating SimplifyCFG passes? // Create an early function pass manager to cleanup the output of the // frontend. EarlyFPM.addPass(SimplifyCFGPass()); --> /// \brief Construct a pass with the default thresholds /// and switch optimizations. SimplifyCFGPass::SimplifyCFGPass() : BonusInstThreshold(UserBonusInstThreshold), LateSimplifyCFG(true) {} <-- switches get converted to lookup tables and loops may not be in canonical form If this is unintended, then it's possible that the current behavior of dropping the 'LateSimplifyCFG' setting via recursion was masking this bug. Differential Revision: https://reviews.llvm.org/D38138 llvm-svn: 314308
* [Support] Rename tool_output_file to ToolOutputFile, NFCReid Kleckner2017-09-232-5/+5
| | | | | | | This class isn't similar to anything from the STL, so it shouldn't use the STL naming conventions. llvm-svn: 314050
* Convenience/safety fix for llvm::sys::Execute(And|No)WaitAlexander Kornienko2017-09-132-7/+9
| | | | | | | | | | | | | | | | | | | | Summary: Change the type of the Redirects parameter of llvm::sys::ExecuteAndWait, ExecuteNoWait and other APIs that wrap them from `const StringRef **` to `ArrayRef<Optional<StringRef>>`, which is safer and simplifies the use of these APIs (no more local StringRef variables just to get a pointer to). Corresponding clang changes will be posted as a separate patch. Reviewers: bkramer Reviewed By: bkramer Subscribers: vsk, llvm-commits Differential Revision: https://reviews.llvm.org/D37563 llvm-svn: 313155
* Fix check-llvm on kernel 4.9+ with asan or msanVitaly Buka2017-09-011-4/+10
| | | | | | | | | | | | | | Summary: Before https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?h=v4.9.46&id=84638335900f1995495838fe1bd4870c43ec1f67 test worked because memory allocated with mmap was not counted against RLIMIT_DATA. Reviewers: eugenis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37366 llvm-svn: 312303
* [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
OpenPOWER on IntegriCloud