summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
Commit message (Collapse)AuthorAgeFilesLines
...
* [ConstantRange] Use APInt::getOneBitSet to shorten some code. NFCCraig Topper2017-04-291-5/+2
| | | | llvm-svn: 301753
* [ConstantRange] Replace getMaxValue+zext with getLowBitsSet. Replace ↵Craig Topper2017-04-291-3/+2
| | | | | | zero-init+setBit with getOneBitSet. NFC llvm-svn: 301752
* [ConstantRange] Use APInt::operator-= to remove temporary APInts.Craig Topper2017-04-291-4/+4
| | | | llvm-svn: 301751
* [ConstantRange] Use ternary operator instead of 'if' to avoid copying an ↵Craig Topper2017-04-291-10/+4
| | | | | | APInt and then possibly copying over it. llvm-svn: 301741
* [ConstantRange] Add std::move to a bunch of places that pass local APInts to ↵Craig Topper2017-04-291-24/+25
| | | | | | | | ConstantRange constructor. The ConstantRange constructor takes APInt by value so without these moves we are making copies. llvm-svn: 301740
* [ConstantRange] Remove a temporary APInt I meant to delete in r300621. NFCCraig Topper2017-04-291-1/+0
| | | | llvm-svn: 301737
* [ConstantRange] Improve the efficiency of one of the ConstantRange constructors.Craig Topper2017-04-291-6/+3
| | | | | | | | | | We were default constructing the Lower/Upper APInts. Then creating min or max value, then doing a move assignment to Lower and copy assignment to upper. The copy assignment operator in particular has an out of line function call that has to examine whether or not a previous allocation exists that can be reused which of course it can't in this case. The new code creates the min/max value first, move constructs Lower from it then copy constructs Upper from Lower. This also seems to have convinced a self host build that this constructor can be inlined more readily into other methods in ConstantRange. llvm-svn: 301736
* Revert r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of ↵Hans Wennborg2017-04-282-19/+28
| | | | | | | | | | | | | | | | | | AttributeList" This broke the Clang build. (Clang-side patch missing?) Original commit message: > [IR] Make add/remove Attributes use AttrBuilder instead of > AttributeList > > This change cleans up call sites and avoids creating temporary > AttributeList objects. > > NFC llvm-svn: 301712
* Remove line and file from DINamespace.Adrian Prantl2017-04-284-22/+20
| | | | | | | | | | | | | | Fixes the issue highlighted in http://lists.llvm.org/pipermail/cfe-dev/2014-June/037500.html. The DW_AT_decl_file and DW_AT_decl_line attributes on namespaces can prevent LLVM from uniquing types that are in the same namespace. They also don't carry any meaningful information. rdar://problem/17484998 Differential Revision: https://reviews.llvm.org/D32648 llvm-svn: 301706
* [IR] Make add/remove Attributes use AttrBuilder instead of AttributeListReid Kleckner2017-04-282-28/+19
| | | | | | | | | This change cleans up call sites and avoids creating temporary AttributeList objects. NFC llvm-svn: 301697
* [ConstantRange] Use APInt::isNullValue rather than APInt::isMinValue where ↵Craig Topper2017-04-281-2/+2
| | | | | | it would make more sense to thing of 0 as 0 rather than the minimum unsigned value. NFC llvm-svn: 301696
* [ConstantRange] Use const references to prevent a couple APInt copies. NFCCraig Topper2017-04-281-2/+2
| | | | llvm-svn: 301694
* Make getParamAlignment use argument numbersReid Kleckner2017-04-284-8/+11
| | | | | | | | | | | | | | | | | | The method is called "get *Param* Alignment", and is only used for return values exactly once, so it should take argument indices, not attribute indices. Avoids confusing code like: IsSwiftError = CS->paramHasAttr(ArgIdx, Attribute::SwiftError); Alignment = CS->getParamAlignment(ArgIdx + 1); Add getRetAlignment to handle the one case in Value.cpp that wants the return value alignment. This is a potentially breaking change for out-of-tree backends that do their own call lowering. llvm-svn: 301682
* Add speculatable function attributeMatt Arsenault2017-04-282-11/+23
| | | | | | | | This attribute tells the optimizer that the function may be speculated. Patch by Tom Stellard llvm-svn: 301680
* Use Argument::hasAttribute and AttributeList::ReturnIndex moreReid Kleckner2017-04-284-43/+25
| | | | | | | | | | | This eliminates many extra 'Idx' induction variables in loops over arguments in CodeGen/ and Target/. It also reduces the number of places where we assume that ReturnIndex is 0 and that we should add one to argument numbers to get the corresponding attribute list index. NFC llvm-svn: 301666
* Cleanup: Use DIExpression::prepend in buildDbgValueForSpill(). (NFC)Adrian Prantl2017-04-281-4/+1
| | | | llvm-svn: 301665
* [IR] Delete unused Argument::removeAttr overloadReid Kleckner2017-04-281-9/+0
| | | | | | It doesn't make sense to remove an AttributeList from an argument. llvm-svn: 301663
* Clean up DIExpression::prependDIExpr a little. (NFC)Adrian Prantl2017-04-281-8/+6
| | | | llvm-svn: 301662
* Bitcode: Do not remove empty summary entries when reading a per-module summary.Peter Collingbourne2017-04-281-12/+0
| | | | | | | | This became no longer necessary after D19462 landed, and will be incompatible with an upcoming change to the summary data structures that changes how we represent references. llvm-svn: 301660
* [DebugInfo][X86] Improve X86 Optimize LEAs handling of debug values.Andrew Ng2017-04-281-0/+43
| | | | | | | | | | | | | | | This is a follow up to the fix in r298360 to improve the handling of debug values when redundant LEAs are removed. The fix in r298360 effectively discarded the debug values. This patch now attempts to preserve the debug values by using the DWARF DW_OP_stack_value operation via prependDIExpr. Moved functions appendOffset and prependDIExpr from Local.cpp to DebugInfoMetadata.cpp and made them available as static member functions of DIExpression. Differential Revision: https://reviews.llvm.org/D31604 llvm-svn: 301630
* Use accessors for ValueHandleBase::V; NFCSanjoy Das2017-04-271-12/+12
| | | | | | | | | | | This changes code that touches ValueHandleBase::V to go through getValPtr and (newly added) setValPtr. This functionality will be used later, but also seemed like a generally good cleanup. I also renamed the field to Val, but that's just to make it obvious that I fixed all the uses. llvm-svn: 301518
* [Metadata] Fix typos in comments. NFCCraig Topper2017-04-271-2/+2
| | | | llvm-svn: 301517
* Turn DISubprogram into a variable-length node.Adrian Prantl2017-04-261-7/+20
| | | | | | | | | | | | | | | | | | | | DISubprogram currently has 10 pointer operands, several of which are often nullptr. This patch reduces the amount of memory allocated by DISubprogram by rearranging the operands such that containing type, template params, and thrown types come last, and are only allocated when they are non-null (or followed by non-null operands). This patch also eliminates the entirely unused DisplayName operand. This saves up to 4 pointer operands per DISubprogram. (I tried measuring the effect on peak memory usage on an LTO link of an X86 llc, but the results were very noisy). This reapplies r301498 with an attempted workaround for g++. Differential Revision: https://reviews.llvm.org/D32560 llvm-svn: 301501
* Revert "Turn DISubprogram into a variable-length node."Adrian Prantl2017-04-261-20/+7
| | | | | | This reverts commit r301498 while investigating bot breakage. llvm-svn: 301499
* Turn DISubprogram into a variable-length node.Adrian Prantl2017-04-261-7/+20
| | | | | | | | | | | | | | | | DISubprogram currently has 10 pointer operands, several of which are often nullptr. This patch reduces the amount of memory allocated by DISubprogram by rearranging the operands such that containing type, template params, and thrown types come last, and are only allocated when they are non-null (or followed by non-null operands). This patch also eliminates the entirely unused DisplayName operand. This saves up to 4 pointer operands per DISubprogram. (I tried measuring the effect on peak memory usage on an LTO link of an X86 llc, but the results were very noisy). llvm-svn: 301498
* Add support for DW_TAG_thrown_type.Adrian Prantl2017-04-265-23/+36
| | | | | | | | | | | | | | | | | | | | For Swift we would like to be able to encode the error types that a function may throw, so the debugger can display them alongside the function's return value when finish-ing a function. DWARF defines DW_TAG_thrown_type (intended to be used for C++ throw() declarations) that is a perfect fit for this purpose. This patch wires up support for DW_TAG_thrown_type in LLVM by adding a list of thrown types to DISubprogram. To offset the cost of the extra pointer, there is a follow-up patch that turns DISubprogram into a variable-length node. rdar://problem/29481673 Differential Revision: https://reviews.llvm.org/D32559 llvm-svn: 301489
* Reverts commit r301424, r301425 and r301426Sanjoy Das2017-04-261-14/+9
| | | | | | | | | | | | Commits were: "Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts" "Add a new WeakVH value handle; NFC" "Rename WeakVH to WeakTrackingVH; NFC" The changes assumed pointers are 8 byte aligned on all architectures. llvm-svn: 301429
* Add a new WeakVH value handle; NFCSanjoy Das2017-04-261-2/+5
| | | | | | | | | | | | | | Summary: WeakVH nulls itself out if the value it was tracking gets deleted, but it does not track RAUW. Reviewers: dblaikie, davide Subscribers: mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D32267 llvm-svn: 301425
* Rename WeakVH to WeakTrackingVH; NFCSanjoy Das2017-04-261-9/+11
| | | | | | | | | | | | | | | | Summary: I plan to use WeakVH to mean "nulls itself out on deletion, but does not track RAUW" in a subsequent commit. Reviewers: dblaikie, davide Reviewed By: davide Subscribers: arsenm, mehdi_amini, mcrosier, mzolotukhin, jfb, llvm-commits, nhaehnle Differential Revision: https://reviews.llvm.org/D32266 llvm-svn: 301424
* [gcov] Sort file info before printing itVedant Kumar2017-04-261-3/+7
| | | | | | | | | | | | | The order in which GCOV file info is printed depends on the string hash function. This makes some GCOV tests brittle, because the tests must be updated whenever the hash function changes. Sort the filenames before printing out the file info to solve the problem. This should be relatively cheap. Differential Revision: https://reviews.llvm.org/D32512 llvm-svn: 301371
* Make getSlotAttributes return an AttributeSet instead of a wrapper listReid Kleckner2017-04-242-28/+17
| | | | | | | | Remove the temporary, poorly named getSlotSet method which did the same thing. Also remove getSlotNode, which is a hold-over from when we were dealing with AttributeSetNode* instead of AttributeSet. llvm-svn: 301267
* [Bitcode] Refactor attribute group writing to avoid getSlotAttributesReid Kleckner2017-04-241-0/+6
| | | | | | | | | | | | | | | | | Summary: That API creates a temporary AttributeList to carry an index and a single AttributeSet. We need to carry the index in addition to the set, because that is how attribute groups are currently encoded. NFC Reviewers: pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32262 llvm-svn: 301245
* Handle invariant.group.barrier in BasicAAPiotr Padlewski2017-04-241-2/+17
| | | | | | | | | | | | | | | | | | | | | Summary: llvm.invariant.group.barrier returns pointer that mustalias pointer it takes. It can't be marked with `returned` attribute, because it would be remove easily. The other reason is that only Alias Analysis can know about this, because if any other pass would know it, then the result would be replaced with it's argument, which would be invalid. We can think about returned pointer as something that mustalias, but it doesn't have to be bitwise the same as the argument. Reviewers: dberlin, chandlerc, hfinkel, sanjoy Subscribers: reames, nlewycky, rsmith, anna, amharc Differential Revision: https://reviews.llvm.org/D31585 llvm-svn: 301227
* [AsmWriter] Eliminate warning. NFCSerguei Katkov2017-04-211-4/+4
| | | | | | | | | | | | | | This patch eliminates the following warning lib/IR/AsmWriter.cpp:1128:57: warning: suggest parentheses around '&&' within '||' [-Wparentheses] (StrVal[1] >= '0' && StrVal[1] <= '9')) && Reviewers: timshen, rnk, davide Reviewed By: davide Subscribers: davide, llvm-commits Differential Revision: https://reviews.llvm.org/D32337 llvm-svn: 300950
* [AsmWriter/APFloat] FP constant printing: Avoid usage of locale dependent ↵Serguei Katkov2017-04-211-23/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | snprinf This should fix the bug https://bugs.llvm.org/show_bug.cgi?id=12906 To print the FP constant AsmWriter does the following: 1) convert FP value to String (actually using snprintf function which is locale dependent). 2) Convert String back to FP Value 3) Compare original and got FP values. If they are not equal just dump as hex. The problem happens on the 2nd step when APFloat does not expect group delimiter or fraction delimiter other than period symbol and so on, which can be produced on the first step if LLVM library is used in an environment with corresponding locale set. To fix this issue the locale independent APFloat:toString function is used. However it prints FP values slightly differently than snprintf does. Specifically it suppress trailing zeros in significant, use capital E and so on. It results in 117 test failures during make check. To avoid this I've also updated APFloat.toString a bit to pass make check at least. Reviewers: sberg, bogner, majnemer, sanjoy, timshen, rnk Reviewed By: timshen, rnk Subscribers: rnk, llvm-commits Differential Revision: https://reviews.llvm.org/D32276 llvm-svn: 300943
* Remove duplicate AttributeList::removeAttributes implementationReid Kleckner2017-04-201-63/+12
| | | | | | | | | | | | | | | Have the AttributeList overload delegate to the AttrBuilder one. Simplify the AttrBuilder overload by avoiding getSlotAttributes, which creates temporary AttributeLists. Simplify `AttrBuilder::removeAttributes(AttributeList, unsigned)` by using getAttributes instead of manually iterating over slots. Extracted from https://reviews.llvm.org/D32262 NFC llvm-svn: 300863
* Prefer addAttr(Attribute::AttrKind) over the AttributeList overloadReid Kleckner2017-04-192-22/+21
| | | | | | | | This should simplify the call sites, which typically want to tweak one attribute at a time. It should also avoid creating ephemeral AttributeLists that live forever. llvm-svn: 300718
* use 'auto' with 'dyn_cast' and fix formatting; NFCSanjay Patel2017-04-191-8/+7
| | | | llvm-svn: 300713
* Remove buggy 'addAttributes(unsigned, AttrBuilder)' overloadReid Kleckner2017-04-191-21/+15
| | | | | | | | | | The 'addAttributes(unsigned, AttrBuilder)' overload delegated to 'get' instead of 'addAttributes'. Since we can implicitly construct an AttrBuilder from an AttributeSet, just standardize on AttrBuilder. llvm-svn: 300651
* [DataLayout] Removed default value from a variable that isn't used without ↵Craig Topper2017-04-191-3/+2
| | | | | | being overwritten. Make variable an enum instead of an int to avoid a cast later. NFC llvm-svn: 300634
* [ConstantRange] Optimize APInt creation in getSignedMax/getSignedMin.Craig Topper2017-04-181-8/+8
| | | | | | | | | | We were creating an APInt at the top of these methods that isn't always returned. For ranges wider than 64-bits this results in an allocation and deallocation when its not used. In getSignedMax we were creating Upper-1 to use in a compare and then creating it again for a return value. The compiler is unable to determine that these can be shared. So help it out and create the Upper-1 in a temporary that can be reused. This provides a little compile time improvement. llvm-svn: 300621
* Fix crash in AttributeList::addAttributes, add testReid Kleckner2017-04-181-0/+3
| | | | llvm-svn: 300614
* [APInt] Use lshrInPlace to replace lshr where possibleCraig Topper2017-04-181-1/+1
| | | | | | | | | | This patch uses lshrInPlace to replace code where the object that lshr is called on is being overwritten with the result. This adds an lshrInPlace(const APInt &) version as well. Differential Revision: https://reviews.llvm.org/D32155 llvm-svn: 300566
* [ConstantRange] fix doxygen comment formatting; NFCSanjay Patel2017-04-181-76/+0
| | | | llvm-svn: 300554
* [IR] Implement DataLayout::getPointerTypeSizeInBits using ↵Craig Topper2017-04-171-5/+2
| | | | | | | | | | | | | | getPointerSizeInBits directly Currently we use getTypeSizeInBits which contains a switch statement to dispatch based on what the Type is. We know we always have a pointer type here, but the compiler isn't able to figure out that out to remove the switch. This patch changes it to just call handle the pointer type directly by calling getPointerSizeInBits without going through a switch. getPointerTypeSizeInBits is called pretty often, particularly by getOrEnforceKnownAlignment which is used by InstCombine. This should speed that up a little bit. Differential Revision: https://reviews.llvm.org/D31841 llvm-svn: 300475
* Introducing LLVMMetadataRefAmaury Sechet2017-04-171-0/+13
| | | | | | | | | | | | | | | | | | | Summary: This seems like an uncontroversial first step toward providing access to the metadata hierarchy that now exists in LLVM. This should allow for good debug info support from C. Future plans are to deprecate API that take mixed bags of values and metadata (mainly the LLVMMDNode family of functions) and migrate the rest toward the use of LLVMMetadataRef. Once this is in place, mapping of DIBuilder will be able to start. Reviewers: mehdi_amini, echristo, whitequark, jketema, Wallbraker Reviewed By: Wallbraker Subscribers: Eugene.Zelenko, axw, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D19448 llvm-svn: 300447
* [Constants] simplify get true/false code; NFCISanjay Patel2017-04-161-18/+10
| | | | llvm-svn: 300424
* [IR] Make paramHasAttr to use arg indices instead of attr indicesReid Kleckner2017-04-142-10/+34
| | | | | | | | | This avoids the confusing 'CS.paramHasAttr(ArgNo + 1, Foo)' pattern. Previously we were testing return value attributes with index 0, so I introduced hasReturnAttr() for that use case. llvm-svn: 300367
* [X86][SSE] Update MOVNTDQA non-temporal loads to generic implementation (LLVM)Simon Pilgrim2017-04-141-0/+17
| | | | | | | | | | MOVNTDQA non-temporal aligned vector loads can be correctly represented using generic builtin loads, allowing us to remove the existing x86 intrinsics. Clang companion patch: D31766. Differential Revision: https://reviews.llvm.org/D31767 llvm-svn: 300325
* Simplify some Verifier attribute checks with AttributeSetReid Kleckner2017-04-141-188/+175
| | | | | | | | | | | Now that we have a type that can represent the attributes on a single return, function, or parameter, we can pass it around directly rather than passing around AttributeList and Idx. Removes some more one-based argument attribute index counting. NFC llvm-svn: 300285
OpenPOWER on IntegriCloud