summaryrefslogtreecommitdiff
path: root/llvm/tools/bugpoint/CrashDebugger.cpp
AgeCommit message (Collapse)Author
2025-11-20Revert "[NFC][bugpoint] Namespace cleanup in `bugpoint`" (#168961)Rahul Joshi
Reverts llvm/llvm-project#168921 Causes build failures.
2025-11-20[NFC][bugpoint] Namespace cleanup in `bugpoint` (#168921)Rahul Joshi
Add declaration of command line options to BugDriver.h and remove extern declarations in individual .cpp files.
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-05-18[bugpoint] Use range-based for loops (NFC) (#140438)Kazu Hirata
2025-03-29[bugpoint] Avoid repeated hash lookups (NFC) (#133616)Kazu Hirata
2025-03-28[tools] Use *Set::insert_range (NFC) (#133384)Kazu Hirata
We can use *Set::insert_range to replace "for" loop-based insertions. In some cases, we can further fold insert_range into the set declaration.
2025-03-26[llvm] Use *Set::insert_range (NFC) (#133041)Kazu Hirata
We can use *Set::insert_range to collapse: for (auto Elem : Range) Set.insert(E); down to: Set.insert_range(Range); In some cases, we can further fold that into the set declaration.
2024-11-05Remove leftover uses of llvm::Type::getPointerTo() (#114993)Youngsuk Kim
`llvm::Type::getPointerTo()` is to be deprecated. Replace remaining uses of it.
2024-07-07[llvm] Remove redundant calls to std::unique_ptr<T>::get (NFC) (#97914)Kazu Hirata
2023-07-11Ignore modified attribute list if it yields invalid IRManish Kausik H
If modified attribute list is invalid, reverting the change is a low-cost maintainence solution as compared to examples like [this](https://github.com/llvm/llvm-project/blob/main/llvm/tools/bugpoint/CrashDebugger.cpp#L368). This will ensure that the ListReducer maintains the sanctity of any new attribute dependencies added in the future/already present. Reviewed By: modocache Differential Revision: https://reviews.llvm.org/D154348
2022-11-23[NFC] Replaced BB->getInstList().{erase(),pop_front(),pop_back()} with ↵Vasileios Porpodas
eraseFromParent(). Differential Revision: https://reviews.llvm.org/D138617
2022-09-10Use PoisonValue instead of UndefValue when RAUWing unreachable code [NFC]Manuel Brito
Replacing the following instances of UndefValue with PoisonValue, where the UndefValue is used as an arbitrary value: - llvm/lib/CodeGen/WinEHPrepare.cpp `demotePHIsOnFunclets`: RAUW arbitrary value for lingering uses of removed PHI nodes - llvm/lib/Transforms/Utils/BasicBlockUtils.cpp `FoldSingleEntryPHINodes`: Removes a self-referential single entry phi node. - llvm/lib/Transforms/Utils/CallGraphUpdater.cpp `finalize`: Remove all references to removed functions. - llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp `cleanup`: the result is not used then the inserted instructions are removed. - llvm/tools/bugpoint/CrashDebugger.cpp `TestInts`: the program is cloned and instructions are removed to narrow down source of crash. Differential Revision: https://reviews.llvm.org/D133640
2022-09-03[llvm] Qualify auto in range-based for loops (NFC)Kazu Hirata
Identified with readability-qualified-auto.
2022-04-07[bugpoint] ReduceCrashingFunctions::TestFuncs - fix dereference of null ↵Simon Pilgrim
point static analyzer warning Alias.getAliaseeObject() shouldn't be null, do use dyn_cast instead of dyn_cast_or_null Also, remove redundant `else if (!F)` test - that is always true at the point in the if-else chain
2022-01-10Use a sorted array instead of a map to store AttrBuilder string attributesSerge Guelton
Using and std::map<SmallString, SmallString> for target dependent attributes is inefficient: it makes its constructor slightly heavier, and involves extra allocation for each new string attribute. Storing the attribute key/value as strings implies extra allocation/copy step. Use a sorted vector instead. Given the low number of attributes generally involved, this is cheaper, as showcased by https://llvm-compile-time-tracker.com/compare.php?from=5de322295f4ade692dc4f1823ae4450ad3c48af2&to=05bc480bf641a9e3b466619af43a2d123ee3f71d&stat=instructions Differential Revision: https://reviews.llvm.org/D116599
2021-11-05[llvm] Use make_early_inc_range (NFC)Kazu Hirata
2021-10-06[IR][NFC] Rename getBaseObject to getAliaseeObjectItay Bookstein
To better reflect the meaning of the now-disambiguated {GlobalValue, GlobalAlias}::getBaseObject after breaking off GlobalIFunc::getResolverFunction (D109792), the function is renamed to getAliaseeObject.
2021-08-17[NFC] Cleanup more AttributeList::addAttribute()Arthur Eubanks
2021-08-13[NFC] Rename AttributeList::getParam/Ret/FnAttributes() -> get*Attributes()Arthur Eubanks
This is more consistent with similar methods.
2021-07-09[NewPM] Consistently use 'simplifycfg' rather than 'simplify-cfg'Bjorn Pettersson
There was an alias between 'simplifycfg' and 'simplify-cfg' in the PassRegistry. That was the original reason for this patch, which effectively removes the alias. This patch also replaces all occurrances of 'simplify-cfg' by 'simplifycfg'. Reason for choosing that form for the name is that it matches the DEBUG_TYPE for the pass, and the legacy PM name and also how it is spelled out in other passes such as 'loop-simplifycfg', and in other options such as 'simplifycfg-merge-cond-stores'. I for some reason the name should be changed to 'simplify-cfg' in the future, then I think such a renaming should be more widely done and not only impacting the PassRegistry. Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D105627
2020-07-23[bugpoint] Fix typo in assertion message. NFCCraig Topper
2020-06-07SmallPtrSet::find -> SmallPtrSet::countBenjamin Kramer
The latter is more readable and more efficient. While there clean up some double lookups. NFCI.
2020-01-29One more bugpoitn fix for GCC5Benjamin Kramer
2020-01-29Try harder to fix bugpoint with GCC5Benjamin Kramer
2020-01-29Make bugpoint work with gcc5 again.Benjamin Kramer
2020-01-28Make llvm::StringRef to std::string conversions explicit.Benjamin Kramer
This is how it should've been and brings it more in line with std::string_view. There should be no functional change here. This is mostly mechanical from a custom clang-tidy check, with a lot of manual fixups. It uncovers a lot of minor inefficiencies. This doesn't actually modify StringRef yet, I'll do that in a follow-up.
2019-12-16[Bugpoint] Do not create illegal function attribute combosDavid Greene
If a function requires optnone to trigger a crash, it must also have noline, otherwise it will fail a verifier check. Differential revision: https://reviews.llvm.org/D69522
2019-11-19bugpoint: Add option to disable attribute removalMatt Arsenault
This takes a long time and never reduces anything useful for me (e.g. I've been waiting for 3 hours on a testcase and it hasn't found any attributes to remove yet). This should probably start by assuming no attributes matter, and adding back.
2019-10-30[bugpoint] Reduce metadata that does not contribute to crash.Florian Hahn
Add a new reducer that drops metadata that does not contribute to the crash from instructions. It adjusts the metadata.ll test case, as now also the instruction level metadata will get dropped. Reviewers: davide, reames, modocache Reviewed By: reames Differential Revision: https://reviews.llvm.org/D69234
2019-10-29[bugpoint] Try to reduce passes after reducing everything.Florian Hahn
In some cases, we fail to reduce the pass list earlier because of complex pass dependencies, but we can reduce it after we simplified the reproducer. An example of that is PR43474, which can limit the crash to -loop-interchange. Adding a test case would require at least 2 interacting Loop passes I think. Reviewers: davide, reames, modocache Reviewed By: reames Differential Revision: https://reviews.llvm.org/D69236
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-12-19[bugpoint][PR29027] Reduce function attributesBrian Gesiak
Summary: In addition to reducing the functions in an LLVM module, bugpoint now reduces the function attributes associated with each of the remaining functions. To test this, add a -bugpoint-crashfuncattr test pass, which crashes if a function in the module has a "bugpoint-crash" attribute. A test case demonstrates that the IR is reduced to just that one attribute. Reviewers: MatzeB, silvas, davide, reames Reviewed By: reames Subscribers: reames, llvm-commits Differential Revision: https://reviews.llvm.org/D55216 llvm-svn: 349601
2018-10-15[TI removal] Make `getTerminator()` return a generic `Instruction`.Chandler Carruth
This removes the primary remaining API producing `TerminatorInst` which will reduce the rate at which code is introduced trying to use it and generally make it much easier to remove the remaining APIs across the codebase. Also clean up some of the stragglers that the previous mechanical update of variables missed. Users of LLVM and out-of-tree code generally will need to update any explicit variable types to handle this. Replacing `TerminatorInst` with `Instruction` (or `auto`) almost always works. Most of these edits were made in prior commits using the perl one-liner: ``` perl -i -ple 's/TerminatorInst(\b.* = .*getTerminator\(\))/Instruction\1/g' ``` This also my break some rare use cases where people overload for both `Instruction` and `TerminatorInst`, but these should be easily fixed by removing the `TerminatorInst` overload. llvm-svn: 344504
2018-08-26[IR] Replace `isa<TerminatorInst>` with `isTerminator()`.Chandler Carruth
This is a bit awkward in a handful of places where we didn't even have an instruction and now we have to see if we can build one. But on the whole, this seems like a win and at worst a reasonable cost for removing `TerminatorInst`. All of this is part of the removal of `TerminatorInst` from the `Instruction` type hierarchy. llvm-svn: 340701
2018-06-04Move Analysis/Utils/Local.h back to TransformsDavid Blaikie
Review feedback from r328165. Split out just the one function from the file that's used by Analysis. (As chandlerc pointed out, the original change only moved the header and not the implementation anyway - which was fine for the one function that was used (since it's a template/inlined in the header) but not in general) llvm-svn: 333954
2018-04-24[bugpoint] Fix crash when testing for miscompilation.Rafael Espindola
Method BugDriver::performFinalCleanups(...) would delete Module object it worked on, which was also deleted by its caller (e.g. TestCodeGenerator(...)). Changed the code to avoid double delete and make Module ownership slightly clearer. Patch by Andrzej Janik. llvm-svn: 330763
2018-03-21Fix a couple of layering violations in TransformsDavid Blaikie
Remove #include of Transforms/Scalar.h from Transform/Utils to fix layering. Transforms depends on Transforms/Utils, not the other way around. So remove the header and the "createStripGCRelocatesPass" function declaration (& definition) that is unused and motivated this dependency. Move Transforms/Utils/Local.h into Analysis because it's used by Analysis/MemoryBuiltins.cpp. llvm-svn: 328165
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
2018-02-14Use std::unique_ptr. NFC.Rafael Espindola
llvm-svn: 325172
2018-02-14Use std::unique_ptr. NFC.Rafael Espindola
llvm-svn: 325170
2018-02-14Use std::unique_ptr. NFC.Rafael Espindola
llvm-svn: 325167
2018-02-14Use std::unique_ptr. NFC.Rafael Espindola
llvm-svn: 325165
2018-02-14Use std::unique_ptr. NFC.Rafael Espindola
llvm-svn: 325163
2018-02-14Pass a module reference to CloneModule.Rafael Espindola
It can never be null and most callers were already using references or std::unique_ptr. llvm-svn: 325160
2018-02-09[bugpoint] Simplify reducers which can fail verification, NFCVedant Kumar
More unique_ptr-ification, ranged for loops, etc. llvm-svn: 324705
2018-02-08[bugpoint] Simplify the global initializer reducer, NFCVedant Kumar
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
2018-02-08Simplify function prototypes in bugpoint, NFCVedant Kumar
llvm-svn: 324633
2017-10-04[SimplifyCFG] put the optional assumption cache pointer in the options ↵Sanjay Patel
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
2017-09-27[SimplifyCFG] add a struct to house optional folds (PR34603)Sanjay Patel
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
2017-04-14[Bugpoint] Use boolean AND instead of bitwise AND (PR32660)Simon Pilgrim
llvm-svn: 300327