summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
Commit message (Collapse)AuthorAgeFilesLines
* llvm-cov: Warn instead of error if a .gcda has arcs from an exit blockJustin Bogner2015-03-171-1/+3
| | | | | | Patch by Vanderson M. Rosario. Thanks! llvm-svn: 232443
* Verifier: Don't call debug info verifier if the module is brokenDuncan P. N. Exon Smith2015-03-161-1/+6
| | | | | | | | | | | | | | | | | | | | If `Verifier` has already found a failure, don't call `DebugInfoVerifier`. The latter sometimes crashes in `DebugInfoFinder` when the former would give a nice message. The only two cases I found it crashing are explicit verifier tests I've added: - test/Verifier/llvm.dbg.declare-expression.ll - test/Verifier/llvm.dbg.value-expression.ll However, I assume frontends with bugs will create invalid IR as well. IMO, the `DebugInfoVerifier` should never crash (instead, it should fail to verify), but subtleties like that will be easier to work out once it's enabled again. This is part of PR22777. llvm-svn: 232418
* AsmWriter: Handle broken metadata nodesDuncan P. N. Exon Smith2015-03-161-2/+2
| | | | | | | Print out temporary `MDNode`s so we don't crash in the verifier (or during `dump()` output). llvm-svn: 232417
* Verifier: Simplify logic in processCallInst(), NFCDuncan P. N. Exon Smith2015-03-161-8/+4
| | | | | | No need for local variables here. llvm-svn: 232413
* IR: Take advantage of -verify checks for MDExpressionDuncan P. N. Exon Smith2015-03-162-11/+1
| | | | | | | | | | | | | | | | | | Now that we check `MDExpression` during `-verify` (r232299), make the `DIExpression` wrapper more strict: - remove redundant checks in `DebugInfoVerifier`, - overload `get()` to `cast_or_null<MDExpression>` (superseding `getRaw()`), - stop checking for null in any accessor, and - remove `DIExpression::Verify()` entirely in favour of `MDExpression::isValid()`. There is still some logic in this class, mostly to do with high-level iterators; I'll defer cleaning up those until the rest of the wrappers are similarly strict. llvm-svn: 232412
* DebugInfo: Simplify logic in DIType::Verify(), NFCDuncan P. N. Exon Smith2015-03-161-18/+20
| | | | | | | | | | Clarify the logic in `DIType::Verify()` by checking `isBasicType()` earlier, by skipping `else` after `return`s, and by documenting an otherwise opaque check. No functionality change. llvm-svn: 232410
* Verifier: Remove unnecessary double-checksDuncan P. N. Exon Smith2015-03-161-4/+0
| | | | | | | | | | | Turns out `visitIntrinsicFunctionCall()` descends into all operands already, so explicitly descending in `visitDbgIntrinsic()` (part of r232296) isn't useful. Updating a testcase that doesn't really need `-verify-debug-info` (since r231082) as confirmation. llvm-svn: 232408
* Fix doxygen comments from r232268Duncan P. N. Exon Smith2015-03-161-8/+8
| | | | llvm-svn: 232388
* IR: Default the Metadata::dump() argument "harder" after r232275Duncan P. N. Exon Smith2015-03-151-0/+3
| | | | | | | | | | Use an overload instead of a default argument for `Metadata::dump()`. The latter seems to require calling `dump(nullptr)` explicitly when using a debugger, where as the former doesn't. Other than utility for debugging, there's NFC here. llvm-svn: 232315
* DbgIntrinsicInst: Downcast to specialized MDNodes in accessorsDuncan P. N. Exon Smith2015-03-151-2/+2
| | | | | | | Change accessors to downcast to `MDLocalVariable` and `MDExpression`, now that we have -verify checks in place to confirm that it's safe. llvm-svn: 232299
* Verifier: Check debug info intrinsic argumentsDuncan P. N. Exon Smith2015-03-151-0/+24
| | | | | | | | | | | | | | | | | | | Verify that debug info intrinsic arguments are valid. (These checks will not recurse through the full debug info graph, so they don't need to be cordoned of in `DebugInfoVerifier`.) With those checks in place, changing the `DbgIntrinsicInst` accessors to downcast to `MDLocalVariable` and `MDExpression` is natural (added isa specializations in `Metadata.h` to support this). Added tests to `test/Verifier` for the new -verify checks, and fixed the debug info in all the in-tree tests. If you have out-of-tree testcases that have started to fail to -verify, hopefully the verify checks are helpful. The most likely problem is that the expression argument is `!{}` (instead of `!MDExpression()`). llvm-svn: 232296
* [opaque pointer type] IRBuilder gep migration progressDavid Blaikie2015-03-151-1/+1
| | | | llvm-svn: 232294
* Verifier: Remove unnecessary null checkDuncan P. N. Exon Smith2015-03-151-3/+3
| | | | | | | This is already assumed to be non-null above due to a dyn_cast<>. Also remove extraneous braces around statement. llvm-svn: 232292
* Verifier: Make the raw_ostream constructor argument requiredDuncan P. N. Exon Smith2015-03-151-2/+2
| | | | | | This was passed inconsistently; seems clearer to make it required anyway. llvm-svn: 232291
* IR: Make Metadata::print() reliable and usefulDuncan P. N. Exon Smith2015-03-142-34/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replumb the `AsmWriter` so that `Metadata::print()` is generally useful. (Similarly change `Metadata::printAsOperand()`.) - `SlotTracker` now has a mode where all metadata will be correctly numbered when initializing a `Module`. Normally, `Metadata` only referenced from within `Function`s gets numbered when the `Function` is incorporated. - `Metadata::print()` and `Metadata::printAsOperand()` (and `Metadata::dump()`) now take an optional `Module` argument. When provided, `SlotTracker` is initialized with the new mode, and the numbering will be complete and consistent for all calls to `print()`. - `Value::print()` uses the new `SlotTracker` mode when printing intrinsics with `MDNode` operands, `MetadataAsValue` operands, or the bodies of functions. Thus, metadata numbering will be consistent between calls to `Metadata::print()` and `Value::print()`. - `Metadata::print()` (and `Metadata::dump()`) now print the full definition of `MDNode`s: !5 = !{!6, !"abc", !7} This matches behaviour for `Value::print()`, which includes the name of instructions. - Updated call sites in `Verifier` to call `print()` instead of `printAsOperand()`. All this, so that `Verifier` can print out useful failure messages that involve `Metadata` for PR22777. Note that `Metadata::printAsOperand()` previously took an optional `bool` and `Module` operand. The former was cargo-culted from `Value::printAsOperand()` and wasn't doing anything useful. The latter didn't give consistent results (without the new `SlotTracker` mode). llvm-svn: 232275
* AsmWriter: Split out SlotTracker::processInstructionMetadata(), NFCDuncan P. N. Exon Smith2015-03-141-18/+24
| | | | llvm-svn: 232273
* AsmWriter: Use range-based for, NFCDuncan P. N. Exon Smith2015-03-141-15/+13
| | | | llvm-svn: 232272
* Recover the ability to 'b CheckFailed' after r231577Duncan P. N. Exon Smith2015-03-141-6/+15
| | | | | | | | | | Given that the stated purpose of `CheckFailed()` is to provide a nice spot for a breakpoint, it'd be nice not to have to use a regex to break on it. Recover the ability to simply use `b CheckFailed` by specializing the message-only version, and by changing the variadic version to call into the message-only version. llvm-svn: 232268
* [opaque pointer type] Start migrating GEP creation to explicitly specify the ↵David Blaikie2015-03-141-6/+8
| | | | | | | | | | | | | | | pointee type I'm just going to migrate these in a pretty ad-hoc & incremental way - providing the backwards compatible API for now, then locally removing it, fixing a few callers, adding it back in and commiting those callers. Rinse, repeat. The assertions should ensure that if I get this wrong we'll find out about it and not just have one giant patch to revert, recommit, revert, recommit, etc. llvm-svn: 232240
* Be lazy about loading metadata in IRObjectFile.Rafael Espindola2015-03-131-0/+6
| | | | | | | This speeds up llvm-ar building lib64/libclangSema.a with debug IR files from 8.658015807 seconds to just 0.351036519 seconds :-) llvm-svn: 232221
* AsmWriter: Write alloca array size explicitly (and -instcombine fixup)Duncan P. N. Exon Smith2015-03-131-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Write the `alloca` array size explicitly when it's non-canonical. Previously, if the array size was `iX 1` (where X is not 32), the type would mutate to `i32` when round-tripping through assembly. The testcase I added fails in `verify-uselistorder` (as well as `FileCheck`), since the use-lists for `i32 1` and `i64 1` change. (Manman Ren came across this when running `verify-uselistorder` on some non-trivial, optimized code as part of PR5680.) The type mutation started with r104911, which allowed array sizes to be something other than an `i32`. Starting with r204945, we "canonicalized" to `i64` on 64-bit platforms -- and then on every round-trip through assembly, mutated back to `i32`. I bundled a fixup for `-instcombine` to avoid r204945 on scalar allocations. (There wasn't a clean way to sequence this into two commits, since the assembly change on its own caused testcase churn, and the `-instcombine` change can't be tested without the assembly changes.) An obvious alternative fix -- change `AllocaInst::AllocaInst()`, `AsmWriter` and `LLParser` to treat `intptr_t` as the canonical type for scalar allocations -- was rejected out of hand, since this required teaching them each about the data layout. A follow-up commit will add an `-instcombine` to canonicalize the scalar allocation array size to `i32 1` rather than leaving `iX 1` alone. rdar://problem/20075773 llvm-svn: 232200
* [opaque pointer type] Add textual IR support for explicit type parameter to ↵David Blaikie2015-03-131-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gep operator Similar to gep (r230786) and load (r230794) changes. Similar migration script can be used to update test cases, which successfully migrated all of LLVM and Polly, but about 4 test cases needed manually changes in Clang. (this script will read the contents of stdin and massage it into stdout - wrap it in the 'apply.sh' script shown in previous commits + xargs to apply it over a large set of test cases) import fileinput import sys import re rep = re.compile(r"(getelementptr(?:\s+inbounds)?\s*\()((<\d*\s+x\s+)?([^@]*?)(|\s*addrspace\(\d+\))\s*\*(?(3)>)\s*)(?=$|%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|zeroinitializer|<|\[\[[a-zA-Z]|\{\{)", re.MULTILINE | re.DOTALL) def conv(match): line = match.group(1) line += match.group(4) line += ", " line += match.group(2) return line line = sys.stdin.read() off = 0 for match in re.finditer(rep, line): sys.stdout.write(line[off:match.start()]) sys.stdout.write(conv(match)) off = match.end() sys.stdout.write(line[off:]) llvm-svn: 232184
* ConstantFold: Fix big shift constant foldingDavid Majnemer2015-03-131-21/+12
| | | | | | | | | | | | | Constant folding for shift IR instructions ignores all bits above 32 of second argument (shift amount). Because of that, some undef results are not recognized and APInt can raise an assert failure if second argument has more than 64 bits. Patch by Paweł Bylica! Differential Revision: http://reviews.llvm.org/D7701 llvm-svn: 232176
* Fix an infinite recursion in the verifier caused by calling isSized on a ↵Owen Anderson2015-03-131-1/+2
| | | | | | recursive type. llvm-svn: 232143
* [X86, AVX2] Replace inserti128 and extracti128 intrinsics with generic shufflesSanjay Patel2015-03-121-2/+6
| | | | | | | | | | | | | | | | | This should complete the job started in r231794 and continued in r232045: We want to replace as much custom x86 shuffling via intrinsics as possible because pushing the code down the generic shuffle optimization path allows for better codegen and less complexity in LLVM. AVX2 introduced proper integer variants of the hacked integer insert/extract C intrinsics that were created for this same functionality with AVX1. This should complete the removal of insert/extract128 intrinsics. The Clang precursor patch for this change was checked in at r232109. llvm-svn: 232120
* make an array of constants explicitly constSanjay Patel2015-03-121-1/+1
| | | | | | | | Suggested by Craig Topper in D8184. This goes with r232047. llvm-svn: 232056
* IRBuilder: add a CreateShuffleVector function that takes an ArrayRef of intSanjay Patel2015-03-121-4/+2
| | | | | | | | | This is a convenience function to ease mask creation of ShuffleVectors in AutoUpgrade and other places. Differential Revision: http://reviews.llvm.org/D8184 llvm-svn: 232047
* [X86, AVX] replace vextractf128 intrinsics with generic shufflesSanjay Patel2015-03-121-0/+23
| | | | | | | | | | | | | | | | | Now that we've replaced the vinsertf128 intrinsics, do the same for their extract twins. This is very much like D8086 (checked in at r231794): We want to replace as much custom x86 shuffling via intrinsics as possible because pushing the code down the generic shuffle optimization path allows for better codegen and less complexity in LLVM. This is also the LLVM sibling to the cfe D8275 patch. Differential Revision: http://reviews.llvm.org/D8276 llvm-svn: 232045
* Fix another verifier crash where a GC intrinsic would look at the internals ↵Owen Anderson2015-03-111-0/+5
| | | | | | | | | | | of another intrinsic in order to verify itself. This causes a crash if the referenced intrinsic was malformed. In this case, we would already have reported an error on the referenced intrinsic, but then crashed on the second one when it tried to introspect the first without error checking. llvm-svn: 231910
* Fix Value dangling reference debug outputAndrew Kaylor2015-03-102-7/+5
| | | | llvm-svn: 231889
* [X86, AVX] replace vinsertf128 intrinsics with generic shufflesSanjay Patel2015-03-101-1/+51
| | | | | | | | | | | | | | We want to replace as much custom x86 shuffling via intrinsics as possible because pushing the code down the generic shuffle optimization path allows for better codegen and less complexity in LLVM. This is the sibling patch for the Clang half of this change: http://reviews.llvm.org/D8088 Differential Revision: http://reviews.llvm.org/D8086 llvm-svn: 231794
* Teach raw_ostream to accept SmallString.Yaron Keren2015-03-101-1/+1
| | | | | | | | | | | | | | Saves adding .str() call to any raw_ostream << SmallString usage and a small step towards making .str() consistent in the ADTs by removing one of the SmallString::str() use cases, discussion at http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141013/240026.html I'll update the Phabricator patch http://reviews.llvm.org/D6372 for review of the Twine SmallString support, it's more complex than this one. llvm-svn: 231763
* Fix an issue in the verifier where we could try to read information out of a ↵Owen Anderson2015-03-101-1/+5
| | | | | | | | | | malformed statepoint intrinsic. In this situation we would always have already flagged an error on the statepoint intrinsic, but then we carry on to parse other, related GC intrinsics, and could end up crashing during that verification when they try to access data from the malformed statepoint. llvm-svn: 231759
* DataLayout is mandatory, update the API to reflect it with references.Mehdi Amini2015-03-103-34/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* InstCombine: fix fold "fcmp x, undef" to account for NaNMehdi Amini2015-03-091-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | Summary: See the two test cases. ; Can fold fcmp with undef on one side by choosing NaN for the undef ; Can fold fcmp with undef on both side ; fcmp u_pred undef, undef -> true ; fcmp o_pred undef, undef -> false ; because whatever you choose for the first undef ; you can choose NaN for the other undef Reviewers: hfinkel, chandlerc, majnemer Reviewed By: majnemer Subscribers: majnemer, llvm-commits Differential Revision: http://reviews.llvm.org/D7617 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 231626
* Simplify expressions involving boolean constants with clang-tidyDavid Blaikie2015-03-093-4/+4
| | | | | | | | Patch by Richard (legalize at xmission dot com). Differential Revision: http://reviews.llvm.org/D8154 llvm-svn: 231617
* Teach DataLayout to infer a plausible alignment for things even when nothing ↵Owen Anderson2015-03-081-3/+14
| | | | | | is specified by the user. llvm-svn: 231613
* Make the assertion macros in Verifier and Linter truly variadic.Benjamin Kramer2015-03-071-923/+888
| | | | | | NFC. llvm-svn: 231577
* [ConstantRange] Teach multiply to be cleverer about signed ranges.James Molloy2015-03-061-1/+27
| | | | | | | | | | | | | Multiplication is not dependent on signedness, so just treating all input ranges as unsigned is not incorrect. However it will cause overly pessimistic ranges (such as full-set) when used with signed negative values. Teach multiply to try to interpret its inputs as both signed and unsigned, and then to take the most specific (smallest population) as its result. llvm-svn: 231483
* Instructions: Use delegated constructors to reduce duplicationBenjamin Kramer2015-03-051-153/+32
| | | | | | NFC. llvm-svn: 231411
* Remove accidental errs() call in VerifierReid Kleckner2015-03-051-1/+0
| | | | llvm-svn: 231391
* Replace llvm.frameallocate with llvm.frameescapeReid Kleckner2015-03-051-11/+44
| | | | | | | | | | Turns out it's pretty straightforward and simplifies the implementation. Reviewers: andrew.w.kaylor Differential Revision: http://reviews.llvm.org/D8051 llvm-svn: 231386
* Revert r231276 (including r231277): Add a lock() function in PassRegistry to ↵Erik Eckstein2015-03-051-18/+2
| | | | | | speed up multi-thread synchronization. llvm-svn: 231385
* Add a lock() function in PassRegistry to speed up multi-thread synchronization.Erik Eckstein2015-03-041-2/+18
| | | | | | | | | | When calling lock() after all passes are registered, the PassRegistry doesn't need a mutex anymore to look up passes. This speeds up multithreaded llvm execution by ~5% (tested with 4 threads). In an asserts build of llvm this has an even bigger impact. Note that it's not required to use the lock function. llvm-svn: 231276
* Make DataLayout Non-Optional in the ModuleMehdi Amini2015-03-042-112/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix DwarfExpression::AddMachineRegExpression so it doesn't read past theAdrian Prantl2015-03-041-2/+2
| | | | | | | end of an expression that ends with DW_OP_plus. Caught by the ASAN build bots. llvm-svn: 231260
* Remove 'llvm.x86.avx2.vbroadcasti128' intrinsic.Juergen Ributzka2015-03-041-0/+12
| | | | | | | | | | | The intrinsic is no longer generated by the front-end. Remove the intrinsic and auto-upgrade it to a vector shuffle. Reviewed by Nadav This is related to rdar://problem/18742778. llvm-svn: 231182
* Remove getDataLayout() from Instruction/GlobalValue/BasicBlock/FunctionMehdi Amini2015-03-033-12/+7
| | | | | | | | | | | | | | | | | Summary: This does not conceptually belongs here. Instead provide a shortcut getModule() that provides access to the DataLayout. Reviewers: chandlerc, echristo Reviewed By: echristo Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8027 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 231147
* DebugInfo: Move new hierarchy into placeDuncan P. N. Exon Smith2015-03-033-1264/+243
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the specialized metadata nodes for the new debug info hierarchy into place, finishing off PR22464. I've done bootstraps (and all that) and I'm confident this commit is NFC as far as DWARF output is concerned. Let me know if I'm wrong :). The code changes are fairly mechanical: - Bumped the "Debug Info Version". - `DIBuilder` now creates the appropriate subclass of `MDNode`. - Subclasses of DIDescriptor now expect to hold their "MD" counterparts (e.g., `DIBasicType` expects `MDBasicType`). - Deleted a ton of dead code in `AsmWriter.cpp` and `DebugInfo.cpp` for printing comments. - Big update to LangRef to describe the nodes in the new hierarchy. Feel free to make it better. Testcase changes are enormous. There's an accompanying clang commit on its way. If you have out-of-tree debug info testcases, I just broke your build. - `upgrade-specialized-nodes.sh` is attached to PR22564. I used it to update all the IR testcases. - Unfortunately I failed to find way to script the updates to CHECK lines, so I updated all of these by hand. This was fairly painful, since the old CHECKs are difficult to reason about. That's one of the benefits of the new hierarchy. This work isn't quite finished, BTW. The `DIDescriptor` subclasses are almost empty wrappers, but not quite: they still have loose casting checks (see the `RETURN_FROM_RAW()` macro). Once they're completely gutted, I'll rename the "MD" classes to "DI" and kill the wrappers. I also expect to make a few schema changes now that it's easier to reason about everything. llvm-svn: 231082
* AsmWriter: Only print one space after the load typeBenjamin Kramer2015-03-021-1/+1
| | | | | | | | | Before: %x = load i32, i32* %i After: %x = load i32, i32* %i Purely cosmetic, so no new test case. llvm-svn: 230966
OpenPOWER on IntegriCloud