summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/IR/IRBuilderTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* DI: Reverse direction of subprogram -> function edge.Peter Collingbourne2015-11-051-3/+5
| | | | | | | | | | | | | | | | | | | | | | | Previously, subprograms contained a metadata reference to the function they described. Because most clients need to get or set a subprogram for a given function rather than the other way around, this created unneeded inefficiency. For example, many passes needed to call the function llvm::makeSubprogramMap() to build a mapping from functions to subprograms, and the IR linker needed to fix up function references in a way that caused quadratic complexity in the IR linking phase of LTO. This change reverses the direction of the edge by storing the subprogram as function-level metadata and removing DISubprogram's function field. Since this is an IR change, a bitcode upgrade has been provided. Fixes PR23367. An upgrade script for textual IR for out-of-tree clients is attached to the PR. Differential Revision: http://reviews.llvm.org/D14265 llvm-svn: 252219
* unittests: Remove implicit ilist iterator conversions, NFCDuncan P. N. Exon Smith2015-10-201-2/+2
| | | | llvm-svn: 250843
* Remove DIFile from createSubroutineType.Eric Christopher2015-10-151-2/+2
| | | | | | Patch by Amaury Sechet with a small modification by me. llvm-svn: 250374
* Add support for fast-math flags to the FCmp instruction.James Molloy2015-07-101-2/+20
| | | | | | | | | | | | | | FCmp behaves a lot like a floating-point binary operator in many ways, and can benefit from fast-math information. Flags such as nsz and nnan can affect if this fcmp (in combination with a select) can be treated as a fminnum/fmaxnum operation. This adds backwards-compatible bitcode support, IR parsing and writing, LangRef changes and IRBuilder changes. I'll need to audit InstSimplify and InstCombine in a followup to find places where flags should be copied. llvm-svn: 241901
* Fix memory leak in unittest added in r241101.Alexey Samsonov2015-06-301-1/+5
| | | | llvm-svn: 241123
* [DebugInfo] Let IRBuilder::SetInsertPoint(BB::iterator) update current debug ↵Alexey Samsonov2015-06-301-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | location. IRBuilder::SetInsertPoint(BB, BB::iterator) is an older version of IRBuilder::SetInsertPoint(Instruction). However, the latter updates the current debug location of emitted instruction, while the former doesn't, which is confusing. Unify the behavior of these methods: now they both set current debug location to the debug location of instruction at insertion point. The callers of IRBuilder::SetInsertPoint(BB, BB::iterator) doesn't seem to depend on the old behavior (keeping the original debug info location). On the contrary, sometimes they (e.g. SCEV) *should* be updating debug info location, but don't. I'll look at gdb bots after the commit to check that we don't regress on debug info somewhere. This change may make line table more fine-grained, thus increasing debug info size. I haven't observed significant increase, though: it varies from negligible to 0.3% on several binaries and self-hosted Clang. This is yet another change targeted at resolving PR23837. llvm-svn: 241101
* IRBuilder: Add unit tests for construction of globals with address spaceTobias Grosser2015-06-191-0/+12
| | | | | | This was forgotten in r240113. Thanks Eric for paying attention. llvm-svn: 240124
* Move the personality function from LandingPadInst to FunctionDavid Majnemer2015-06-171-2/+1
| | | | | | | | | | | | | | | | | | | The personality routine currently lives in the LandingPadInst. This isn't desirable because: - All LandingPadInsts in the same function must have the same personality routine. This means that each LandingPadInst beyond the first has an operand which produces no additional information. - There is ongoing work to introduce EH IR constructs other than LandingPadInst. Moving the personality routine off of any one particular Instruction and onto the parent function seems a lot better than have N different places a personality function can sneak onto an exceptional function. Differential Revision: http://reviews.llvm.org/D10429 llvm-svn: 239940
* Add convenient overloads for CreateInsertElement and CreateExtractElement ↵Pawel Bylica2015-04-301-0/+15
| | | | | | | | | | | | | | | | | | | | methods in IRBuilder Summary: This pathc add convenient overloads for CreateInsertElement and CreateExtractElement methods in IRBuilder where vector index can be uint64_t instead of Value*. Test Plan: Unit test included. Reviewers: majnemer Reviewed By: majnemer Subscribers: majnemer, llvm-commits Differential Revision: http://reviews.llvm.org/D9347 llvm-svn: 236214
* Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko2015-04-111-2/+2
| | | | | | | | | | | | | | The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' \ -j=32 -fix -format http://reviews.llvm.org/D8925 llvm-svn: 234679
* DebugInfo: Remove DIDescriptor::Verify()Duncan P. N. Exon Smith2015-04-061-3/+1
| | | | | | | | | | | | Remove `DIDescriptor::Verify()` and the `Verify()`s from subclasses. They had already been gutted, and just did an `isa<>` check. In a couple of cases I've temporarily dropped the check entirely, but subsequent commits are going to disallow conversions to the `DIDescriptor`s directly from `MDNode`, so the checks will come back in another form soon enough. llvm-svn: 234201
* Verifier: Move over DISubprogram::Verify()Duncan P. N. Exon Smith2015-03-311-1/+2
| | | | | | | | | | | | | Move over the remaining (somewhat complicated) check from `DISubprogram::Verify()`. I suspect this check could be optimized -- e.g., it would be nice not to do another full traversal here -- but it's not exactly obvious how. For now, just bring it over as is. Once we have a better model for the "canonical" subprogram of a `Function`, we should enforce that all `!dbg` attachments lead to the canonical one. llvm-svn: 233663
* Verifier: Add operand checks for MDLexicalBlockDuncan P. N. Exon Smith2015-03-301-1/+3
| | | | | | | | | | Add operand checks for `MDLexicalBlock` and `MDLexicalBlockFile`. Like `MDLocalVariable` and `MDLocation`, these nodes always require a scope. There was no test bitrot to fix here (just updated the serialization tests in test/Assembler/mdlexicalblock.ll). llvm-svn: 233561
* DataLayout is mandatory, update the API to reflect it with references.Mehdi Amini2015-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Now that the DataLayout is a mandatory part of the module, let's start cleaning the codebase. This patch is a first attempt at doing that. This patch is not exactly NFC as for instance some places were passing a nullptr instead of the DataLayout, possibly just because there was a default value on the DataLayout argument to many functions in the API. Even though it is not purely NFC, there is no change in the validation. I turned as many pointer to DataLayout to references, this helped figuring out all the places where a nullptr could come up. I had initially a local version of this patch broken into over 30 independant, commits but some later commit were cleaning the API and touching part of the code modified in the previous commits, so it seemed cleaner without the intermediate state. Test Plan: Reviewers: echristo Subscribers: llvm-commits From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 231740
* Make DataLayout Non-Optional in the ModuleMehdi Amini2015-03-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: DataLayout keeps the string used for its creation. As a side effect it is no longer needed in the Module. This is "almost" NFC, the string is no longer canonicalized, you can't rely on two "equals" DataLayout having the same string returned by getStringRepresentation(). Get rid of DataLayoutPass: the DataLayout is in the Module The DataLayout is "per-module", let's enforce this by not duplicating it more than necessary. One more step toward non-optionality of the DataLayout in the module. Make DataLayout Non-Optional in the Module Module->getDataLayout() will never returns nullptr anymore. Reviewers: echristo Subscribers: resistor, llvm-commits, jholewinski Differential Revision: http://reviews.llvm.org/D7992 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 231270
* simplify expressionAdrian Prantl2015-01-211-3/+1
| | | | llvm-svn: 226701
* Fix a compile issue on MSVC and call finalize().Adrian Prantl2015-01-211-1/+4
| | | | llvm-svn: 226694
* Let subprograms with instructions without parent scopes fail theAdrian Prantl2015-01-211-0/+17
| | | | | | | | verification. Tested via a unit test. Follow-up to r226616. llvm-svn: 226684
* Fix a logic bug when copying fast-math flags.Sanjay Patel2014-09-021-0/+4
| | | | | | | | | | | | | "Setting" does not equal "copying". This bug has sat dormant for 2 reasons: 1. The unit test was not adequate. 2. Every current user of the "copyFastMathFlags" API is operating on a new instruction. (ie, all existing fast-math flags are off). If you copy flags to an existing instruction that has some flags on already, you will not necessarily turn them off as expected. I uncovered this bug while trying to implement a fix for PR20802. llvm-svn: 216939
* [C++11] Use 'nullptr'.Craig Topper2014-06-081-5/+5
| | | | llvm-svn: 210442
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-3/+2
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* [Modules] Move the NoFolder into the IR library as it createsChandler Carruth2014-03-041-1/+1
| | | | | | instructions. llvm-svn: 202834
* Fix resetting the DataLayout in a Module.Rafael Espindola2014-02-251-0/+8
| | | | | | | | | | | | | | | No tool does this currently, but as everything else in a module we should be able to change its DataLayout. Most of the fix is in DataLayout to make sure it can be reset properly. The test uses Module::setDataLayout since the fact that we mutate a DataLayout is an implementation detail. The module could hold a OwningPtr<DataLayout> and the DataLayout itself could be immutable. Thanks to Philip Reames for pushing me in the right direction. llvm-svn: 202198
* Fix a bug in IRBuilder that's been there for who knows how long. ItChandler Carruth2014-01-051-0/+51
| | | | | | | | failed to correctly propagate the NUW and NSW flags to the constant folder for two instructions. I've added a unittest to cover flag propagation for the rest of the instructions and constant expressions. llvm-svn: 198538
* Use present fast-math flags when applicable in CreateBinOpMichael Ilseman2013-12-051-0/+7
| | | | | | | | We were previously not adding fast-math flags through CreateBinOp() when it happened to be making a floating point binary operator. This patch updates it to do so similarly to directly calling CreateF*(). llvm-svn: 196438
* Give unit test its own LLVMContext so MDNodes aren't leaked even if we never ↵Benjamin Kramer2013-11-151-9/+10
| | | | | | | | call llvm_shutdown. Found by valgrind. llvm-svn: 194797
* Silencing an MSVC warning.Aaron Ballman2013-10-051-2/+2
| | | | llvm-svn: 192042
* IRBuilder: Add RAII objects to reset insertion points or fast math flags.Benjamin Kramer2013-09-301-0/+36
| | | | | | | | Inspired by the object from the SLPVectorizer. This found a minor bug in the debug loc restoration in the vectorizer where the location of a following instruction was attached instead of the location from the original instruction. llvm-svn: 191673
* IRTests/IRBuilderTest.cpp: GetIntTy: Delete DL at yourself since it is not ↵NAKAMURA Takumi2013-01-231-0/+1
| | | | | | linked. llvm-svn: 173238
* IRTests/IRBuilderTest.cpp: Let GV added to the module.NAKAMURA Takumi2013-01-231-2/+2
| | | | | | It fixes --vg-leak. llvm-svn: 173237
* Rename the VMCore unittest tree to IR. Somehow was missed when doing theChandler Carruth2013-01-071-0/+184
library rename. llvm-svn: 171747
OpenPOWER on IntegriCloud