summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
Commit message (Collapse)AuthorAgeFilesLines
* Return iterator from Instruction::eraseFromParent.Daniel Berlin2015-04-021-2/+2
| | | | | | | | | | | | | | | | | Summary: This is necessary in order to make removal while using reverse iterators work. (See http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-March/084122.html) Updates to other eraseFromParent's to come in later patches. Reviewers: chandlerc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8783 llvm-svn: 233869
* git-clang-format r233603.Rafael Espindola2015-04-011-1/+1
| | | | | | Thanks to Meador Inge for noticing. llvm-svn: 233808
* [WinEH] Generate .xdata for catch handlersDavid Majnemer2015-03-311-7/+0
| | | | | | | | | | | | | | This lets us catch exceptions in simple cases. N.B. Things that do not work include (but are not limited to): - Throwing from within a catch handler. - Catching an object with a named catch parameter. - 'CatchHigh' is fictitious, we aren't sure of its purpose. - We aren't entirely efficient with regards to the number of EH states that we generate. - IP-to-State tables are sensitive to the order of emission. llvm-svn: 233767
* IR: Enable uniquing callbacks during MDNode::replaceWithUniqued()Duncan P. N. Exon Smith2015-03-311-0/+4
| | | | | | | | | | | | | | | | Uniqued nodes have more complete registration with `ReplaceableMetadataImpl` so that they can update themselves when operands change. Fix a bug where `MDNode::replaceWithUniqued()` wasn't enabling these callbacks. The two most obvious ways missing callbacks causes problems is that auto-resolution fails and re-uniquing (on changed operands) just doesn't happen. I've added tests for both -- in both cases, I confirmed that the final check was failing before the fix. rdar://problem/20365935 llvm-svn: 233751
* Verifier: Don't return early from verifyTypeRefs()Duncan P. N. Exon Smith2015-03-311-8/+2
| | | | | | | | We'll no longer crash in the `verifyTypeRefs()` (used to be called `verifyDebugInfo()`), so there's no reason to return early here. Remove the `EverBroken` member since this was the only use! llvm-svn: 233665
* Verifier: Explicitly verify type referencesDuncan P. N. Exon Smith2015-03-311-83/+93
| | | | | | | | | | | | | `verifyDebugInfo()` was doing two things: - Asserting on unresolved type references. - Calling `Verify()` functions for various types of debug info. The `Verify()` functions have been gutted, so rename the function to `verifyTypeRefs()` and explicitly check those. Instead of assertions, we get nice error messages now. llvm-svn: 233664
* Verifier: Move over DISubprogram::Verify()Duncan P. N. Exon Smith2015-03-312-33/+40
| | | | | | | | | | | | | 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
* DebugInfo: Rewrite llvm::getDISubprogram(), NFCDuncan P. N. Exon Smith2015-03-311-11/+3
| | | | | | | | Simplify implementation of `llvm::getDISubprogram()`. I might go through and see how difficult it is to update the users, since this function doesn't really seem necessary anymore. llvm-svn: 233662
* DebugInfo: Hide isScopeRef() and isTypeRef() behind NDEBUGDuncan P. N. Exon Smith2015-03-311-1/+1
| | | | | | | | | The copies of these in `lib/IR/DebugInfo.cpp` are apparently [1] only used in assertions now, so hide them behind `#ifndef NDEBUG`. [1]: http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/9238 llvm-svn: 233661
* Verifier: Check reference flags in debug infoDuncan P. N. Exon Smith2015-03-312-18/+13
| | | | | | Move over checks of `&` and `&&` flags. llvm-svn: 233658
* Verifier: Move more debug info checks away from Verify()Duncan P. N. Exon Smith2015-03-312-42/+3
| | | | | | | | | | Most of these checks were already in the `Verifier` so this is more of a cleanup. Now almost everything is over there. Now that require a `name:` for `MDGlobalVariable`, add a check in `LLParser` for it. llvm-svn: 233657
* Verifier: Move checks over from DIDescriptor::Verify()Duncan P. N. Exon Smith2015-03-312-56/+36
| | | | | | | | | | | | | | Move over some more checks from `DIDescriptor::Verify()`, and change `LLParser` to require non-null `file:` fields in compile units. I've ignored the comment in test/Assembler/metadata-null-operands.ll since I disagree with it. At the time that test was written (r229960), the debug info verifier wasn't on by default, so my comment there is in the context of not expecting the verifier to be useful. It is now, and besides that, since r233394 we can check when parsing textual IR whether an operand is null that shouldn't be. llvm-svn: 233654
* DebugLoc: Remove getFromDILexicalBlock()Duncan P. N. Exon Smith2015-03-301-9/+0
| | | | | | | | | The only user of `DebugLoc::getFromDILexicalBlock()` was creating a new `MDLocation` as convenient API for passing an `MDScope`. Stop doing that, and remove the API. If in the future we actually *want* to create new DebugLocs, calling `MDLexicalBlock::get()` makes more sense. llvm-svn: 233643
* [opaque pointer type] Change GetElementPtrInst::getIndexedType to take the ↵David Blaikie2015-03-304-15/+14
| | | | | | | | | | pointee type This pushes the use of PointerType::getElementType up into several callers - I'll essentially just have to keep pushing that up the stack until I can eliminate every call to it... llvm-svn: 233604
* Fix PR23045.Rafael Espindola2015-03-301-10/+19
| | | | | | | | | Keep a note in the materializer that we are stripping debug info so that user doing a lazy read of the module don't hit outdated formats. Thanks to Duncan for suggesting the fix. llvm-svn: 233603
* DwarfDebug: Avoid creating new DebugLocs in the backendDuncan P. N. Exon Smith2015-03-301-0/+6
| | | | | | | Don't use `DebugLoc::getFnDebugLoc()`, which creates new `MDLocation`s, in the backend. We just want to grab the subprogram here anyway. llvm-svn: 233601
* DebugInfo: Remove dead code from old DebugLoc APIDuncan P. N. Exon Smith2015-03-301-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove old API for `DebugLoc` now that all the callers have been updated. If this broke your out-of-tree build, here's a quick map from the old API to the new one: DebugLoc DebugLoc::getFromMDLocation(MDNode *) => DebugLoc::DebugLoc(MDLocation *) => explicit DebugLoc::DebugLoc(MDNode *) // works with broken code MDNode *DebugLoc::getAsMDNode(LLVMContext &) => MDLocation *DebugLoc::get() => DebugLoc::operator MDLocation *() => MDNode *DebugLoc::getAsMDNode() // works with broken code bool DebugLoc::isUnknown() => DebugLoc::operator MDLocation *() i.e.: if (MDLocation *DL = ...) => DebugLoc::operator bool() // works with broken code i.e.: if (DebugLoc DL = ...) void DebugLoc::getScopeAndInlinedAt(MDNode *&, MDNode *&) => use: MDNode *DebugLoc::getScope() and: MDLocation *DebugLoc::getInlinedAt() MDNode *DebugLoc::getScopeNode(LLVMContext &) => MDNode *DebugLoc::getInlinedAtScope() void DebugLoc::dump(LLVMContext &) => void DebugLoc::dump() void DebugLoc::getFnDebugLoc(LLVMContext &) => void DebugLoc::getFnDebugLoc() MDNode *DebugLoc::getScope(LLVMContext &) => MDNode *DebugLoc::getScope() MDNode *DebugLoc::getInlinedAt(LLVMContext &) => MDLocation *DebugLoc::getInlinedAt() I've noted above the only functions that won't crash on broken code (due to downcasting to `MDLocation`). If your code could be dealing with broken IR (i.e., you haven't run the verifier yet, or you've used a temporary node that will eventually (but not yet) get RAUW'ed to an `MDLocation`), you need to restrict yourself to those. llvm-svn: 233599
* Use range loops and add missing braces.Rafael Espindola2015-03-301-7/+7
| | | | llvm-svn: 233598
* IR: Use the new DebugLoc API, NFCDuncan P. N. Exon Smith2015-03-304-19/+17
| | | | | | | | Update lib/IR and lib/Bitcode to use the new `DebugLoc` API. Added an explicit conversion to `bool` (avoiding a conversion to `MDLocation`), since a couple of these use cases need to handle broken code. llvm-svn: 233585
* DebugInfo: Reflow printDebugLoc() to use early returns, NFCDuncan P. N. Exon Smith2015-03-301-15/+18
| | | | llvm-svn: 233580
* DebugInfo: Write new DebugLoc APIDuncan P. N. Exon Smith2015-03-301-53/+63
| | | | | | | | | | | | | | | | | Rewrite `DebugLoc` with a cleaner API that reflects its current status as a wrapper around an `MDLocation` pointer. - Add accessors/constructors to/from `MDLocation`. - Simplify construction from `MDNode`. - Remove unnecessary `LLVMContext` from APIs. - Drop some API that isn't useful any more. - Rewrite documentation. Actually, I've left the old API behind temporarily at the bottom of the class so that I can update callers in separate commits. I'll remove it once the callers are updated. llvm-svn: 233573
* DebugInfo: Implement MDLocation::getInlinedAtScope()Duncan P. N. Exon Smith2015-03-302-6/+2
| | | | | | | | | Write `MDLocation::getInlinedAtScope()` and use it to re-implement `DebugLoc::getScopeNode()` (and simplify `DISubprogram::Verify()`). This follows the inlined-at linked list and returns the scope of the deepest/last location. llvm-svn: 233568
* Verifier: Add operand checks for remaining debug infoDuncan P. N. Exon Smith2015-03-304-16/+43
| | | | llvm-svn: 233565
* DebugInfo: Simplify logic in DISubprogram::Verify(), NFCDuncan P. N. Exon Smith2015-03-301-13/+8
| | | | | | | Simplify the logic in `DISubprogram::Verify()` by using the new debug info hierarchy directly instead of the `DebugLoc` wrapper. llvm-svn: 233563
* Verifier: Loosen r233559 check for 'function:' field in MDSubprogramDuncan P. N. Exon Smith2015-03-301-3/+2
| | | | | | | | | | Stop worrying about what the `function:` field is in `MDSubprogram`, since it could be a bitcast [1]. Just check its type and leave it at that. [1]: http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_build/3540/ llvm-svn: 233562
* Verifier: Add operand checks for MDLexicalBlockDuncan P. N. Exon Smith2015-03-304-10/+22
| | | | | | | | | | 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
* Verifier: Check operands of MDSubprogram nodesDuncan P. N. Exon Smith2015-03-304-31/+94
| | | | | | | | | | | Check operands of `MDSubprogram`s in the verifier, and update the accessors and factory functions to use more specific types. There were a lot of broken testcases, which I fixed in r233466. If you have out-of-tree tests for debug info, you probably need similar changes to the ones I made there. llvm-svn: 233559
* Trying to fix the Hexagon and debian-fast bots arm32_neon_vcnt_upgrade.ll test.Yaron Keren2015-03-301-1/+1
| | | | llvm-svn: 233558
* Remove more superfluous .str() and replace std::string concatenation with Twine.Yaron Keren2015-03-304-5/+5
| | | | | | Following r233392, http://llvm.org/viewvc/llvm-project?rev=233392&view=rev. llvm-svn: 233555
* Silence sign compare warning. NFC.Benjamin Kramer2015-03-291-1/+2
| | | | llvm-svn: 233502
* [inline asm] Don't reject duplicated matching constraintsBenjamin Kramer2015-03-291-1/+2
| | | | | | | They're harmless and it's easy to generate them from clang, leading to a crash in LLVM. Found by afl-fuzz. llvm-svn: 233500
* [ConstantFold] Don't fold ppc_fp128 <-> int bitcastsHal Finkel2015-03-281-2/+13
| | | | | | | | | | | | | PPC_FP128 is really the sum of two consecutive doubles, where the first double is always stored first in memory, regardless of the target endianness. The memory layout of i128, however, depends on the target endianness, and so we can't fold this without target endianness information. As a result, we must not do this folding in lib/IR/ConstantFold.cpp (it could be done instead in Analysis/ConstantFolding.cpp, but that's not done now). Fixes PR23026. llvm-svn: 233481
* Verifier: Allow subroutine types to have no type arrayDuncan P. N. Exon Smith2015-03-281-6/+5
| | | | | | | | | Loosen one check from r233446: as long as `DIBuilder` requires a non-null type for every subprogram, we should allow a null type array. Also add tests for the rest of `MDSubroutineType`, which were somehow missing. llvm-svn: 233468
* Verifier: Check operands of MDType subclasses and MDCompileUnitDuncan P. N. Exon Smith2015-03-274-53/+135
| | | | | | | | | | | | | | | | | Add verify checks for `MDType` subclasses and for `MDCompileUnit`. These new checks don't yet incorporate everything from `Verify()`, but at least they sanity check the operands. Also downcast accessors as possible. A lot of these accessors can't be downcast as far as we'd like because of arrays of typed objects (stored in a generic `MDTuple`) and `MDString`-based type references. Eventually I'll port over `DIRef<>` and `DITypedArray<>` from `DebugInfo.h` to clean those up as well. Updated bitrotted testcases separately in r233415 and r233443 to reduce churn on the off-chance this needs to be reverted. llvm-svn: 233446
* DebugInfo: Require non-null in DIBuilder::retainType()Duncan P. N. Exon Smith2015-03-271-1/+4
| | | | | | | Assert that a non-null value is being passed in. Note that I fixed the one offender in clang in r233443. llvm-svn: 233445
* LLParser: Require non-null scope for MDLocation and MDLocalVariableDuncan P. N. Exon Smith2015-03-271-0/+2
| | | | | | | | | Change `LLParser` to require a non-null `scope:` field for both `MDLocation` and `MDLocalVariable`. There's no need to wait for the verifier for this check. This also allows their `::getImpl()` methods to assert that the incoming scope is non-null. llvm-svn: 233394
* Verifier: Check fields of MDVariable subclassesDuncan P. N. Exon Smith2015-03-274-35/+77
| | | | | | | | | | | | | | | | Check fields from `MDLocalVariable` and `MDGlobalVariable` and change the accessors to downcast to the right types. `getType()` still returns `Metadata*` since it could be an `MDString`-based reference. Since local variables require non-null scopes, I also updated `LLParser` to require a `scope:` field. A number of testcases had grown bitrot and started failing with this patch; I committed them separately in r233349. If I just broke your out-of-tree testcases, you're probably hitting similar problems (so have a look there). llvm-svn: 233389
* Require a GC strategy be specified for functions which use gc.statepointPhilip Reames2015-03-271-0/+4
| | | | | | This was discussed a while back and I left it optional for migration. Since it's been far more than the 'week or two' that was discussed, time to actually make this manditory. llvm-svn: 233357
* WinEH: Create a parent frame alloca for HandlerType xdata tablesDavid Majnemer2015-03-271-0/+7
| | | | | | | | We don't have any logic to emit those tables yet, so the SDAG lowering of this intrinsic is just a stub. We can see the intrinsic in the prepared IR, though. llvm-svn: 233354
* DIBuilder: Change a few helpers to return downcasted MDNodesDuncan P. N. Exon Smith2015-03-271-4/+4
| | | | | | | | | Change `getNonCompileUnitScope()` to return `MDScope` and `getConstantAsMetadata()` to return `ConstantAsMetadata`. This will make it easier to start requiring more type safety in the debug info hierarchy. llvm-svn: 233340
* AsmWriter: Cleanup debug info fields with MDFieldPrinter, NFCDuncan P. N. Exon Smith2015-03-271-385/+248
| | | | | | | | | | Move all the `MDNode` field helper methods into a new class, `MDFieldPrinter`, and add helpers for integers, bools, and `DW_*` symbolic constants. This reduces a ton of code duplication, and makes it more mechanical to update `AsmWriter` to print broken code in the context of stricter accessors (like in r233322). llvm-svn: 233337
* Verifier: Check accessors of MDLocationDuncan P. N. Exon Smith2015-03-263-9/+9
| | | | | | | | | | | | | | | | | | | | Check accessors of `MDLocation`, and change them to `cast<>` down to the right types. Also add type-safe factory functions. All the callers that handle broken code need to use the new versions of the accessors (`getRawScope()` instead of `getScope()`) that still return `Metadata*`. This is also necessary for things like `MDNodeKeyImpl<MDLocation>` (in LLVMContextImpl.h) that need to unique the nodes when their operands might still be forward references of the wrong type. In the `Value` hierarchy, consumers that handle broken code use `getOperand()` directly. However, debug info nodes have a ton of operands, and their order (even their existence) isn't stable yet. It's safer and more maintainable to add an explicit "raw" accessor on the class itself. llvm-svn: 233322
* WinEH: Create an unwind help alloca for __CxxFrameHandler3 xdata tablesReid Kleckner2015-03-251-0/+7
| | | | | | | | We don't have any logic to emit those tables yet, so the sdag lowering of this intrinsic is just a stub. We can see the intrinsic in the prepared IR, though. llvm-svn: 233209
* DebugInfo: Permit DW_TAG_structure_type, DW_TAG_member, DW_TAG_typedef tags ↵Peter Collingbourne2015-03-251-1/+3
| | | | | | | | | | | | | | | | | with empty file names. Some languages, such as Go, have pre-defined structure types (e.g. "string" is essentially a pointer/length pair) or pre-defined "typedef" types (e.g. "error" is essentially a typedef for a specific interface type). Such types do not have associated source location, so a Go frontend would be correct not to associate a file name with such types. This change relaxes the DIType verifier to permit unlocated types with these tags. Differential Revision: http://reviews.llvm.org/D8588 llvm-svn: 233200
* Verifier: Start recursing into !dbg attachmentsDuncan P. N. Exon Smith2015-03-241-4/+2
| | | | | | | | | | The main verifier already recurses through the other entry points, so we might as well descend here too. This temporarily duplicates some work already done in `verifyDebugInfo()`, but eventually I'll be removing the other side. llvm-svn: 233095
* Verifier: !llvm.dbg.cu must point at compile unitsDuncan P. N. Exon Smith2015-03-241-0/+11
| | | | | | Duplicate this check from `verifyDebugInfo()`. llvm-svn: 233094
* DebugInfo: Overload get() in DIDescriptor subclassesDuncan P. N. Exon Smith2015-03-231-25/+44
| | | | | | | | | | | | | | | Continue to simplify the `DIDescriptor` subclasses, so that they behave more like raw pointers. Remove `getRaw()`, replace it with an overloaded `get()`, and overload the arrow and cast operators. Two testcases started to crash on the arrow operators with this change because of `scope:` references that weren't real scopes. I fixed them. Soon I'll add verifier checks for them too. This also adds explicit dereference operators. Previously, the builtin dereference against `operator MDNode *()` would have worked, but now the builtins are ambiguous. llvm-svn: 233030
* Refactor: Simplify boolean expressions in llvm IRDavid Blaikie2015-03-231-28/+22
| | | | | | | | | | | Simplify boolean expressions using `true` and `false` with `clang-tidy` Patch by Richard Thomson with a few other simplifications to fix else-after-returns in the surrounding code. Differential Revision: http://reviews.llvm.org/D8527 llvm-svn: 233005
* Re-sort includes with sort-includes.py and insert raw_ostream.h where it's used.Benjamin Kramer2015-03-233-0/+3
| | | | llvm-svn: 232998
* [gcov] Move formatBranchInfo into an anonymous namespace.Benjamin Kramer2015-03-231-1/+1
| | | | | | NFC. llvm-svn: 232949
OpenPOWER on IntegriCloud