aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Change the interface to the type legalization methodDuncan Sands2008-12-0120-378/+377
| | | | | | | | | | | | ReplaceNodeResults: rather than returning a node which must have the same number of results as the original node (which means mucking around with MERGE_VALUES, and which is also easy to get wrong since SelectionDAG folding may mean you don't get the node you expect), return the results in a vector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60348 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize the FoldOrWithConstant method to fold for any two constants whichBill Wendling2008-12-011-23/+22
| | | | | | | don't have overlapping bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60344 91177308-0d34-0410-b5e6-96231b3b80d8
* Reduce copy-and-paste code by splitting out the code into its own function.Bill Wendling2008-12-011-58/+50
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60343 91177308-0d34-0410-b5e6-96231b3b80d8
* Use m_Specific() instead of double matching.Bill Wendling2008-12-012-19/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60341 91177308-0d34-0410-b5e6-96231b3b80d8
* Move pattern check outside of the if-then statement. This prevents us from ↵Bill Wendling2008-12-011-10/+12
| | | | | | fiddling with constants unless we have to. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60340 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename some variables, only increment BI once at the start of the loop ↵Chris Lattner2008-12-011-38/+30
| | | | | | instead of throughout it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60339 91177308-0d34-0410-b5e6-96231b3b80d8
* pull the predMap densemap out of the inner loop of performPRE, soChris Lattner2008-12-011-2/+4
| | | | | | | | that it isn't reallocated all the time. This is a tiny speedup for GVN: 3.90->3.88s git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60338 91177308-0d34-0410-b5e6-96231b3b80d8
* switch a couple more calls to use array_pod_sort.Chris Lattner2008-12-012-3/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60337 91177308-0d34-0410-b5e6-96231b3b80d8
* don't assume iterators implicitly convert to pointers.Chris Lattner2008-12-011-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60336 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a new array_pod_sort function and switch LSR to use itChris Lattner2008-12-012-2/+39
| | | | | | | | | | instead of std::sort. This shrinks the release-asserts LSR.o file by 1100 bytes of code on my system. We should start using array_pod_sort where possible. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60335 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate use of setvector for the DeadInsts set, just use a smallvector.Chris Lattner2008-12-011-17/+31
| | | | | | | This is a lot cheaper and conceptually simpler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60332 91177308-0d34-0410-b5e6-96231b3b80d8
* DeleteTriviallyDeadInstructions is always passed theChris Lattner2008-12-011-10/+9
| | | | | | | DeadInsts ivar, just use it directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60330 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify DeleteTriviallyDeadInstructions again, unlike my previousChris Lattner2008-12-011-20/+13
| | | | | | | | | buggy rewrite, this notifies ScalarEvolution of a pending instruction about to be removed and then erases it, instead of erasing it then notifying. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60329 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify these patterns using m_Specific. No need to grep for Chris Lattner2008-12-012-19/+7
| | | | | | | xor in testcase (or is a substring). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60328 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach jump threading to clean up after itself, DCE and constfolding theChris Lattner2008-12-011-1/+24
| | | | | | | | | | new instructions it simplifies. Because we're threading jumps on edges with constants coming in from PHI's, we inherently are exposing a lot more constants to the new block. Folding them and deleting dead conditions allows the cost model in jump threading to be more accurate as it iterates. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60327 91177308-0d34-0410-b5e6-96231b3b80d8
* The PreVerifier pass preserves everything. In practice, thisChris Lattner2008-12-011-0/+4
| | | | | | | | prevents the passmgr from adding yet-another domtree invocation for Verifier if there is already one live. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60326 91177308-0d34-0410-b5e6-96231b3b80d8
* Change instcombine to use FoldPHIArgGEPIntoPHI to fold two operand PHIsChris Lattner2008-12-011-17/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instead of using FoldPHIArgBinOpIntoPHI. In addition to being more obvious, this also fixes a problem where instcombine wouldn't merge two phis that had different variable indices. This prevented instcombine from factoring big chunks of code in 403.gcc. For example: insn_cuid.exit: - %tmp336 = load i32** @uid_cuid, align 4 - %tmp337 = getelementptr %struct.rtx_def* %insn_addr.0.ph.i, i32 0, i32 3 - %tmp338 = bitcast [1 x %struct.rtunion]* %tmp337 to i32* - %tmp339 = load i32* %tmp338, align 4 - %tmp340 = getelementptr i32* %tmp336, i32 %tmp339 br label %bb62 bb61: - %tmp341 = load i32** @uid_cuid, align 4 - %tmp342 = getelementptr %struct.rtx_def* %insn, i32 0, i32 3 - %tmp343 = bitcast [1 x %struct.rtunion]* %tmp342 to i32* - %tmp344 = load i32* %tmp343, align 4 - %tmp345 = getelementptr i32* %tmp341, i32 %tmp344 br label %bb62 bb62: - %iftmp.62.0.in = phi i32* [ %tmp345, %bb61 ], [ %tmp340, %insn_cuid.exit ] + %insn.pn2 = phi %struct.rtx_def* [ %insn, %bb61 ], [ %insn_addr.0.ph.i, %insn_cuid.exit ] + %tmp344.pn.in.in = getelementptr %struct.rtx_def* %insn.pn2, i32 0, i32 3 + %tmp344.pn.in = bitcast [1 x %struct.rtunion]* %tmp344.pn.in.in to i32* + %tmp341.pn = load i32** @uid_cuid + %tmp344.pn = load i32* %tmp344.pn.in + %iftmp.62.0.in = getelementptr i32* %tmp341.pn, i32 %tmp344.pn %iftmp.62.0 = load i32* %iftmp.62.0.in git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60325 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach inst combine to merge GEPs through PHIs. This is reallyChris Lattner2008-12-012-17/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | important because it is sinking the loads using the GEPs, but not the GEPs themselves. This triggers 647 times on 403.gcc and makes the .s file much much nicer. For example before: je LBB1_87 ## bb78 LBB1_62: ## bb77 leal 84(%esi), %eax LBB1_63: ## bb79 movl (%eax), %eax ... LBB1_87: ## bb78 movl $0, 4(%esp) movl %esi, (%esp) call L_make_decl_rtl$stub jmp LBB1_62 ## bb77 after: jne LBB1_63 ## bb79 LBB1_62: ## bb78 movl $0, 4(%esp) movl %esi, (%esp) call L_make_decl_rtl$stub LBB1_63: ## bb79 movl 84(%esi), %eax The input code was (and the GEPs are merged and the PHI is now eliminated by instcombine): br i1 %tmp233, label %bb78, label %bb77 bb77: %tmp234 = getelementptr %struct.tree_node* %t_addr.3, i32 0, i32 0, i32 22 br label %bb79 bb78: call void @make_decl_rtl(%struct.tree_node* %t_addr.3, i8* null) nounwind %tmp235 = getelementptr %struct.tree_node* %t_addr.3, i32 0, i32 0, i32 22 br label %bb79 bb79: %iftmp.12.0.in = phi %struct.rtx_def** [ %tmp235, %bb78 ], [ %tmp234, %bb77 ] %iftmp.12.0 = load %struct.rtx_def** %iftmp.12.0.in git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60322 91177308-0d34-0410-b5e6-96231b3b80d8
* testcase for my previous commit.Chris Lattner2008-12-011-0/+42
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60315 91177308-0d34-0410-b5e6-96231b3b80d8
* Make GVN be more intelligent about redundant load Chris Lattner2008-12-011-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | elimination: when finding dependent load/stores, realize that they are the same if aliasing claims must alias instead of relying on the pointers to be exactly equal. This makes load elimination more aggressive. For example, on 403.gcc, we had: < 68 gvn - Number of instructions PRE'd < 152718 gvn - Number of instructions deleted < 49699 gvn - Number of loads deleted < 6153 memdep - Number of dirty cached non-local responses < 169336 memdep - Number of fully cached non-local responses < 162428 memdep - Number of uncached non-local responses now we have: > 64 gvn - Number of instructions PRE'd > 153623 gvn - Number of instructions deleted > 49856 gvn - Number of loads deleted > 5022 memdep - Number of dirty cached non-local responses > 159030 memdep - Number of fully cached non-local responses > 162443 memdep - Number of uncached non-local responses That's an extra 157 loads deleted and extra 905 other instructions nuked. This slows down GVN very slightly, from 3.91 to 3.96s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60314 91177308-0d34-0410-b5e6-96231b3b80d8
* Reimplement the non-local dependency data structure in terms of a sortedChris Lattner2008-12-013-87/+137
| | | | | | | | | | | | | | | | | | | | | vector instead of a densemap. This shrinks the memory usage of this thing substantially (the high water mark) as well as making operations like scanning it faster. This speeds up memdep slightly, gvn goes from 3.9376 to 3.9118s on 403.gcc This also splits out the statistics for the cached non-local case to differentiate between the dirty and clean cached case. Here's the stats for 403.gcc: 6153 memdep - Number of dirty cached non-local responses 169336 memdep - Number of fully cached non-local responses 162428 memdep - Number of uncached non-local responses yay for caching :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60313 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement ((A|B)&1)|(B&-2) -> (A&1) | B transformation. This also takes care ofBill Wendling2008-12-013-6/+106
| | | | | | | permutations of this pattern. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60312 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix bogus assertion using getSExtValue for legitimate values, like -1 in Eli Friedman2008-12-011-1/+1
| | | | | | | | | an 128-bit-wide integer. No testcase; the issue I ran into depends on local changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60311 91177308-0d34-0410-b5e6-96231b3b80d8
* Cache analyses in ivars and add some useful DEBUG output.Chris Lattner2008-12-011-37/+30
| | | | | | | This speeds up GVN from 4.0386s to 3.9376s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60310 91177308-0d34-0410-b5e6-96231b3b80d8
* improve indentation, do cheap checks before expensive ones,Chris Lattner2008-11-301-52/+51
| | | | | | | | remove some fixme's. This speeds up GVN very slightly on 403.gcc (4.06->4.03s) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60309 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate the DepResultTy abstraction. It is now completely Chris Lattner2008-11-302-107/+85
| | | | | | | | redundant with MemDepResult, and MemDepResult has a nicer interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60308 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor cleanup: use getTrue and getFalse where appropriate. No Eli Friedman2008-11-301-20/+20
| | | | | | | | functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60307 91177308-0d34-0410-b5e6-96231b3b80d8
* Some minor cleanups to instcombine; no functionality change.Eli Friedman2008-11-301-56/+17
| | | | | | | | | Note that the FoldOpIntoPhi call is dead because it's impossible for the first operand of a subtraction to be both a ConstantInt and a PHINode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60306 91177308-0d34-0410-b5e6-96231b3b80d8
* Cache TargetData/AliasAnalysis in the pass instead of callingChris Lattner2008-11-302-21/+25
| | | | | | | | getAnalysis<>. getAnalysis<> is apparently extremely expensive. Doing this speeds up GVN on 403.gcc by 16%! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60304 91177308-0d34-0410-b5e6-96231b3b80d8
* add the rest of the comparison routines.Chris Lattner2008-11-301-6/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60303 91177308-0d34-0410-b5e6-96231b3b80d8
* Add instruction combining for ((A&~B)|(~A&B)) -> A^B and all permutations.Bill Wendling2008-11-303-6/+65
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60291 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement (A&((~A)|B)) -> A&B transformation in the instruction combiner. ThisBill Wendling2008-11-303-10/+55
| | | | | | | takes care of all permutations of this pattern. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60290 91177308-0d34-0410-b5e6-96231b3b80d8
* Forgot one remaining call to getSExtValue().Bill Wendling2008-11-301-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60289 91177308-0d34-0410-b5e6-96231b3b80d8
* getSExtValue() doesn't work for ConstantInts with bitwidth > 64 bits. Use allBill Wendling2008-11-302-5/+33
| | | | | | | | | APInt calls instead. This fixes PR3144. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60288 91177308-0d34-0410-b5e6-96231b3b80d8
* Optimize memmove and memset into the LLVM builtins. Note that these Eli Friedman2008-11-303-4/+81
| | | | | | | | only show up in code from front-ends besides llvm-gcc, like clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60287 91177308-0d34-0410-b5e6-96231b3b80d8
* A couple small cleanups, plus a new potential optimization.Eli Friedman2008-11-301-3/+29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60286 91177308-0d34-0410-b5e6-96231b3b80d8
* Moving potential optimizations out of PR2330 into lib/Target/README.txt. Eli Friedman2008-11-301-0/+262
| | | | | | | | Hopefully this isn't too much stuff to dump into this file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60285 91177308-0d34-0410-b5e6-96231b3b80d8
* Followup to r60283: optimize arbitrary width signed divisions as well Eli Friedman2008-11-302-71/+44
| | | | | | | | as unsigned divisions. Same caveats as before. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60284 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix for PR2164: allow transforming arbitrary-width unsigned divides intoEli Friedman2008-11-303-96/+76
| | | | | | | | | | | | | multiplies. Some more cleverness would be nice, though. It would be nice if we could do this transformation on illegal types. Also, we would prefer a narrower constant when possible so that we can use a narrower multiply, which can be cheaper. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60283 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't make TwoToExp signed by default.Bill Wendling2008-11-301-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60279 91177308-0d34-0410-b5e6-96231b3b80d8
* From Hacker's Delight:Bill Wendling2008-11-301-8/+10
| | | | | | | | | | | "For signed integers, the determination of overflow of x*y is not so simple. If x and y have the same sign, then overflow occurs iff xy > 2**31 - 1. If they have opposite signs, then overflow occurs iff xy < -2**31." In this case, x == -1. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60278 91177308-0d34-0410-b5e6-96231b3b80d8
* APIntify a test which is potentially unsafe otherwise, and fix the Eli Friedman2008-11-303-4/+33
| | | | | | | | | | | nearby FIXME. I'm not sure what the right way to fix the Cell test was; if the approach I used isn't okay, please let me know. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60277 91177308-0d34-0410-b5e6-96231b3b80d8
* Strengthen check for div inst-combining.Bill Wendling2008-11-301-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60276 91177308-0d34-0410-b5e6-96231b3b80d8
* Instcombine was illegally transforming -X/C into X/-C when either X or CBill Wendling2008-11-304-9/+52
| | | | | | | | | overflowed on negation. This commit checks to make sure that neithe C nor X overflows. This requires that the RHS of X (a subtract instruction) be a constant integer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60275 91177308-0d34-0410-b5e6-96231b3b80d8
* Two changes: Make getDependency remove QueryInst for a dirty record'sChris Lattner2008-11-302-22/+33
| | | | | | | | | | | | ReverseLocalDeps when we update it. This fixes a regression test failure from my last commit. Second, for each non-local cached information structure, keep a bit that indicates whether it is dirty or not. This saves us a scan over the whole thing in the common case when it isn't dirty. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60274 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a link issue I ran into trying compiling LLVM on MinGW with CMake. Eli Friedman2008-11-301-1/+1
| | | | | | | | | Hopefully this doesn't break anyone else's build... it shouldn't unless the MinGW variable means something other than compiling with MinGW. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60273 91177308-0d34-0410-b5e6-96231b3b80d8
* introduce a typedef, no functionality change.Chris Lattner2008-11-302-17/+19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60272 91177308-0d34-0410-b5e6-96231b3b80d8
* Change NonLocalDeps to be a densemap of pointers to densemapChris Lattner2008-11-302-35/+60
| | | | | | | | | | | | | instead of containing them by value. This increases the density (!) of NonLocalDeps as well as making the reallocation case faster. This speeds up gvn on 403.gcc by 2% and makes room for future improvements. I'm not super thrilled with having to explicitly manage the new/delete of the map, but it is necesary for the next change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60271 91177308-0d34-0410-b5e6-96231b3b80d8
* calls never depend on allocations.Chris Lattner2008-11-301-12/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60268 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a fixme by making memdep's handling of allocations more logical.Chris Lattner2008-11-302-35/+22
| | | | | | | | | If we see that a load depends on the allocation of its memory with no intervening stores, we now return a 'None' depedency instead of "Normal". This tweaks GVN to do its optimization with the new result. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60267 91177308-0d34-0410-b5e6-96231b3b80d8