aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Implement a little hack for parity with GCC on crafty. This speeds upChris Lattner2005-12-121-2/+277
| | | | | | | | | | | | | | | | | | | | | | | 186.crafty by about 16% (from 15.109s to 13.045s) on my system. This turns allocas with unions/casts into scalars. For example crafty has something like this: union doub { unsigned short i[4]; long long d; }; int f(long long a) { return ((union doub){.d=a}).i[1]; } Instead of generating loads and stores to an alloca, we now promote the whole thing to a scalar long value. This implements: Transforms/ScalarRepl/AggregatePromote.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24667 91177308-0d34-0410-b5e6-96231b3b80d8
* getRawValue zero extens for unsigned values, use getsextvalue so that weChris Lattner2005-12-051-3/+3
| | | | | | | | know that small negative values fit into the immediate field of addressing modes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24608 91177308-0d34-0410-b5e6-96231b3b80d8
* Wrap a long line, never internalize llvm.used.Chris Lattner2005-12-051-2/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24602 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix SimplifyCFG/2005-12-03-IncorrectPHIFold.llChris Lattner2005-12-031-8/+14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24581 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug where we didn't realize that vaarg reads memory. This fixesChris Lattner2005-11-301-0/+7
| | | | | | | Transforms/DeadStoreElimination/2005-11-30-vaarg.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24545 91177308-0d34-0410-b5e6-96231b3b80d8
* a few more comments on the interfaces and functionsAndrew Lenharth2005-11-281-3/+20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24500 91177308-0d34-0410-b5e6-96231b3b80d8
* Added documented rsprofiler interface. Also remove new profiler passes, theAndrew Lenharth2005-11-283-135/+63
| | | | | | | old ones have been updated to implement the interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24499 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix VC++ warning.Jeff Cohen2005-11-281-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24496 91177308-0d34-0410-b5e6-96231b3b80d8
* Random sampling (aka Arnold and Ryder) profiling. This is still ↵Andrew Lenharth2005-11-282-0/+730
| | | | | | | | | | | | | | | | | | preliminary, but it works on spec on x86 and alpha. The idea is to allow profiling passes to remember what profiling they inserted, then a random sampling framework is inserted which consists of duplicated basic blocks (without profiling), such that at each backedge in the program and entry into every function, the framework chooses whether to use the instrumented code or the instrumentation free code. The goal of such a framework is to make it reasonably cheap to do random sampling of very expensive profiling products (such as load-value profiling). The code is organized into 3 parts (2 passes) 1) a linked set of profiling passes, which implement an analysis group (linked, like alias analysis are). These insert profiling into the program, and remember what they inserted, so that at a later time they can be queried about any instruction. 2) a pass that handles inserting the random sampling framework. This also has options to control how random samples are choosen. Currently implemented are Global counters, register allocated global counters, and read cycle counter (see? there was a reason for it). The profiling passes are almost identical to the existing ones (block, function, and null profiling is supported right now), and they are valid passes without the sampling framework (hence the existing passes can be unified with the new ones, not done yet). Some things are a bit ugly still, but that should be fixed up soon enough. Other todo? making the counter values not "magic 2^16 -1" values, but dynamically choosable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24493 91177308-0d34-0410-b5e6-96231b3b80d8
* since reg2mem requires it, might as well mention that it preserves itAndrew Lenharth2005-11-251-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24491 91177308-0d34-0410-b5e6-96231b3b80d8
* Reg2Mem is something a pass may depend on, so allow thatAndrew Lenharth2005-11-221-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24488 91177308-0d34-0410-b5e6-96231b3b80d8
* turns out, demotion and invokes and critical edges don't mixAndrew Lenharth2005-11-221-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24487 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a crash building 176.gcc due to my recent patch, which only fixedChris Lattner2005-11-181-1/+1
| | | | | | | half the problem. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24414 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement a refinement to the mem2reg algorithm for cases where an allocaChris Lattner2005-11-181-0/+55
| | | | | | | | | | | has a single def. In this case, look for uses that are dominated by the def and attempt to rewrite them to directly use the stored value. This speeds up mem2reg on these values and reduces the number of phi nodes inserted. This should address PR665. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24411 91177308-0d34-0410-b5e6-96231b3b80d8
* This needs proper dominanceChris Lattner2005-11-181-5/+14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24410 91177308-0d34-0410-b5e6-96231b3b80d8
* This was checking the wrong GEP expression. Fixing this fixes a gccas crashChris Lattner2005-11-171-1/+1
| | | | | | | compiling mysql reported by Ted Kremenek. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24402 91177308-0d34-0410-b5e6-96231b3b80d8
* the pain isn't gone unless the phinodes are spilled tooAndrew Lenharth2005-11-101-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24288 91177308-0d34-0410-b5e6-96231b3b80d8
* this works with backedges to the existing entry block alot betterAndrew Lenharth2005-11-101-2/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24270 91177308-0d34-0410-b5e6-96231b3b80d8
* The pass everyone has been waiting for!Andrew Lenharth2005-11-101-0/+79
| | | | | | | | | Reg2Mem for fun you can opt -reg2mem -mem2reg git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24267 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support alignment of allocation instructions.Nate Begeman2005-11-054-16/+21
| | | | | | | | | | Add support for specifying alignment and size of setjmp jmpbufs. No targets currently do anything with this information, nor is it presrved in the bytecode representation. That's coming up next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24196 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement Transforms/TailCallElim/return-undef.ll, a trivial caseChris Lattner2005-11-051-0/+1
| | | | | | | that has been sitting in my inbox since May 18. :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24194 91177308-0d34-0410-b5e6-96231b3b80d8
* Turn sdiv into udiv if both operands have a clear sign bit. This occursChris Lattner2005-11-051-0/+19
| | | | | | | | | | | | | | | | | | a few times in crafty: OLD: %tmp.36 = div int %tmp.35, 8 ; <int> [#uses=1] NEW: %tmp.36 = div uint %tmp.35, 8 ; <uint> [#uses=0] OLD: %tmp.19 = div int %tmp.18, 8 ; <int> [#uses=1] NEW: %tmp.19 = div uint %tmp.18, 8 ; <uint> [#uses=0] OLD: %tmp.117 = div int %tmp.116, 8 ; <int> [#uses=1] NEW: %tmp.117 = div uint %tmp.116, 8 ; <uint> [#uses=0] OLD: %tmp.92 = div int %tmp.91, 8 ; <int> [#uses=1] NEW: %tmp.92 = div uint %tmp.91, 8 ; <uint> [#uses=0] Which all turn into shrs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24190 91177308-0d34-0410-b5e6-96231b3b80d8
* Turn srem -> urem when neither input has their sign bit set. This triggersChris Lattner2005-11-051-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | 8 times in vortex, allowing the srems to be turned into shrs: OLD: %tmp.104 = rem int %tmp.5.i37, 16 ; <int> [#uses=1] NEW: %tmp.104 = rem uint %tmp.5.i37, 16 ; <uint> [#uses=0] OLD: %tmp.98 = rem int %tmp.5.i24, 16 ; <int> [#uses=1] NEW: %tmp.98 = rem uint %tmp.5.i24, 16 ; <uint> [#uses=0] OLD: %tmp.91 = rem int %tmp.5.i19, 8 ; <int> [#uses=1] NEW: %tmp.91 = rem uint %tmp.5.i19, 8 ; <uint> [#uses=0] OLD: %tmp.88 = rem int %tmp.5.i14, 8 ; <int> [#uses=1] NEW: %tmp.88 = rem uint %tmp.5.i14, 8 ; <uint> [#uses=0] OLD: %tmp.85 = rem int %tmp.5.i9, 1024 ; <int> [#uses=2] NEW: %tmp.85 = rem uint %tmp.5.i9, 1024 ; <uint> [#uses=0] OLD: %tmp.82 = rem int %tmp.5.i, 512 ; <int> [#uses=2] NEW: %tmp.82 = rem uint %tmp.5.i1, 512 ; <uint> [#uses=0] OLD: %tmp.48.i = rem int %tmp.5.i.i161, 4 ; <int> [#uses=1] NEW: %tmp.48.i = rem uint %tmp.5.i.i161, 4 ; <uint> [#uses=0] OLD: %tmp.20.i2 = rem int %tmp.5.i.i, 4 ; <int> [#uses=1] NEW: %tmp.20.i2 = rem uint %tmp.5.i.i, 4 ; <uint> [#uses=0] it also occurs 9 times in gcc, but with odd constant divisors (1009 and 61) so the payoff isn't as great. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24189 91177308-0d34-0410-b5e6-96231b3b80d8
* make this 64 bit clean, fixed test30 of ↵Andrew Lenharth2005-11-021-1/+1
| | | | | | /Regression/Transforms/InstCombine/add.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24158 91177308-0d34-0410-b5e6-96231b3b80d8
* Limit the search depth of MaskedValueIsZero to 6 instructions, to avoidChris Lattner2005-10-311-10/+14
| | | | | | | | bad cases. This fixes Markus's second testcase in PR639, and should seal it for good. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24123 91177308-0d34-0410-b5e6-96231b3b80d8
* This pass is now obsolete since all targets have moved to the SelectionDAGChris Lattner2005-10-291-170/+0
| | | | | | | infrastructure and the simple isels have been removed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24090 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove dead #includeChris Lattner2005-10-291-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24083 91177308-0d34-0410-b5e6-96231b3b80d8
* Now that instcombine does this xform, remove it from the -raise passChris Lattner2005-10-291-120/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24082 91177308-0d34-0410-b5e6-96231b3b80d8
* Pull some code out into a function, give it the ability to see through +.Chris Lattner2005-10-291-24/+59
| | | | | | | This allows us to turn code like malloc(4*x+4) -> malloc int, (x+1) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24081 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a special case, allowing the general case to handle it. No functionalityChris Lattner2005-10-291-49/+37
| | | | | | | change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24076 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bit of backwards logic that broke exptree and smg2000Chris Lattner2005-10-281-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24056 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not sink any instruction with side effects, including vaarg. This fixesChris Lattner2005-10-271-4/+2
| | | | | | | PR640 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24046 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix #include orderChris Lattner2005-10-271-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24044 91177308-0d34-0410-b5e6-96231b3b80d8
* Move some constant folding code shared by Analysis and Transform passesJohn Criswell2005-10-272-142/+2
| | | | | | | | | into the LLVMAnalysis library. This allows LLVMTranform and LLVMTransformUtils to be archives and linked with LLVMAnalysis.a, which provides any missing definitions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24036 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typoChris Lattner2005-10-271-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24033 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach instcombine to promote stuff like (cast (malloc sbyte, 8*X) to int*)Chris Lattner2005-10-271-7/+26
| | | | | | | into: malloc int, (2*X) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24032 91177308-0d34-0410-b5e6-96231b3b80d8
* Promote cases like cast (malloc sbyte, 100) to int* intoChris Lattner2005-10-271-1/+22
| | | | | | | | (malloc [25 x int]) directly without having to convert to (malloc [100 x sbyte]) first. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24031 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor change to this file to support obscure cases with constant array amountsChris Lattner2005-10-271-5/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24030 91177308-0d34-0410-b5e6-96231b3b80d8
* 1. Remove libraries no longer created from the list of libraries linked into theJohn Criswell2005-10-261-1/+0
| | | | | | | | | | | SparcV9 JIT. 2. Make LLVMTransformUtils a relinked object file and always link it before LLVMAnalysis.a. These two libraries have circular dependencies on each other which creates problem when building the SparcV9 JIT. This change fixes the dependency on all platforms problems with a minimum of fuss. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24023 91177308-0d34-0410-b5e6-96231b3b80d8
* fold nested and's early to avoid inefficiencies in MaskedValueIsZero. ThisChris Lattner2005-10-261-0/+9
| | | | | | | fixes a very slow compile in PR639. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24011 91177308-0d34-0410-b5e6-96231b3b80d8
* Stop using deprecated typesAlkis Evlogimenos2005-10-251-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23973 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle allocations that, even after removing dead uses, still have more thanChris Lattner2005-10-241-3/+15
| | | | | | | | | | | | | | | one use (but one is a cast). This handles the very common case of: X = alloc [n x byte] Y = cast X to somethingbetter seteq X, null In order to avoid infinite looping when there are multiple casts, we only allow this if the xform is strictly increasing the alignment of the allocation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23961 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug where we would 'promote' an allocation from one type to anotherChris Lattner2005-10-241-2/+6
| | | | | | | | where the second has less alignment required. If we had explicit alignment support in the IR, we could handle this case, but we can't until we do. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23960 91177308-0d34-0410-b5e6-96231b3b80d8
* Before promoting a malloc type, remove dead uses. This makes instcombineChris Lattner2005-10-241-0/+20
| | | | | | | | more effective at promoting these allocations, catching them earlier in the compile process. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23959 91177308-0d34-0410-b5e6-96231b3b80d8
* Pull some code out into a function, no functionality changeChris Lattner2005-10-241-25/+36
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23958 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove some beta code that no longer has an owner.Chris Lattner2005-10-249-3043/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23944 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not build the ProfilePaths directory anymoreChris Lattner2005-10-241-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23943 91177308-0d34-0410-b5e6-96231b3b80d8
* DONT_BUILD_RELINKED is gone and implied by BUILD_ARCHIVE nowChris Lattner2005-10-245-5/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23940 91177308-0d34-0410-b5e6-96231b3b80d8
* Only build .a file versions of these libraries, instead of .a and .o versions.Chris Lattner2005-10-245-0/+6
| | | | | | | This should speed up build times. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23933 91177308-0d34-0410-b5e6-96231b3b80d8
* Make sure that anything using the ADCE pass pulls in the UnifyFunctionExitNodesChris Lattner2005-10-241-0/+2
| | | | | | | code git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23931 91177308-0d34-0410-b5e6-96231b3b80d8