summaryrefslogtreecommitdiffstats
path: root/llvm/tools/bugpoint
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* ValueMapper: Add support for seeding metadata with nullptrDuncan P. N. Exon Smith2016-04-021-1/+1
| | | | | | | | | | | | | Support seeding a ValueMap with nullptr for Metadata entries, a situation I didn't consider in the Metadata/Value split. I added a ValueMapper::getMappedMD accessor that returns an Optional<Metadata*> with the mapped (possibly null) metadata. IRMover needs to use this to avoid modifying the map when it's checking for unneeded subprograms. I updated a call from bugpoint since I find the new code clearer. llvm-svn: 265228
* Add an IR Verifier check for orphaned DICompileUnits.Adrian Prantl2016-03-281-1/+3
| | | | | | | | | A DICompileUnit that is not listed in llvm.dbg.cu will cause assertion failures and/or crashes in the backend. The Verifier should reject this. rdar://problem/25369499 llvm-svn: 264657
* Fix Clang-tidy readability-redundant-control-flow warnings; other minor fixes.Eugene Zelenko2016-02-021-8/+5
| | | | | | Differential revision: http://reviews.llvm.org/D16793 llvm-svn: 259539
* Avoid overly large SmallPtrSet/SmallSetMatthias Braun2016-01-301-2/+2
| | | | | | | These sets perform linear searching in small mode so it is never a good idea to use SmallSize/N bigger than 32. llvm-svn: 259283
* Remove autoconf supportChris Bieneman2016-01-261-18/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened." - Obi Wan Kenobi Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D16471 llvm-svn: 258861
* Change linkInModule to take a std::unique_ptr.Rafael Espindola2015-12-162-5/+6
| | | | | | | Passing in a std::unique_ptr should help find errors when the module is used after being linked into another module. llvm-svn: 255842
* Use diagnostic handler in the LLVMContextRafael Espindola2015-12-142-23/+5
| | | | | | | | | | | | | | | | 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
* Simplify testMergedProgram.Rafael Espindola2015-12-091-26/+19
| | | | | | It now receives and returns std::unique_ptr. llvm-svn: 255087
* Simplify memory management. NFC.Rafael Espindola2015-12-091-79/+72
| | | | | | | This passes std::unique_ptr to predicates that are expected to delete their argument. llvm-svn: 255086
* Return std::unique_ptr from SplitFunctionsOutOfModule. NFC.Rafael Espindola2015-12-093-30/+25
| | | | llvm-svn: 255084
* Simplify memory management. NFC.Rafael Espindola2015-12-091-11/+10
| | | | llvm-svn: 255082
* Simplify memory management a bit. NFC.Rafael Espindola2015-12-091-9/+8
| | | | llvm-svn: 255079
* Return a std::unique_ptr from CloneModule. NFC.Rafael Espindola2015-12-083-22/+22
| | | | llvm-svn: 255078
* Always pass a diagnostic handler to the linker.Rafael Espindola2015-12-042-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Use references now that it is natural to do so.Rafael Espindola2015-12-012-5/+5
| | | | | | | 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
* [bugpoint] Fix "Alias must point to a definition" problemsHal Finkel2015-11-263-4/+41
| | | | | | | | | | | | | | | | | | GlobalAliases may reference function definitions, but not function declarations. bugpoint would sometimes create invalid IR by deleting a function's body (thus mutating a function definition into a declaration) without first 'fixing' any GlobalAliases that reference that function definition. This change iteratively prevents that issue. Before deleting a function's body, it scans the module for GlobalAliases which reference that function. When found, it eliminates them using replaceAllUsesWith. Fixes PR20788. Patch by Nick Johnson! llvm-svn: 254171
* Make bugpoint ehpad/token friendlyDavid Majnemer2015-11-081-4/+5
| | | | | | | Tokens shouldn't be blindly replaced with undef/null. Also, don't try to remove EH pad instructions from the top of basic blocks. llvm-svn: 252414
* Fix bugpoint breakage on libcxx introduced by r252247Keno Fischer2015-11-061-2/+2
| | | | llvm-svn: 252253
* [bugpoint] Add a named metadata (+their operands) reducerKeno Fischer2015-11-061-0/+173
| | | | | | | | | | | | | | | | | | | Summary: We frequently run bugpoint on a linked module that consists of all modules we create while jitting the julia standard library. This module has a very large number of compile units (10000+) in `llvm.dbg.cu`, which didn't get reduced at all, requiring manual post processing. This is an attempt to have bugpoint go through and attempt to reduce the number of global named metadata nodes as well as their operands, to cut down the number of roots for such metadata. Reviewers: dexonsmith, reames, pete Subscribers: pete, dexonsmith, reames, llvm-commits Differential Revision: http://reviews.llvm.org/D14043 llvm-svn: 252247
* bugpoint: Remove implicit ilist iterator conversions, NFCDuncan P. N. Exon Smith2015-10-203-56/+47
| | | | | | | | This is the last of the implicit ilist iterator conversions in LLVM. Still up for debate whether we let these bitrot back: http://lists.llvm.org/pipermail/llvm-dev/2015-October/091617.html llvm-svn: 250852
* [bugpoint] llvm-gcc doesn't exist anymore ...Davide Italiano2015-10-151-8/+1
| | | | | | ... so this comment is stale. Remove it. Range-loopify while here. llvm-svn: 250354
* [Bugpoint] Use 'CC' instead of 'GCC' for variable naming.Davide Italiano2015-10-146-149/+149
| | | | | | | | | | 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
* [Bugpoint] Use clang by default.Davide Italiano2015-10-141-2/+9
| | | | | | | | | | We now rely on gcc only if either of the following is true: 1) -gcc option is passed by the user 2) clang is not found in the default path. Differential Revision: http://reviews.llvm.org/D13642 llvm-svn: 250318
* [Bugpoint] Get rid of dead code. No functional change.Davide Italiano2015-10-111-19/+0
| | | | llvm-svn: 249999
* Replace some calls to isa<LandingPadInst> with isEHPad()David Majnemer2015-08-191-1/+1
| | | | | | No functionality change is intended. llvm-svn: 245487
* [PM/AA] Remove the last relics of the separate IPA library from LLVM,Chandler Carruth2015-08-182-2/+0
| | | | | | | | | | | | | | | | | | | | | folding the code into the main Analysis library. There already wasn't much of a distinction between Analysis and IPA. A number of the passes in Analysis are actually IPA passes, and there doesn't seem to be any advantage to separating them. Moreover, it makes it hard to have interactions between analyses that are both local and interprocedural. In trying to make the Alias Analysis infrastructure work with the new pass manager, it becomes particularly awkward to navigate this split. I've tried to find all the places where we referenced this, but I may have missed some. I have also adjusted the C API to continue to be equivalently functional after this change. Differential Revision: http://reviews.llvm.org/D12075 llvm-svn: 245318
* bugpoint: make the number of trim iterations a compile-time constantTobias Grosser2015-07-261-3/+9
| | | | | | | | | | | | Around 10 year ago Chris limited this code to a single iteration by just dropping a break into the loop body. We now make the number of trim iterations a compile time constant to be able to play with it and see if this can improve the bugpoint results. We currently use with '3' still a small and conservative value, but this can be adjusted in the future, if needed. I tried to look for a trivial test case, but did not succeed yet. llvm-svn: 243247
* Wrap some long lines in LLVMBuild files. NFCDouglas Katzman2015-06-121-1/+11
| | | | | | | As suggested by jroelofs in a prior review (D9752), it makes sense to generally prefer multi-line format. llvm-svn: 239632
* Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer2015-05-292-10/+5
| | | | | | | | | | | | | | | | | | | | If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. llvm-svn: 238602
* [bugpoint] Increase default memory limit to 400MB to fix bugpoint tests.Daniel Sanders2015-05-051-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. llvm-svn: 236504
OpenPOWER on IntegriCloud