summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Grab-bag of reassociate tweaks. Unify handling of dead instructions andDuncan Sands2012-06-061-123/+111
| | | | | | | | | instructions to reoptimize. Exploit this to more systematically eliminate dead instructions (this isn't very useful in practice but is convenient for analysing some testcase I am working on). No need for WeakVH any more: use an AssertingVH instead. llvm-svn: 158073
* LoopUnroll: always check for NULL LoopPassManagerAndrew Trick2012-06-051-3/+5
| | | | llvm-svn: 158007
* When gvn decides to replace an instruction with another, we have to patch theRafael Espindola2012-06-041-2/+200
| | | | | | | | | | | | replacement to make it at least as generic as the instruction being replaced. This includes: * dropping nsw/nuw flags * getting the least restrictive tbaa and fpmath metadata * merging ranges Fixes PR12979. llvm-svn: 157958
* Fix typos found by http://github.com/lyda/misspell-checkBenjamin Kramer2012-06-027-7/+7
| | | | llvm-svn: 157885
* PR1255: case ranges.Stepan Dyatkovskiy2012-06-022-4/+4
| | | | | | IntRange converted from struct to class. So main change everywhere is replacement of ".Low/High" with ".getLow/getHigh()" llvm-svn: 157884
* Register the gcov "writeout" at init time. Don't list this as a d'tor. Instead,Bill Wendling2012-06-011-2/+22
| | | | | | | | | | | | inject some code in that will run via the "__mod_init_func" method that registers the gcov "writeout" function to execute at exit time. The problem is that the "__mod_term_func" method of specifying d'tors is deprecated on Darwin. And it can lead to some ambiguities when dealing with multiple libraries. <rdar://problem/11110106> llvm-svn: 157852
* BoundsChecking: fix a bug when the handling of recursive PHIs failed and ↵Nuno Lopes2012-06-011-22/+39
| | | | | | | | | | could leave dangling references in the cache add regression tests for this problem. Can already compile & run: PHP, PCRE, and ICU (i.e., all the software I tried) llvm-svn: 157822
* add -bounds-checking-multiple-traps option to make one trap BB per checkNuno Lopes2012-05-311-1/+5
| | | | | | disabled by default for now; we can discusse the default value (& name) later llvm-svn: 157777
* revamp BoundsChecking considerably:Nuno Lopes2012-05-311-129/+230
| | | | | | | | | | | | - compute size & offset at the same time. The side-effects of this are that we now support negative GEPs. It's now approaching a phase that it can be reused by other passes (e.g., lowering of the objectsize intrinsic) - use APInt throughout to handle wrap-arounds - add support for PHI instrumentation - add a cache (required for recursive PHIs anyway) - remove hoisting support for now, since it was wrong in a few cases sorry for the churn here.. tests will follow soon. llvm-svn: 157775
* Enhance the sinking code to handle diamond patterns. Patch byDuncan Sands2012-05-311-75/+69
| | | | | | Carlo Alberto Ferraris. llvm-svn: 157736
* [asan] instrument cmpxchg and atomicrmwKostya Serebryany2012-05-301-8/+30
| | | | llvm-svn: 157683
* bounds checking:Nuno Lopes2012-05-291-13/+51
| | | | | | | - hoist checks out of loops where SCEV is smart enough - add additional statistics to measure how much we loose for not supporting interprocedural and pointers loaded from memory llvm-svn: 157649
* ConstantRangesSet renamed to IntegersSubset. CRSBuilder renamed to ↵Stepan Dyatkovskiy2012-05-292-8/+8
| | | | | | IntegersSubsetMapping. llvm-svn: 157612
* Fix suspicous hasOneUse() check, found by PVS Studio (PR12357).Benjamin Kramer2012-05-281-1/+1
| | | | llvm-svn: 157592
* InstCombine: Fix infinite loop when encountering switch on trivial icmp.Benjamin Kramer2012-05-281-1/+1
| | | | | | | | | | | | The test case feeds the following into InstCombine's visitSelect: %tobool8 = icmp ne i32 0, 0 %phitmp = select i1 %tobool8, i32 3, i32 0 Then instcombine replaces the right side of the switch with 0, doesn't notice that nothing changes and tries again indefinitely. This fixes PR12897. llvm-svn: 157587
* PR1255: Case RangesStepan Dyatkovskiy2012-05-282-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Implement the indirect counter increment code in a better way. Instead ofBill Wendling2012-05-281-53/+72
| | | | | | | | replicating the code for every place it's needed, we instead generate a function that does that for us. This function is local to the executable, so there shouldn't be any writing violations. llvm-svn: 157564
* switch AttrListPtr::get to take an ArrayRef, simplifying a lot of clients.Chris Lattner2012-05-284-27/+20
| | | | llvm-svn: 157556
* PR12967: Don't crash when trying to fold a shift that's larger than the ↵Benjamin Kramer2012-05-271-1/+1
| | | | | | type's size. llvm-svn: 157548
* Reimplement the intrinsic verifier to use the same table as ↵Chris Lattner2012-05-271-1/+1
| | | | | | | | | | | | | 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
* Since commit 157467, if reassociate isn't actually going to change an expressionDuncan Sands2012-05-261-17/+20
| | | | | | | | | | | then it doesn't alter the instructions composing it, however it would continue to move the instructions to just before the expression root. Ensure it doesn't move them either, so now it really does nothing if there is nothing to do. That commit also ensured that nsw etc flags weren't cleared if the expression was not being changed. Tweak this a bit so that it doesn't clear flags on the initial part of a computation either if that part didn't change but later bits did. llvm-svn: 157518
* SimplifyCFG: Turn the ad-hoc std::pair that represents switch cases into an ↵Benjamin Kramer2012-05-261-39/+54
| | | | | | explicit struct. llvm-svn: 157516
* Add support for branch weight metadata to MDBuilder and use it in various ↵Benjamin Kramer2012-05-262-32/+23
| | | | | | places. llvm-svn: 157515
* Move this debug statement earlier so it is easy to see the order inDuncan Sands2012-05-261-2/+2
| | | | | | which operands come flying out of the linearization stage. llvm-svn: 157512
* The llvm_gcda_increment_indirect_counter function writes to the arguments thatBill Wendling2012-05-251-17/+57
| | | | | | | | | | | | | | are passed in. However, those arguments may be in a write-protected area, as far as the runtime library is concerned. For instance, the data could be placed into a 'linkedit' section, which isn't writable. Emit the code from llvm_gcda_increment_indirect_counter directly into the function instead. Note: The code for this is ugly, and can lead to bloat. We should look into simplifying this code instead of having all of these branches. <rdar://problem/11181370> llvm-svn: 157505
* bounds checking: add support for byval argumentsNuno Lopes2012-05-251-1/+9
| | | | llvm-svn: 157498
* boundschecking:Nuno Lopes2012-05-251-50/+104
| | | | | | | add support for select add experimental support for alloc_size metadata llvm-svn: 157481
* Make the reassociation pass more powerful so that it can handle expressionsDuncan Sands2012-05-251-255/+405
| | | | | | | | | | | | | | | | | with arbitrary topologies (previously it would give up when hitting a diamond in the use graph for example). The testcase from PR12764 is now reduced from a pile of additions to the optimal 1617*%x0+208. In doing this I changed the previous strategy of dropping all uses for expression leaves to one of dropping all but one use. This works out more neatly (but required a bunch of tweaks) and is also safer: some recently fixed bugs during recursive linearization were because the linearization code thinks it completely owns a node if it has no uses outside the expression it is linearizing. But if the node was also in another expression that had been linearized (and thus all uses of the node from that expression dropped) then the conclusion that it is completely owned by the expression currently being linearized is wrong. Keeping one use from within each linearized expression avoids this kind of mistake. llvm-svn: 157467
* PR1255 related changes (case ranges):Stepan Dyatkovskiy2012-05-241-40/+18
| | | | | | | LowerSwitch::Clusterify : main functinality was replaced with CRSBuilder::optimize, so big part of Clusterify's code was reduced. test/Transform/LowerSwitch/feature.ll - this test was refactored: grep + count was replaced with FileCheck usage. llvm-svn: 157384
* BoundsChecking: add a couple of simple tests and fix a bug in branch emitionNuno Lopes2012-05-231-7/+19
| | | | llvm-svn: 157329
* Fix the inliner so that the optsize function attribute don't alter thePatrik Hägglund2012-05-231-8/+11
| | | | | | | | inline threshold if the global inline threshold is lower (as for -Oz). Reviewed by Chandler Carruth and Bill Wendling. llvm-svn: 157323
* Use zero-based shadow by default on Android.Evgeniy Stepanov2012-05-231-2/+7
| | | | llvm-svn: 157317
* PR1255(case ranges) related changes in Local Transformations.Stepan Dyatkovskiy2012-05-231-10/+14
| | | | llvm-svn: 157315
* address some of John Criswell's commentsNuno Lopes2012-05-221-31/+84
| | | | | | teach computeAllocSize about realloc, reallocf, and valloc llvm-svn: 157298
* hopefully fix the CMake build. sorry for breakageNuno Lopes2012-05-221-0/+1
| | | | llvm-svn: 157264
* add a new pass to instrument loads and stores for run-time bounds checkingNuno Lopes2012-05-225-62/+286
| | | | | | | | move EmitGEPOffset from InstCombine to Transforms/Utils/Local.h (a draft of this) patch reviewed by Andrew, thanks. llvm-svn: 157261
* revert my previous patches that introduced an additional parameter to the ↵Nuno Lopes2012-05-221-106/+60
| | | | | | | | objectsize intrinsic. After a lot of discussion, we realized it's not the best option for run-time bounds checking llvm-svn: 157255
* Fix PR12858, a crash due to GVN's PRE not fully removing an instruction from theDuncan Sands2012-05-221-6/+12
| | | | | | | | | | | | leader table. That's because it wasn't expecting instructions to turn up as leader for a value number that is not its own, but equality propagation could create this situation. One solution is to have the leader table use a WeakVH but this slows down GVN by about 5%. Instead just have equality propagation not add instructions to the leader table, only constants and arguments. In theory this might cause GVN to run more (each time it changes something it runs again) but it doesn't seem to occur enough to cause a slow down. llvm-svn: 157251
* Mark an unreachable region of code with llvm_unreachable.Dan Gohman2012-05-211-1/+1
| | | | llvm-svn: 157197
* Do not pass an invalid domtree to SimplifyInstruction fromPeter Collingbourne2012-05-201-2/+2
| | | | | | LoopUnswitch. Fixes PR12887. llvm-svn: 157140
* Do not eliminate allocas whose alignment exceeds that of thePeter Collingbourne2012-05-191-12/+35
| | | | | | | copied-in constant, as a subsequent user may rely on over alignment. Fixes PR12885. llvm-svn: 157134
* Fix replacing all the users of objc weak runtime routinesDan Gohman2012-05-181-2/+12
| | | | | | when deleting them. rdar://11434915. llvm-svn: 157080
* Teach SimplifyLibCalls about stpcpy.David Majnemer2012-05-151-7/+54
| | | | llvm-svn: 156815
* Move the capture analysis from MemoryDependencyAnalysis to a more general placeChad Rosier2012-05-141-1/+5
| | | | | | | | | so that it can be reused in MemCpyOptimizer. This analysis is needed to remove an unnecessary memcpy when returning a struct into a local variable. rdar://11341081 PR12686 llvm-svn: 156776
* Teach Function::hasAddressTaken that BlockAddress doesn't really takeJay Foad2012-05-121-0/+4
| | | | | | the address of a function. llvm-svn: 156703
* objectsize: add a few more tests and fix a bugNuno Lopes2012-05-111-1/+1
| | | | llvm-svn: 156625
* Fix a minor logic mistake transforming compares in instcombine. PR12514.Eli Friedman2012-05-111-1/+1
| | | | llvm-svn: 156600
* objectsize: add support for GEPs with non-constant indexesNuno Lopes2012-05-103-34/+34
| | | | | | add an additional parameter to InstCombiner::EmitGEPOffset() to force it to *not* emit operations with NUW flag llvm-svn: 156585
* Teach DeadStoreElimination to eliminate exit-block stores with phi addresses.Dan Gohman2012-05-101-3/+19
| | | | llvm-svn: 156558
* teach DSE and isInstructionTriviallyDead() about callocNuno Lopes2012-05-102-4/+17
| | | | llvm-svn: 156553
OpenPOWER on IntegriCloud