1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

4550 Commits

Author SHA1 Message Date
Devang Patel
40cfcf7ce2 Fix unused variable warnings.
llvm-svn: 58651
2008-11-03 23:14:09 +00:00
Devang Patel
c959b4dbd3 Ignore conditions that are outside the loop.
llvm-svn: 58631
2008-11-03 19:38:07 +00:00
Andrew Lenharth
97343f0e8b add a period at the end of the comment, ignoring the fact that the comment would be hard pressed to be considered a sentence, but if it makes Bill happy...
llvm-svn: 58630
2008-11-03 19:29:29 +00:00
Devang Patel
78b7de25d1 Turn floating point IVs into integer IVs where possible.
This allows SCEV users to effectively calculate trip count.
LSR later on transforms back integer IVs to floating point IVs
later on to avoid int-to-float casts inside the loop.

llvm-svn: 58625
2008-11-03 18:32:19 +00:00
Andrew Lenharth
312c00cdd4 Ensure that we are checking only calls to the function we are interested in specializing
llvm-svn: 58615
2008-11-03 16:05:35 +00:00
Nick Lewycky
f393d56364 Replace explicit loop with utility function.
llvm-svn: 58593
2008-11-03 03:49:14 +00:00
Nick Lewycky
49abbde699 Changes from Duncan's review:
* merge two weak functions by making them both alias a third non-weak fn
 * don't reimplement CallSite::hasArgument
 * whitelist the safe linkage types

llvm-svn: 58568
2008-11-02 16:46:26 +00:00
Duncan Sands
613d060c2e Get this building on 64 bit machines (error:
cast from ‘const llvm::PointerType*’ to ‘unsigned int’
loses precision).

llvm-svn: 58561
2008-11-02 09:00:33 +00:00
Oscar Fuentes
45b63793cf CMake: added a source file.
llvm-svn: 58559
2008-11-02 06:01:39 +00:00
Nick Lewycky
15a23d029c Add a new MergeFunctions pass. It finds identical functions and merges them.
This triggers only 60 times in llvm-test (look at .llvm.bc, not .linked.rbc)
and so it probably wont be turned on by default. Also, may of those are likely
to go away when PR2973 is fixed.

llvm-svn: 58557
2008-11-02 05:52:50 +00:00
Nick Lewycky
bcadcbb1ec Fix demanded bits analysis with srem by negative number. Based on a patch
by Richard Osborne.

llvm-svn: 58555
2008-11-02 02:41:50 +00:00
Dan Gohman
1f1ebc5389 Fix this recently moved code to use the correct type. CI is now a
ConstantInt, and SI is the original cast instruction. This fixes
PR2996.

llvm-svn: 58549
2008-11-02 00:17:33 +00:00
Daniel Dunbar
8abdac1eb4 Fix warning.
llvm-svn: 58486
2008-10-31 01:50:01 +00:00
Dan Gohman
50061675c5 Canonicalize sext(i1) to i1?-1:0, and update various instcombine
optimizations accordingly.

llvm-svn: 58457
2008-10-30 20:40:10 +00:00
Daniel Dunbar
097da598fb Add InlineCost class for represent the estimated cost of inlining a
function.
 - This explicitly models the costs for functions which should
   "always" or "never" be inlined. This fixes bugs where such costs
   were not previously respected.

llvm-svn: 58450
2008-10-30 19:26:59 +00:00
Chris Lattner
4af91a146a Fix PR2967 by not deleting volatile load/stores that occur before unreachable.
I don't really see this as being needed, but there is little harm from doing
it.

llvm-svn: 58385
2008-10-29 17:46:26 +00:00
Daniel Dunbar
2265cf485e Factor shouldInline method out of Inliner.
- No functionality change.

llvm-svn: 58355
2008-10-29 01:02:02 +00:00
Daniel Dunbar
e2fe2de3f4 Assorted comment/naming fixes, 80-col violations, and reindentation.
- No functionality change.

llvm-svn: 58352
2008-10-28 23:24:26 +00:00
Dan Gohman
3ceee36545 (A & sext(C)) | (B & ~sext(C) -> C ? A : B
llvm-svn: 58351
2008-10-28 22:38:57 +00:00
Torok Edwin
0c0acebd09 export an ID for the instructionNamer, allowing analysis/transformation passes
that need it to require it by ID.

llvm-svn: 58238
2008-10-27 10:16:27 +00:00
Chris Lattner
17afc211e7 Rewrite all the 'PromoteLocallyUsedAlloca[s]' logic. With the power of
LargeBlockInfo, we can now dramatically simplify their implementation
and speed them up at the same time.  Now the code has time proportional
to the number of uses of the alloca, not the size of the block.

This also eliminates code that tried to batch up different allocas which
are used in the same blocks, and eliminates the 'retry list' logic which
was baroque and no unneccesary.  In addition to being a speedup for crazy
cases, this is also a nice cleanup:

PromoteMemoryToRegister.cpp |  270 +++++++++++++++-----------------------------
 1 file changed, 96 insertions(+), 174 deletions(-)

llvm-svn: 58229
2008-10-27 07:05:53 +00:00
Chris Lattner
39c853cf16 Add a new LargeBlockInfo helper, which is just a wrapper around
a trivial dense map.  Use this in RewriteSingleStoreAlloca to
avoid aggressively rescanning blocks over and over again.  This
fixes PR2925, speeding up mem2reg on the testcase in that bug
from 4.56s to 0.02s in a debug build on my machine.

llvm-svn: 58227
2008-10-27 06:05:26 +00:00
Nick Lewycky
3d4f21006b Add value range analyzing of Add and Sub.
Understand that mul %x, 1 = %x.

llvm-svn: 58069
2008-10-24 04:00:26 +00:00
Daniel Dunbar
5447f9679d Change create*Pass factory functions to return Pass* instead of
LoopPass*.
 - Although less precise, this means they can be used in clients
   without RTTI (who would otherwise need to include LoopPass.h, which
   eventually includes things using dynamic_cast). This was the
   simplest solution that presented itself, but I am happy to use a
   better one if available.

llvm-svn: 58010
2008-10-22 23:32:42 +00:00
Dan Gohman
a480933bbd Use Function::getEntryBlock() instead of Function::front(), for clarity.
llvm-svn: 57870
2008-10-21 03:10:28 +00:00
Dan Gohman
080dca2129 Fix a bug that prevented llvm-extract -delete from working.
llvm-svn: 57864
2008-10-21 01:08:07 +00:00
Dan Gohman
133708df57 Use 0 instead of false to return a null pointer.
llvm-svn: 57660
2008-10-17 00:56:52 +00:00
Dan Gohman
6f40163d83 Teach instcombine's visitLoad to scan back several instructions
to find opportunities for store-to-load forwarding or load CSE,
in the same way that visitStore scans back to do DSE. Also, define
a new helper function for testing whether the addresses of two
memory accesses are known to have the same value, and use it in
both visitStore and visitLoad.

These two changes allow instcombine to eliminate loads in code
produced by front-ends that frequently emit obviously redundant
addressing for memory references.

llvm-svn: 57608
2008-10-15 23:19:35 +00:00
Evan Cheng
591baeed7c Combine (fcmp cc0 x, y) | (fcmp cc1 x, y) into a single fcmp when possible.
llvm-svn: 57515
2008-10-14 18:44:08 +00:00
Evan Cheng
778b47e6c0 - Somehow I forgot about one / une.
- Renumber fcmp predicates to match their icmp counterparts.
- Try swapping operands to expose more optimization opportunities.

llvm-svn: 57513
2008-10-14 18:13:38 +00:00
Evan Cheng
91528965e7 Optimize anding of two fcmp into a single fcmp if the operands are the same. e.g. uno && ueq -> ueq
ord && olt -> olt
     ord && ueq -> oeq

llvm-svn: 57507
2008-10-14 17:15:11 +00:00
Matthijs Kooijman
b86d48c717 Make InstructionCombining::getBitCastOperand() recognize GEP instructions and
constant expression with all zero indices as being the same as a bitcast.

llvm-svn: 57442
2008-10-13 15:17:01 +00:00
Chris Lattner
7a61ef92f5 Fix PR2697 by rewriting the '(X / pos) op neg' logic. This also changes
a couple other cases for clarity, but shouldn't affect correctness.

Patch by Eli Friedman!

llvm-svn: 57387
2008-10-11 22:55:00 +00:00
Devang Patel
255fee3bce Check loop exit predicate properly while eliminating one iteration loop.
This patch fixes PR 2869

llvm-svn: 57369
2008-10-10 22:02:57 +00:00
Nuno Lopes
cc4f37aa68 fix memleak by cleaning the global sets on pass exit
llvm-svn: 57353
2008-10-10 16:25:50 +00:00
Dale Johannesen
075a62519f Add a "loses information" return value to APFloat::convert
and APFloat::convertToInteger.  Restore return value to
IEEE754.  Adjust all users accordingly.

llvm-svn: 57329
2008-10-09 23:00:39 +00:00
Nick Lewycky
843c7dfe05 Don't drop alignment on globals when cloning.
llvm-svn: 57320
2008-10-09 06:27:14 +00:00
Nuno Lopes
a4813e472c dont specialize weak functions and the like
llvm-svn: 57305
2008-10-08 18:45:59 +00:00
Duncan Sands
8f296a3788 Add <cstdio> include where needed by gcc-4.4.
Patch by Samuel Tardieu.

llvm-svn: 57291
2008-10-08 07:23:46 +00:00
Chris Lattner
0aa4423c8c Add parentheses to avoid warnings in GCC 4.4.0,
patch by Samuel Tardieu!

llvm-svn: 57288
2008-10-08 06:42:28 +00:00
Andrew Lenharth
c83731e00a Correctly set attributes when removing args during cloning. Fixes PR2765
llvm-svn: 57254
2008-10-07 18:08:38 +00:00
Devang Patel
378c8633e5 Fix typo, fix PR 2865.
llvm-svn: 57221
2008-10-06 23:22:54 +00:00
Matthijs Kooijman
12cd5d041d Allow scalarrepl to treat an all-zero GEP just as bitcast.
This includes not marking a GEP involving a vector as unsafe, but only when it
has all zero indices. This allows scalarrepl to work in a few more cases.

llvm-svn: 57177
2008-10-06 16:23:31 +00:00
Chris Lattner
107e8f8b60 rewrite bswap matching to be more general, allowing arbitrary
shifting and masking inside a bswap expr.  This allows it to handle
the cases from PR2842, which involve the intermediate 'or' 
expressions being shifted, not just the input value.

llvm-svn: 57095
2008-10-05 02:13:19 +00:00
Chris Lattner
6fae76bbf3 fix a bug where the bswap matcher could match a case involving
ashr.  It should only apply to lshr.

llvm-svn: 57089
2008-10-05 00:50:57 +00:00
Duncan Sands
e22385630e Ignore loads from and stores to local memory (i.e. allocas)
when deciding whether to mark a function readnone/readonly.
Since the pass is currently run before SROA, this may be
quite helpful.  Requested by Chris on IRC.

llvm-svn: 57050
2008-10-04 13:24:24 +00:00
Dan Gohman
700611dfc6 Clean up some multiple-return-value code that is no longer
applicable.

llvm-svn: 57033
2008-10-03 22:21:24 +00:00
Devang Patel
55401473f9 Nick Lewycky's patch.
While hosting instruction check PHI node.

llvm-svn: 57025
2008-10-03 18:57:37 +00:00
Duncan Sands
5edd9b2350 Teach internalize to preserve the callgraph.
Why?  Because it was there!

llvm-svn: 56996
2008-10-03 07:36:09 +00:00
Owen Anderson
e98ca283b0 SplitBlock should only attempt to update LoopInfo if it is actually being used.
llvm-svn: 56994
2008-10-03 06:55:35 +00:00