aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
Commit message (Collapse)AuthorAgeFilesLines
* Migrate external/llvm to LLVM-155090-2012-419.Shih-wei Liao2012-04-241-1/+0
| | | | Change-Id: Ib843d76035ce85b22dea3696687c88f51832df00
* Merge with LLVM upstream r155090.Shih-wei Liao2012-04-2415-323/+308
|\ | | | | | | | | | | | | Conflicts: lib/Support/Unix/PathV2.inc Change-Id: I7b89833849f6cbcfa958a33a971d0f7754c9cb2c
| * Remove AVX vpermil intrinsics. I removed their uses from clang headers and ↵Craig Topper2012-04-181-5/+38
| | | | | | | | | | | | builtins a while back. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154985 91177308-0d34-0410-b5e6-96231b3b80d8
| * Typo.Eric Christopher2012-04-161-1/+1
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154879 91177308-0d34-0410-b5e6-96231b3b80d8
| * Remove support for the special 'fast' value for fpmath accuracy for the moment.Duncan Sands2012-04-162-26/+3
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154850 91177308-0d34-0410-b5e6-96231b3b80d8
| * Make it possible to indicate relaxed floating point requirements at the IR levelDuncan Sands2012-04-162-6/+48
| | | | | | | | | | | | | | | | | | | | through the use of 'fpmath' metadata. Currently this only provides a 'fpaccuracy' value, which may be a number in ULPs or the keyword 'fast', however the intent is that this will be extended with additional information about NaN's, infinities etc later. No optimizations have been hooked up to this so far. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154822 91177308-0d34-0410-b5e6-96231b3b80d8
| * Rename "fpaccuracy" metadata to the more generic "fpmath". That's because I'mDuncan Sands2012-04-142-9/+9
| | | | | | | | | | | | | | | | | | | | thinking of generalizing it to be able to specify other freedoms beyond accuracy (such as that NaN's don't have to be respected). I'd like the 3.1 release (the first one with this metadata) to have the more generic name already rather than having to auto-upgrade it in 3.2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154744 91177308-0d34-0410-b5e6-96231b3b80d8
| * Def here is an Instruction, so !isa<Instruction>(Def) is always false,Dan Gohman2012-04-131-3/+2
| | | | | | | | | | | | | | as Eli noticed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154641 91177308-0d34-0410-b5e6-96231b3b80d8
| * Add forms of dominates and isReachableFromEntry that accept a UseDan Gohman2012-04-121-0/+81
| | | | | | | | | | | | | | | | | | directly instead of a user Instruction. This allows them to test whether a def dominates a particular operand if the user instruction is a PHI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154631 91177308-0d34-0410-b5e6-96231b3b80d8
| * Cache the hash value of the operands in the MDNode.Benjamin Kramer2012-04-112-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FoldingSet is implemented as a chained hash table. When there is a hash collision during insertion, which is common as we fill the table until a load factor of 2.0 is hit, we walk the chained elements, comparing every operand with the new element's operands. This can be very expensive if the MDNode has many operands. We sacrifice a word of space in MDNode to cache the full hash value, reducing compares on collision to a minimum. MDNode grows from 28 to 32 bytes + operands on x86. On x86_64 the new bits fit nicely into existing padding, not growing the struct at all. The actual speedup depends a lot on the test case and is typically between 1% and 2% for C++ code with clang -c -O0 -g. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154497 91177308-0d34-0410-b5e6-96231b3b80d8
| * Compute hashes directly with hash_combine instead of taking a detour through ↵Benjamin Kramer2012-04-111-4/+1
| | | | | | | | | | | | FoldingSetNodeID. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154495 91177308-0d34-0410-b5e6-96231b3b80d8
| * The MDString class stored a StringRef to the string which was already in aBill Wendling2012-04-103-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | StringMap. This was redundant and unnecessarily bloated the MDString class. Because the MDString class is a "Value" and will never have a "name", and because the Name field in the Value class is a pointer to a StringMap entry, we repurpose the Name field for an MDString. It stores the StringMap entry in the Name field, and uses the normal methods to get the string (name) back. PR12474 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154429 91177308-0d34-0410-b5e6-96231b3b80d8
| * Express the number of ULPs in fpaccuracy metadata as a real rather than aDuncan Sands2012-04-101-0/+12
| | | | | | | | | | | | | | rational number, eg as 2.5 rather than 5, 2. OK'd by Peter Collingbourne. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154387 91177308-0d34-0410-b5e6-96231b3b80d8
| * Remove the 'Parent' pointer from the MDNodeOperand class.Bill Wendling2012-04-081-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | An MDNode has a list of MDNodeOperands allocated directly after it as part of its allocation. Therefore, the Parent of the MDNodeOperands can be found by walking back through the operands to the beginning of that list. Mark the first operand's value pointer as being the 'first' operand so that we know where the beginning of said list is. This saves a *lot* of space during LTO with -O0 -g flags. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154280 91177308-0d34-0410-b5e6-96231b3b80d8
| * Allow subclasses of the ValueHandleBase to store information as part of theBill Wendling2012-04-081-12/+14
| | | | | | | | | | | | | | | | value pointer by making the value pointer into a pointer-int pair with 2 bits available for flags. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154279 91177308-0d34-0410-b5e6-96231b3b80d8
| * The speedup doesn't appear to have been from this, but was an anomaly of my ↵Bill Wendling2012-04-031-1/+0
| | | | | | | | | | | | testing machine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153951 91177308-0d34-0410-b5e6-96231b3b80d8
| * Reserve space for the eventual filling of the vector. This gives a small ↵Bill Wendling2012-04-031-4/+3
| | | | | | | | | | | | speedup. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153949 91177308-0d34-0410-b5e6-96231b3b80d8
| * I noticed in passing that the Metadata getIfExists method was creating a newDuncan Sands2012-03-311-4/+4
| | | | | | | | | | | | | | node and returning it if one didn't exist. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153798 91177308-0d34-0410-b5e6-96231b3b80d8
| * Handle unreachable code in the dominates functions. This changes users whenRafael Espindola2012-03-301-4/+14
| | | | | | | | | | | | | | needed for correctness, but still doesn't clean up code that now unnecessary checks for reachability. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153755 91177308-0d34-0410-b5e6-96231b3b80d8
| * Add missing include of <new>Douglas Gregor2012-03-261-0/+1
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153436 91177308-0d34-0410-b5e6-96231b3b80d8
| * Remove always true variable.Rafael Espindola2012-03-241-19/+10
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153392 91177308-0d34-0410-b5e6-96231b3b80d8
| * First part of PR12251. Add documentation and verifier support for the rangeRafael Espindola2012-03-242-0/+29
| | | | | | | | | | | | metadata. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153359 91177308-0d34-0410-b5e6-96231b3b80d8
| * Fix up cmake build.Eric Christopher2012-03-231-1/+0
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153306 91177308-0d34-0410-b5e6-96231b3b80d8
| * Take out the debug info probe stuff. It's making some changes toEric Christopher2012-03-232-247/+1
| | | | | | | | | | | | | | the PassManager annoying and should be reimplemented as a decorator on top of existing passes (as should the timing data). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153305 91177308-0d34-0410-b5e6-96231b3b80d8
| * add load/store volatility control to the C API, patch by Yiannis Tsiouris!Chris Lattner2012-03-221-0/+14
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153238 91177308-0d34-0410-b5e6-96231b3b80d8
* | Merge branch 'upstream' into sliao_dShih-wei Liao2012-03-246-64/+82
|\ \ | |/
| * Extend the inline cost calculation to account for bonuses due toChandler Carruth2012-03-141-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | correlated pairs of pointer arguments at the callsite. This is designed to recognize the common C++ idiom of begin/end pointer pairs when the end pointer is a constant offset from the begin pointer. With the C-based idiom of a pointer and size, the inline cost saw the constant size calculation, and this provides the same level of information for begin/end pairs. In order to propagate this information we have to search for candidate operations on a pair of pointer function arguments (or derived from them) which would be simplified if the pointers had a known constant offset. Then the callsite analysis looks for such pointer pairs in the argument list, and applies the appropriate bonus. This helps LLVM detect that half of bounds-checked STL algorithms (such as hash_combine_range, and some hybrid sort implementations) disappear when inlined with a constant size input. However, it's not a complete fix due the inaccuracy of our cost metric for constants in general. I'm looking into that next. Benchmarks showed no significant code size change, and very minor performance changes. However, specific code such as hashing is showing significantly cleaner inlining decisions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152752 91177308-0d34-0410-b5e6-96231b3b80d8
| * llvm::SwitchInstStepan Dyatkovskiy2012-03-112-2/+2
| | | | | | | | | | | | | | | | | | Renamed methods caseBegin, caseEnd and caseDefault with case_begin, case_end, and case_default. Added some notes relative to case iterators. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152532 91177308-0d34-0410-b5e6-96231b3b80d8
| * Refactor some methods to look through bitcasts and GEPs on pointers intoChandler Carruth2012-03-101-6/+42
| | | | | | | | | | | | | | | | | | | | a common collection of methods on Value, and share their implementation. We had two variations in two different places already, and I need the third variation for inline cost estimation. Reviewed by Duncan Sands on IRC, but further comments here welcome. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152490 91177308-0d34-0410-b5e6-96231b3b80d8
| * Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:Stepan Dyatkovskiy2012-03-083-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*". ConstCaseIt is just a read-only iterator. CaseIt is read-write iterator; it allows to change case successor and case value. Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters. Main way of iterator usage looks like this: SwitchInst *SI = ... // intialize it somehow for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) { BasicBlock *BB = i.getCaseSuccessor(); ConstantInt *V = i.getCaseValue(); // Do something. } If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method. If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method. There are also related changes in llvm-clients: klee and clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152297 91177308-0d34-0410-b5e6-96231b3b80d8
| * Switch this code to use hash_combine_range rather than incremental callsChandler Carruth2012-03-071-8/+6
| | | | | | | | | | | | | | | | | | | | to hash_combine. One of the interfaces could already do this, and the other can just use a small buffer. This is a much more efficient way to use the hash_combine interface, although I don't have any particular benchmark where this code was hot, so I can't measure much of an impact. It at least doesn't slow anything down. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152200 91177308-0d34-0410-b5e6-96231b3b80d8
| * Cache the sized-ness of struct types, once we reach the steady state ofChandler Carruth2012-03-071-10/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "is sized". This prevents every query to isSized() from recursing over every sub-type of a struct type. This could get *very* slow for extremely deep nesting of structs, as in 177.mesa. This change is a 45% speedup for 'opt -O2' of 177.mesa.linked.bc, and likely a significant speedup for other cases as well. It even impacts -O0 cases because so many part of the code try to check whether a type is sized. Thanks for the review from Nick Lewycky and Benjamin Kramer on IRC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152197 91177308-0d34-0410-b5e6-96231b3b80d8
| * Change ConstantAggrUniqueMap to use Chandler's new hashingJay Foad2012-03-061-36/+9
| | | | | | | | | | | | implementation. Patch by Meador Inge git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152116 91177308-0d34-0410-b5e6-96231b3b80d8
* | Merge branch 'upstream' into merge-20120305Stephen Hines2012-03-0525-1398/+1961
|\ \ | |/ | | | | | | | | | | Conflicts: lib/Support/Atomic.cpp Change-Id: I563b3bc2a82942ccbae5bed42e53b9149a8bf3a0
| * Replace the hashing functions on APInt and APFloat with overloads of theChandler Carruth2012-03-041-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | new hash_value infrastructure, and replace their implementations using hash_combine. This removes a complete copy of Jenkin's lookup3 hash function (which is both significantly slower and lower quality than the one implemented in hash_combine) along with a somewhat scary xor-only hash function. Now that APInt and APFloat can be passed directly to hash_combine, simplify the rest of the LLVMContextImpl hashing to use the new infrastructure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152004 91177308-0d34-0410-b5e6-96231b3b80d8
| * Rewrite LLVM's generalized support library for hashing to follow the APIChandler Carruth2012-03-011-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of the proposed standard hashing interfaces (N3333), and to use a modified and tuned version of the CityHash algorithm. Some of the highlights of this change: -- Significantly higher quality hashing algorithm with very well distributed results, and extremely few collisions. Should be close to a checksum for up to 64-bit keys. Very little clustering or clumping of hash codes, to better distribute load on probed hash tables. -- Built-in support for reserved values. -- Simplified API that composes cleanly with other C++ idioms and APIs. -- Better scaling performance as keys grow. This is the fastest algorithm I've found and measured for moderately sized keys (such as show up in some of the uniquing and folding use cases) -- Support for enabling per-execution seeds to prevent table ordering or other artifacts of hashing algorithms to impact the output of LLVM. The seeding would make each run different and highlight these problems during bootstrap. This implementation was tested extensively using the SMHasher test suite, and pased with flying colors, doing better than the original CityHash algorithm even. I've included a unittest, although it is somewhat minimal at the moment. I've also added (or refactored into the proper location) type traits necessary to implement this, and converted users of GeneralHash over. My only immediate concerns with this implementation is the performance of hashing small keys. I've already started working to improve this, and will continue to do so. Currently, the only algorithms faster produce lower quality results, but it is likely there is a better compromise than the current one. Many thanks to Jeffrey Yasskin who did most of the work on the N3333 paper, pair-programmed some of this code, and reviewed much of it. Many thanks also go to Geoff Pike Pike and Jyrki Alakuijala, the original authors of CityHash on which this is heavily based, and Austin Appleby who created MurmurHash and the SMHasher test suite. Also thanks to Nadav, Tobias, Howard, Jay, Nick, Ahmed, and Duncan for all of the review comments! If there are further comments or concerns, please let me know and I'll jump on 'em. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151822 91177308-0d34-0410-b5e6-96231b3b80d8
| * Emit the "is an intrinsic overloaded" table as a bitfield.Benjamin Kramer2012-03-011-4/+0
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151792 91177308-0d34-0410-b5e6-96231b3b80d8
| * Use the DT dominates function in the verifier.Rafael Espindola2012-02-261-72/+55
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151470 91177308-0d34-0410-b5e6-96231b3b80d8
| * Change the implementation of dominates(inst, inst) to one based on what theRafael Espindola2012-02-261-17/+87
| | | | | | | | | | | | | | | | verifier does. This correctly handles invoke. Thanks to Duncan, Andrew and Chris for the comments. Thanks to Joerg for the early testing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151469 91177308-0d34-0410-b5e6-96231b3b80d8
| * Don't call dominates on unreachable instructions.Rafael Espindola2012-02-261-2/+2
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151468 91177308-0d34-0410-b5e6-96231b3b80d8
| * Remove spurious emacs mode marker.Nick Lewycky2012-02-251-1/+1
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151440 91177308-0d34-0410-b5e6-96231b3b80d8
| * Reinstate r151049 now that GeneralHash is fixed.Jay Foad2012-02-232-34/+131
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151248 91177308-0d34-0410-b5e6-96231b3b80d8
| * Remove extra semi-colons.Chad Rosier2012-02-221-1/+1
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151169 91177308-0d34-0410-b5e6-96231b3b80d8
| * Revert r151049 cos it broke the buildbots.Jay Foad2012-02-212-131/+34
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151052 91177308-0d34-0410-b5e6-96231b3b80d8
| * PR1210: make uniquing of struct and function types more efficient byJay Foad2012-02-212-34/+131
| | | | | | | | | | | | | | | | | | | | using a DenseMap and Talin's new GeneralHash, avoiding the need for a temporary std::vector on every lookup. Patch by Meador Inge! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151049 91177308-0d34-0410-b5e6-96231b3b80d8
| * Remove dead code. Improve llvm_unreachable text. Simplify some control flow.Ahmed Charles2012-02-191-13/+4
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150918 91177308-0d34-0410-b5e6-96231b3b80d8
| * White space fixes.Rafael Espindola2012-02-181-7/+7
| | | | | | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150886 91177308-0d34-0410-b5e6-96231b3b80d8
| * s/ModAttrBehavior/ModFlagBehavior/g to be consistent with how module flags ↵Bill Wendling2012-02-161-3/+3
| | | | | | | | | | | | are named elsewhere. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150679 91177308-0d34-0410-b5e6-96231b3b80d8
| * VMCore/AsmWriter.cpp: Tweak to check #INF and #NAN earlier.NAKAMURA Takumi2012-02-161-1/+3
| | | | | | | | | | | | | | | | With MSVCRT, prior checker missed emission of #INF and #NAN. FIXME: Checking should be simpler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150667 91177308-0d34-0410-b5e6-96231b3b80d8
| * VMCore/AsmWriter.cpp: Use APFloat instead of atof(3).NAKAMURA Takumi2012-02-161-1/+1
| | | | | | | | | | | | atof(3) might behave differently among platforms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150661 91177308-0d34-0410-b5e6-96231b3b80d8