summaryrefslogtreecommitdiff
path: root/llvm/tools/bugpoint/ExtractFunction.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.
2023-02-27[IPO] Remove various legacy passesArthur Eubanks
These are part of the optimization pipeline, of which the legacy pass manager version is deprecated and being removed.
2022-11-23[NFC] Replaced BB->getInstList().{erase(),pop_front(),pop_back()} with ↵Vasileios Porpodas
eraseFromParent(). Differential Revision: https://reviews.llvm.org/D138617
2020-07-27Use llvm::is_contained where appropriate (NFC)Kazu Hirata
Summary: This patch replaces std::find with llvm::is_contained where appropriate. Reviewers: efriedma, nhaehnle Reviewed By: nhaehnle Subscribers: arsenm, jvesely, nhaehnle, hiraditya, rogfer01, kerbowa, llvm-commits, vkmr Tags: #llvm Differential Revision: https://reviews.llvm.org/D84489
2019-09-30[bugpoint] Update runPasses to take ArrayRef instead of a pointer (NFC)Florian Hahn
This makes it slightly easier to pass extra arguments to runPasses and simplifies the code slightly. Reviewers: efriedma, bogner, dblaikie, diegotf, hiraditya Reviewed By: dblaikie, hiraditya Differential Revision: https://reviews.llvm.org/D68228 llvm-svn: 373265
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-05-14Rename DEBUG macro to LLVM_DEBUG.Nicola Zaghen
The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM - Manual change to APInt - Manually chage DOCS as regex doesn't match it. In the transition period the DEBUG() macro is still present and aliased to the LLVM_DEBUG() one. Differential Revision: https://reviews.llvm.org/D43624 llvm-svn: 332240
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-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-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-01-23[llvm-extract] Support extracting basic blocksVolkan Keles
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
2017-11-16Convert another use of createUniqueFile to TempFile::create.Rafael Espindola
llvm-svn: 318427
2017-09-23[Support] Rename tool_output_file to ToolOutputFile, NFCReid Kleckner
This class isn't similar to anything from the STL, so it shouldn't use the STL naming conventions. llvm-svn: 314050
2017-05-09Suppress all uses of LLVM_END_WITH_NULL. NFC.Serge Guelton
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
2017-04-11[bugpoint] Also remove comdat's from externalized GVsHal Finkel
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
2016-09-02bugpoint: clang-format all of bugpoint. NFCJustin Bogner
I'm going to clean up the APIs here a bit and touch many many lines anyway. llvm-svn: 280450
2016-06-29[bugpoint] Simplify code by moving exception to only callerPhilip Reames
llvm-svn: 274083
2016-06-15[Bugpoint] Erase comdat annotations after removing a global's initializer.Justin Lebar
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
2015-12-09Return std::unique_ptr from SplitFunctionsOutOfModule. NFC.Rafael Espindola
llvm-svn: 255084
2015-12-08Return a std::unique_ptr from CloneModule. NFC.Rafael Espindola
llvm-svn: 255078
2015-11-26[bugpoint] Fix "Alias must point to a definition" problemsHal Finkel
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
2015-10-20bugpoint: Remove implicit ilist iterator conversions, NFCDuncan P. N. Exon Smith
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
2015-02-26Replace a few instances of NULL with nullptr.David Majnemer
llvm-svn: 230599
2015-02-13[PM] Remove the old 'PassManager.h' header file at the top level ofChandler Carruth
LLVM's include tree and the use of using declarations to hide the 'legacy' namespace for the old pass manager. This undoes the primary modules-hostile change I made to keep out-of-tree targets building. I sent an email inquiring about whether this would be reasonable to do at this phase and people seemed fine with it, so making it a reality. This should allow us to start bootstrapping with modules to a certain extent along with making it easier to mix and match headers in general. The updates to any code for users of LLVM are very mechanical. Switch from including "llvm/PassManager.h" to "llvm/IR/LegacyPassManager.h". Qualify the types which now produce compile errors with "legacy::". The most common ones are "PassManager", "PassManagerBase", and "FunctionPassManager". llvm-svn: 229094
2014-08-26Return a std::unique_ptr from parseInputFile and propagate. NFC.Rafael Espindola
The memory management in BugPoint is fairly convoluted, so this just unwraps one layer by changing the return type of functions that always return owned Modules. llvm-svn: 216464
2014-06-13Remove 'using std::error_code' from tools.Rafael Espindola
llvm-svn: 210876
2014-06-12Don't use 'using std::error_code' in include/llvm.Rafael Espindola
This should make sure that most new uses use the std prefix. llvm-svn: 210835
2014-04-25[C++] Use 'nullptr'. Tools edition.Craig Topper
llvm-svn: 207176
2014-04-21[Modules] Make Support/Debug.h modular. This requires it to not changeChandler Carruth
behavior based on other files defining DEBUG_TYPE, which means it cannot define DEBUG_TYPE at all. This is actually better IMO as it forces folks to define relevant DEBUG_TYPEs for their files. However, it requires all files that currently use DEBUG(...) to define a DEBUG_TYPE if they don't already. I've updated all such files in LLVM and will do the same for other upstream projects. This still leaves one important change in how LLVM uses the DEBUG_TYPE macro going forward: we need to only define the macro *after* header files have been #include-ed. Previously, this wasn't possible because Debug.h required the macro to be pre-defined. This commit removes that. By defining DEBUG_TYPE after the includes two things are fixed: - Header files that need to provide a DEBUG_TYPE for some inline code can do so by defining the macro before their inline code and undef-ing it afterward so the macro does not escape. - We no longer have rampant ODR violations due to including headers with different DEBUG_TYPE definitions. This may be mostly an academic violation today, but with modules these types of violations are easy to check for and potentially very relevant. Where necessary to suppor headers with DEBUG_TYPE, I have moved the definitions below the includes in this commit. I plan to move the rest of the DEBUG_TYPE macros in LLVM in subsequent commits; this one is big enough. The comments in Debug.h, which were hilariously out of date already, have been updated to reflect the recommended practice going forward. llvm-svn: 206822
2014-01-13[cleanup] Move the Dominators.h and Verifier.h headers into the IRChandler Carruth
directory. These passes are already defined in the IR library, and it doesn't make any sense to have the headers in Analysis. Long term, I think there is going to be a much better way to divide these matters. The dominators code should be fully separated into the abstract graph algorithm and have that put in Support where it becomes obvious that evn Clang's CFGBlock's can use it. Then the verifier can manually construct dominance information from the Support-driven interface while the Analysis library can provide a pass which both caches, reconstructs, and supports a nice update API. But those are very long term, and so I don't want to leave the really confusing structure until that day arrives. llvm-svn: 199082
2014-01-09Put the functionality for printing a value to a raw_ostream as anChandler Carruth
operand into the Value interface just like the core print method is. That gives a more conistent organization to the IR printing interfaces -- they are all attached to the IR objects themselves. Also, update all the users. This removes the 'Writer.h' header which contained only a single function declaration. llvm-svn: 198836
2014-01-07Move the LLVM IR asm writer header files into the IR directory, as theyChandler Carruth
are part of the core IR library in order to support dumping and other basic functionality. Rename the 'Assembly' include directory to 'AsmParser' to match the library name and the only functionality left their -- printing has been in the core IR library for quite some time. Update all of the #includes to match. All of this started because I wanted to have the layering in good shape before I started adding support for printing LLVM IR using the new pass infrastructure, and commandline support for the new pass infrastructure. llvm-svn: 198688
2013-07-05Add a createUniqueFile function and switch llvm's users of unique_file.Rafael Espindola
This function is complementary to createTemporaryFile. It handles the case were the unique file is *not* temporary: we will rename it in the end. Since we will rename it, the file has to be in the same filesystem as the final destination and we don't prepend the system temporary directory. This has a small semantic difference from unique_file: the default mode is 0666. This matches the behavior of most unix tools. For example, with this change lld now produces files with the same permissions as ld. I will add a test of this change when I port clang over to createUniqueFile (next commit). llvm-svn: 185726
2013-06-17Don't use PathV1.h in ExtractFunction.cpp.Rafael Espindola
llvm-svn: 184102
2013-06-13Don't use PathV1.h in Signals.h.Rafael Espindola
llvm-svn: 183947
2013-01-02Move all of the header files which are involved in modelling the LLVM IRChandler Carruth
into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. llvm-svn: 171366
2012-12-04Sort the #include lines for tools/...Chandler Carruth
Again, tools are trickier to pick the main module header for than library source files. I've started to follow the pattern of using LLVMContext.h when it is included as a stub for program source files. llvm-svn: 169252
2012-10-08Move TargetData to DataLayout.Micah Villmow
llvm-svn: 165403
2012-05-04Move the CodeExtractor utility to a dedicated header file / source file,Chandler Carruth
and expose it as a utility class rather than as free function wrappers. The simple free-function interface works well for the bugpoint-specific pass's uses of code extraction, but in an upcoming patch for more advanced code extraction, they simply don't expose a rich enough interface. I need to expose various stages of the process of doing the code extraction and query information to decide whether or not to actually complete the extraction or give up. Rather than build up a new predicate model and pass that into these functions, just take the class that was actually implementing the functions and lift it up into a proper interface that can be used to perform code extraction. The interface is cleaned up and re-documented to work better in a header. It also is now setup to accept the blocks to be extracted in the constructor rather than in a method. In passing this essentially reverts my previous commit here exposing a block-level query for eligibility of extraction. That is no longer necessary with the more rich interface as clients can query the extraction object for eligibility directly. This will reduce the number of walks of the input basic block sequence by quite a bit which is useful if this enters the normal optimization pipeline. llvm-svn: 156163
2012-02-22Improve handling of blockaddresses in bugpoint when splitting a module. ↵Eli Friedman
Patch by Daniel Reynaud. llvm-svn: 151115
2011-11-15Remove all remaining uses of Value::getNameStr().Benjamin Kramer
llvm-svn: 144648
2011-07-18land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner
llvm-svn: 135375
2011-07-12Second attempt at de-constifying LLVM Types in FunctionType::get(),Jay Foad
StructType::get() and TargetData::getIntPtrType(). llvm-svn: 134982
2011-07-12Revert r134893 and r134888 (and related patches in other trees). It was causingBill Wendling
an assert on Darwin llvm-gcc builds. Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.llvm-gcc-i386-darwin9-RA/llvm.src/lib/VMCore/Instructions.cpp, li\ ne 2067. etc. http://smooshlab.apple.com:8013/builders/llvm-gcc-i386-darwin9-RA/builds/2354 --- Reverse-merging r134893 into '.': U include/llvm/Target/TargetData.h U include/llvm/DerivedTypes.h U tools/bugpoint/ExtractFunction.cpp U unittests/Support/TypeBuilderTest.cpp U lib/Target/ARM/ARMGlobalMerge.cpp U lib/Target/TargetData.cpp U lib/VMCore/Constants.cpp U lib/VMCore/Type.cpp U lib/VMCore/Core.cpp U lib/Transforms/Utils/CodeExtractor.cpp U lib/Transforms/Instrumentation/ProfilingUtils.cpp U lib/Transforms/IPO/DeadArgumentElimination.cpp U lib/CodeGen/SjLjEHPrepare.cpp --- Reverse-merging r134888 into '.': G include/llvm/DerivedTypes.h U include/llvm/Support/TypeBuilder.h U include/llvm/Intrinsics.h U unittests/Analysis/ScalarEvolutionTest.cpp U unittests/ExecutionEngine/JIT/JITTest.cpp U unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp U unittests/VMCore/PassManagerTest.cpp G unittests/Support/TypeBuilderTest.cpp U lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp U lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp U lib/VMCore/IRBuilder.cpp G lib/VMCore/Type.cpp U lib/VMCore/Function.cpp G lib/VMCore/Core.cpp U lib/VMCore/Module.cpp U lib/AsmParser/LLParser.cpp U lib/Transforms/Utils/CloneFunction.cpp G lib/Transforms/Utils/CodeExtractor.cpp U lib/Transforms/Utils/InlineFunction.cpp U lib/Transforms/Instrumentation/GCOVProfiling.cpp U lib/Transforms/Scalar/ObjCARC.cpp U lib/Transforms/Scalar/SimplifyLibCalls.cpp U lib/Transforms/Scalar/MemCpyOptimizer.cpp G lib/Transforms/IPO/DeadArgumentElimination.cpp U lib/Transforms/IPO/ArgumentPromotion.cpp U lib/Transforms/InstCombine/InstCombineCompares.cpp U lib/Transforms/InstCombine/InstCombineAndOrXor.cpp U lib/Transforms/InstCombine/InstCombineCalls.cpp U lib/CodeGen/DwarfEHPrepare.cpp U lib/CodeGen/IntrinsicLowering.cpp U lib/Bitcode/Reader/BitcodeReader.cpp llvm-svn: 134949
2011-07-11De-constify Types in StructType::get() and TargetData::getIntPtrType().Jay Foad
llvm-svn: 134893
2011-07-09Land the long talked about "type system rewrite" patch. ThisChris Lattner
patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. llvm-svn: 134829
2011-06-20Revamp the "ConstantStruct::get" methods. Previously, these were scatteredChris Lattner
all over the place in different styles and variants. Standardize on two preferred entrypoints: one that takes a StructType and ArrayRef, and one that takes StructType and varargs. In cases where there isn't a struct type convenient, we now add a ConstantStruct::getAnon method (whose name will make more sense after a few more patches land). It would be "really really nice" if the ConstantStruct::get and ConstantVector::get methods didn't make temporary std::vectors. llvm-svn: 133412