summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore
Commit message (Collapse)AuthorAgeFilesLines
* When linearizing a multiplication, return at once if we see a factor of zero,Duncan Sands2012-06-131-2/+23
| | | | | | | | | since then the entire expression must equal zero (similarly for other operations with an absorbing element). With this in place a bunch of reassociate code for handling constants is dead since it is all taken care of when linearizing. No intended functionality change. llvm-svn: 158398
* Fix intrinsics for XOP frczss/sd instructions. These instructions only take ↵Craig Topper2012-06-131-1/+22
| | | | | | one source register and zero the upper bits of the destination rather than preserving them. llvm-svn: 158396
* Now that Reassociate's LinearizeExprTree can look through arbitrary expressionDuncan Sands2012-06-122-0/+43
| | | | | | | | | | | | | | | | | topologies, it is quite possible for a leaf node to have huge multiplicity, for example: x0 = x*x, x1 = x0*x0, x2 = x1*x1, ... rapidly gives a value which is x raised to a vast power (the multiplicity, or weight, of x). This patch fixes the computation of weights by correctly computing them no matter how big they are, rather than just overflowing and getting a wrong value. It turns out that the weight for a value never needs more bits to represent than the value itself, so it is enough to represent weights as APInts of the same bitwidth and do the right overflow-avoiding dance steps when computing weights. As a side-effect it reduces the number of multiplies needed in some cases of large powers. While there, in view of external uses (eg by the vectorizer) I made LinearizeExprTree static, pushing the rank computation out into users. This is progress towards fixing PR13021. llvm-svn: 158358
* Add AutoUpgrade support for the SSE4 ptest intrinsics.Nadav Rotem2012-06-101-6/+59
| | | | | | Patch by Michael Kuperstein. llvm-svn: 158295
* Replace XOP vpcom intrinsics with fewer intrinsics that take the immediate ↵Craig Topper2012-06-091-1/+47
| | | | | | as an argument. llvm-svn: 158278
* Simplify the fma4 renaming code.Craig Topper2012-06-031-71/+3
| | | | llvm-svn: 157902
* Autoupgrade support the rename of x86.fma4 intrinsics to x86.fma from r157898.Craig Topper2012-06-031-0/+74
| | | | llvm-svn: 157899
* Fix typos found by http://github.com/lyda/misspell-checkBenjamin Kramer2012-06-021-1/+1
| | | | llvm-svn: 157885
* PR1255: case ranges.Stepan Dyatkovskiy2012-06-021-2/+2
| | | | | | IntRange converted from struct to class. So main change everywhere is replacement of ".Low/High" with ".getLow/getHigh()" llvm-svn: 157884
* Use dominates(Instruction, Use) in the verifier.Rafael Espindola2012-06-011-46/+2
| | | | | | | This removes a bit of context from the verifier erros, but reduces code duplication in a fairly critical part of LLVM and makes dominates easier to test. llvm-svn: 157845
* PR1255: case ranges.Stepan Dyatkovskiy2012-06-011-2/+2
| | | | | | | | | IntItem cleanup. IntItemBase, IntItemConstantIntImp and IntItem merged into IntItem. All arithmetic operators was propogated from APInt. Also added comparison operators <,>,<=,>=. Currently you will find set of macros that propogates operators from APInt to IntItem in the beginning of IntegerSubset. Note that THESE MACROS WILL REMOVED after all passes will case-ranges compatible. Also note that these macros much smaller pain that something like this: if (V->getValue().ugt(AnotherV->getValue()) { ... } These changes made IntItem full featured integer object. It allows to make IntegerSubset class generic (move out all ConstantInt references inside and add unit-tests) in next commits. llvm-svn: 157810
* Fix typos noticed by Benjamin Kramer.Rafael Espindola2012-05-311-10/+29
| | | | | | | Also make the checks stronger and test that we reject ranges that overlap a previous wrapped range. llvm-svn: 157749
* Require intervals in the range metadata to be in a canonical form: They mustRafael Espindola2012-05-311-2/+16
| | | | | | | | | | | be non contiguous, non overlapping and sorted by the lower end. While this is technically a backward incompatibility, every frontent currently produces range metadata with a single interval and we don't have any pass that merges intervals yet, so no existing bitcode files should be rejected by this. llvm-svn: 157741
* ConstantRangesSet renamed to IntegersSubset. CRSBuilder renamed to ↵Stepan Dyatkovskiy2012-05-292-13/+13
| | | | | | IntegersSubsetMapping. llvm-svn: 157612
* PR1255: Case RangesStepan Dyatkovskiy2012-05-282-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Implemented IntItem - the wrapper around APInt. Why not to use APInt item directly right now? 1. It will very difficult to implement case ranges as series of small patches. We got several large and heavy patches. Each patch will about 90-120 kb. If you replace ConstantInt with APInt in SwitchInst you will need to changes at the same time all Readers,Writers and absolutely all passes that uses SwitchInst. 2. We can implement APInt pool inside and save memory space. E.g. we use several switches that works with 256 bit items (switch on signatures, or strings). We can avoid value duplicates in this case. 3. IntItem can be easyly easily replaced with APInt. 4. Currenly we can interpret IntItem both as ConstantInt and as APInt. It allows to provide SwitchInst methods that works with ConstantInt for non-updated passes. Why I need it right now? Currently I need to update SimplifyCFG pass (EqualityComparisons). I need to work with APInts directly a lot, so peaces of code ConstantInt *V = ...; if (V->getValue().ugt(AnotherV->getValue()) { ... } will look awful. Much more better this way: IntItem V = ConstantIntVal->getValue(); if (AnotherV < V) { } Of course any reviews are welcome. P.S.: I'm also going to rename ConstantRangesSet to IntegersSubset, and CRSBuilder to IntegersSubsetMapping (allows to map individual subsets of integers to the BasicBlocks). Since in future these classes will founded on APInt, it will possible to use them in more generic ways. llvm-svn: 157576
* switch AttrListPtr::get to take an ArrayRef, simplifying a lot of clients.Chris Lattner2012-05-281-15/+14
| | | | llvm-svn: 157556
* simplify code.Chris Lattner2012-05-281-3/+2
| | | | llvm-svn: 157555
* Reimplement the intrinsic verifier to use the same table as ↵Chris Lattner2012-05-271-265/+106
| | | | | | | | | | | | | Intrinsic::getDefinition, making it stronger and more sane. Delete the code from tblgen that produced the old code. Besides being a path forward in intrinsic sanity, this also eliminates a bunch of machine generated code that was compiled into Function.o llvm-svn: 157545
* move some code around so that Verifier.cpp can get access to the intrinsic ↵Chris Lattner2012-05-271-46/+182
| | | | | | info table. llvm-svn: 157540
* enhance the intrinsic info table to encode what *kind* of Any argumentChris Lattner2012-05-271-1/+1
| | | | | | | it is (at the cost of 45 bytes of extra table space) so that the verifier can start using it. llvm-svn: 157536
* Add half support to LLVM (for OpenCL)Tobias Grosser2012-05-241-9/+16
| | | | | | | | | | Submitted by: Anton Lokhmotov <Anton.Lokhmotov@arm.com> Approved by: o Anton Korobeynikov o Micah Villmow o David Neto llvm-svn: 157393
* Fixed typo in r156905.Patrik Hägglund2012-05-231-2/+2
| | | | llvm-svn: 157320
* small refinement to r157218 to save a tiny amount of table size in the commonChris Lattner2012-05-231-1/+3
| | | | | | case. llvm-svn: 157312
* revert my previous patches that introduced an additional parameter to the ↵Nuno Lopes2012-05-221-25/+1
| | | | | | | | objectsize intrinsic. After a lot of discussion, we realized it's not the best option for run-time bounds checking llvm-svn: 157255
* Added address space qualifier to intrinsic PointerType arguments.Pete Cooper2012-05-211-2/+5
| | | | llvm-svn: 157218
* PR1255 (case ranges: work with ConstantRangesSet instead of ConstantInt) ↵Stepan Dyatkovskiy2012-05-211-6/+20
| | | | | | related changes for Execution and Verifier. llvm-svn: 157183
* Move CallbackVHs dtor inline, it can be devirtualized in many cases. Move ↵Benjamin Kramer2012-05-191-3/+6
| | | | | | the other virtual methods out of line as they are only called from within Value.cpp anyway. llvm-svn: 157123
* enhance the intrinsic info stuff to emit encodings that don't fit in 32-bits ↵Chris Lattner2012-05-171-17/+20
| | | | | | | | | into a separate side table, using the handy SequenceToOffsetTable class. This encodes all these weird things into another 256 bytes, allowing all intrinsics to be encoded this way. llvm-svn: 156995
* Fix compile error.Manuel Klimek2012-05-171-1/+1
| | | | llvm-svn: 156986
* Genericize the intrinsics descriptor decoding a bit to make room Chris Lattner2012-05-171-20/+25
| | | | | | for future expansion, no functionality change yet though. llvm-svn: 156979
* finish encoding all of the interesting details of intrinsics. Now intrinsicsChris Lattner2012-05-171-3/+25
| | | | | | | are only rejected because they can't be encoded into a 32-bit unit, not because they contain an unencodable feature. llvm-svn: 156978
* strengthen the intrinsic descriptor stuff to be able to handle sin, cos and ↵Chris Lattner2012-05-171-10/+21
| | | | | | | | other intrinsics that use passed-in arguments. llvm-svn: 156977
* Significantly reduce the compiled size of Functions.cpp by turning a big ↵Chris Lattner2012-05-161-6/+44
| | | | | | | | | | blob of tblgen generated code (for Intrinsic::getType) into a table. This handles common cases right now, but I plan to extend it to handle all cases and merge in type verification logic as well in follow-on patches. llvm-svn: 156905
* Use ArrayRef instead of an explicit vector type.Bill Wendling2012-05-141-2/+1
| | | | llvm-svn: 156755
* Recommited r156374 with critical fixes in BitcodeReader/Writer:Stepan Dyatkovskiy2012-05-121-1/+8
| | | | | | | | Ordinary patch for PR1255. Added new case-ranges orientated methods for adding/removing cases in SwitchInst. After this patch cases will internally representated as ConstantArray-s instead of ConstantInt, externally cases wrapped within the ConstantRangesSet object. Old methods of SwitchInst are also works well, but marked as deprecated. So on this stage we have no side effects except that I added support for case ranges in BitcodeReader/Writer, of course test for Bitcode is also added. Old "switch" format is also supported. llvm-svn: 156704
* Teach Function::hasAddressTaken that BlockAddress doesn't really takeJay Foad2012-05-121-1/+2
| | | | | | the address of a function. llvm-svn: 156703
* Fix a problem with incomplete equality testing of PHINodes in Joel Jones2012-05-101-1/+8
| | | | | | | | | | | | | | | | | | | | Instruction::IsIdenticalToWhenDefined. This manifested itself when inlining two calls to the same function. The inlined function had a switch statement that returned one of a set of global variables. Without this modification, the two phi instructions that chose values from the branches of the switch instruction inlined from the callee were considered equivalent and jump-threading replaced a load for the first switch value with a phi selecting from the second switch, thereby producing incorrect code. This patch has been tested with "make check-all", "lnt runteste nt", and llvm self-hosted, and on the original program that had this problem, wireshark. <rdar://problem/11025519> llvm-svn: 156548
* Introduce llvm-c function LLVMPrintModuleToFile.Hans Wennborg2012-05-091-0/+19
| | | | | | | | | This lets you save the textual representation of the LLVM IR to a file. Before this patch it could only be printed to STDERR from llvm-c. Patch by Carlo Kok! llvm-svn: 156479
* change the objectsize intrinsic signature: add a 3rd parameter to denote the ↵Nuno Lopes2012-05-091-1/+25
| | | | | | | | maximum runtime performance penalty that the user is willing to accept. This commit only adds the parameter. Code taking advantage of it will follow. llvm-svn: 156473
* Rejected r156374: Ordinary PR1255 patch. Due to clang-x86_64-debian-fnt ↵Stepan Dyatkovskiy2012-05-081-8/+1
| | | | | | buildbot failure. llvm-svn: 156377
* Remove 256-bit AVX non-temporal store intrinsics. Similar was previously ↵Craig Topper2012-05-081-5/+33
| | | | | | done for 128-bit. llvm-svn: 156375
* Ordinary patch for PR1255.Stepan Dyatkovskiy2012-05-081-1/+8
| | | | | | | Added new case-ranges orientated methods for adding/removing cases in SwitchInst. After this patch cases will internally representated as ConstantArray-s instead of ConstantInt, externally cases wrapped within the ConstantRangesSet object. Old methods of SwitchInst are also works well, but marked as deprecated. So on this stage we have no side effects except that I added support for case ranges in BitcodeReader/Writer, of course test for Bitcode is also added. Old "switch" format is also supported. llvm-svn: 156374
* Reapply r155682, making constant folding more consistent, with a fix to workDan Gohman2012-04-271-28/+37
| | | | | | properly with how the code handles all-undef PHI nodes. llvm-svn: 155721
* Revert r155682, "Use ConstantExpr::getExtractElement when constant-folding ↵NAKAMURA Takumi2012-04-271-37/+28
| | | | | | | | vectors" It broke stage2 build. stage1/clang sometimes crashed. llvm-svn: 155699
* Use ConstantExpr::getExtractElement when constant-folding vectorsDan Gohman2012-04-271-28/+37
| | | | | | | | | | | | | | | | | | | | | instead of getAggregateElement. This has the advantage of being more consistent and allowing higher-level constant folding to procede even if an inner extract element cannot be folded. Make ConstantFoldInstruction call ConstantFoldConstantExpression on the instruction's operands, making it more consistent with ConstantFoldConstantExpression itself. This makes sure that ConstantExprs get TargetData-aware folding before being handed off as operands for further folding. This causes more expressions to be folded, but due to a known shortcoming in constant folding, this currently has the side effect of stripping a few more nuw and inbounds flags in the non-targetdata side of constant-fold-gep.ll. This is mostly harmless. This fixes rdar://11324230. llvm-svn: 155682
* Don't forget to reset 'first operand' flag when we're setting the ↵Bill Wendling2012-04-261-5/+8
| | | | | | MDNodeOperand value. llvm-svn: 155599
* ConstantFoldSelectInstruction swapped the operands of the select.Nadav Rotem2012-04-241-1/+1
| | | | | | Fix 12592. Patch by Matt Pharr. llvm-svn: 155480
* Cleanup whitespace.Bill Wendling2012-04-231-32/+32
| | | | llvm-svn: 155328
* Limit the number of times we recurse through this algorithm. All of theBill Wendling2012-04-231-5/+17
| | | | | | | intructions are processed. So there's no need to look at them if they're used as operands of other instructions. llvm-svn: 155327
* Add a flag to the struct type finder to collect only those types which haveBill Wendling2012-04-211-5/+8
| | | | | | names. This saves collecting types we normally don't care about. llvm-svn: 155300
OpenPOWER on IntegriCloud