aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/bugpoint/CrashDebugger.cpp
AgeCommit message (Collapse)AuthorFilesLines
6 days[NFC][LLVM] Code cleanup in bugpoint (#162909)Rahul Joshi1-58/+66
- 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 Hirata1-17/+16
2025-03-29[bugpoint] Avoid repeated hash lookups (NFC) (#133616)Kazu Hirata1-11/+5
2025-03-28[tools] Use *Set::insert_range (NFC) (#133384)Kazu Hirata1-4/+1
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 Hirata1-6/+3
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 Kim1-1/+1
`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 Hirata1-1/+1
2023-07-11Ignore modified attribute list if it yields invalid IRManish Kausik H1-36/+23
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 Porpodas1-1/+1
eraseFromParent(). Differential Revision: https://reviews.llvm.org/D138617
2022-09-10Use PoisonValue instead of UndefValue when RAUWing unreachable code [NFC]Manuel Brito1-1/+1
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 Hirata1-1/+1
Identified with readability-qualified-auto.
2022-04-07[bugpoint] ReduceCrashingFunctions::TestFuncs - fix dereference of null ↵Simon Pilgrim1-2/+2
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 Guelton1-1/+1
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 Hirata1-8/+7
2021-10-06[IR][NFC] Rename getBaseObject to getAliaseeObjectItay Bookstein1-1/+1
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 Eubanks1-2/+1
2021-08-13[NFC] Rename AttributeList::getParam/Ret/FnAttributes() -> get*Attributes()Arthur Eubanks1-2/+2
This is more consistent with similar methods.
2021-07-09[NewPM] Consistently use 'simplifycfg' rather than 'simplify-cfg'Bjorn Pettersson1-1/+1
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 Topper1-1/+1
2020-06-07SmallPtrSet::find -> SmallPtrSet::countBenjamin Kramer1-1/+1
The latter is more readable and more efficient. While there clean up some double lookups. NFCI.
2020-01-29One more bugpoitn fix for GCC5Benjamin Kramer1-3/+3
2020-01-29Try harder to fix bugpoint with GCC5Benjamin Kramer1-2/+4
2020-01-29Make bugpoint work with gcc5 again.Benjamin Kramer1-1/+2
2020-01-28Make llvm::StringRef to std::string conversions explicit.Benjamin Kramer1-1/+1
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 Greene1-0/+5
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 Arsenault1-23/+29
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 Hahn1-1/+89
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 Hahn1-1/+15
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 Carruth1-4/+3
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 Gesiak1-0/+92
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 Carruth1-1/+1
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 Carruth1-3/+3
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 Blaikie1-1/+1
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 Espindola1-1/+1
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 Blaikie1-1/+1
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 Espindola1-50/+49
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 Espindola1-4/+4
llvm-svn: 325172
2018-02-14Use std::unique_ptr. NFC.Rafael Espindola1-4/+3
llvm-svn: 325170
2018-02-14Use std::unique_ptr. NFC.Rafael Espindola1-4/+4
llvm-svn: 325167
2018-02-14Use std::unique_ptr. NFC.Rafael Espindola1-6/+5
llvm-svn: 325165
2018-02-14Use std::unique_ptr. NFC.Rafael Espindola1-7/+5
llvm-svn: 325163
2018-02-14Pass a module reference to CloneModule.Rafael Espindola1-11/+11
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 Kumar1-44/+39
More unique_ptr-ification, ranged for loops, etc. llvm-svn: 324705
2018-02-08[bugpoint] Simplify the global initializer reducer, NFCVedant Kumar1-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
2018-02-08Simplify function prototypes in bugpoint, NFCVedant Kumar1-31/+21
llvm-svn: 324633
2017-10-04[SimplifyCFG] put the optional assumption cache pointer in the options ↵Sanjay Patel1-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
2017-09-27[SimplifyCFG] add a struct to house optional folds (PR34603)Sanjay Patel1-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
2017-04-14[Bugpoint] Use boolean AND instead of bitwise AND (PR32660)Simon Pilgrim1-1/+1
llvm-svn: 300327
2017-03-07Fix bugpoint to work with swifterror valuesArnold Schwaighofer1-2/+4
llvm-svn: 297196
2016-10-25Add -strip-nonlinetable-debuginfo capabilityMichael Ilseman1-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