1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-28 14:32:51 +01:00
Commit Graph

4093 Commits

Author SHA1 Message Date
Owen Anderson
b171c54227 Remove unneeded #include's.
llvm-svn: 50035
2008-04-21 07:47:38 +00:00
Owen Anderson
bc6046416f Refactor memcpyopt based on Chris' suggestions. Consolidate several functions
and simplify code that was fallout from the separation of memcpyopt and gvn.

llvm-svn: 50034
2008-04-21 07:45:10 +00:00
Chris Lattner
ca82082080 don't assume that the argument passed to fprintf("%s" is a string. This
fixes a crash in opt on 433.milc.

llvm-svn: 50023
2008-04-21 03:18:33 +00:00
Chris Lattner
9a21fbcf81 Use the new SplitBlockPredecessors to implement a todo.
llvm-svn: 50022
2008-04-21 02:57:57 +00:00
Chris Lattner
57e11a167d Move SplitBlockPredecessors out of loopsimplify into BasicBlockUtils.h
as a global helper function.  At the same type, switch it from taking
a vector of predecessors to an arbitrary sequential input.  This allows
us to switch LoopSimplify to use a SmallVector for various temporary
vectors that it passed into SplitBlockPredecessors.

llvm-svn: 50020
2008-04-21 01:28:02 +00:00
Chris Lattner
ba4567c335 Move domtree/frontier updating earlier, allowing us to use it to update phi
nodes, removing a hack.

llvm-svn: 50019
2008-04-21 01:05:08 +00:00
Chris Lattner
53fa4554be Factor dominator tree and frontier updating into SplitBlockPredecessors
instead of doing it after every call.

llvm-svn: 50018
2008-04-21 00:54:38 +00:00
Chris Lattner
34894abd7f fit some more code in 80 cols.
llvm-svn: 50016
2008-04-21 00:25:49 +00:00
Chris Lattner
7da61d5766 simplify code, fit in 80 cols.
llvm-svn: 50015
2008-04-21 00:23:14 +00:00
Chris Lattner
45b3ace5a3 fit in 80 cols
llvm-svn: 50014
2008-04-21 00:19:16 +00:00
Chris Lattner
56fbe56c25 finish the first cut of a jump threading pass implementation.
llvm-svn: 50006
2008-04-20 22:39:42 +00:00
Chris Lattner
4037996a0c replace a slow and verbose version of Instruction::isUsedOutsideOfBlock with
a call to Instruction::isUsedOutsideOfBlock.

llvm-svn: 50005
2008-04-20 22:18:22 +00:00
Chris Lattner
c714a8cee8 we can only thread blocks when there is a pred we can determine the succ of.
llvm-svn: 50003
2008-04-20 21:18:09 +00:00
Chris Lattner
4fcfb808fb improve comments, infrastructure, and add some validity checks for threading.
Add a cost function.

llvm-svn: 50002
2008-04-20 21:13:06 +00:00
Chris Lattner
c8c74f39db Add a new Jump Threading pass, which will handle cases
such as those in PR2235.  Right now the pass is not very
effective. :)

llvm-svn: 50000
2008-04-20 20:35:01 +00:00
Torok Edwin
e038c595c1 g++-4.3 build-fix: CHAR_BIT requires <climits>.
llvm-svn: 49989
2008-04-20 08:33:11 +00:00
Chris Lattner
f390d62b7f Switch to using Simplified ConstantFP::get API.
llvm-svn: 49977
2008-04-20 00:41:09 +00:00
Chris Lattner
d299f7b8cf Allow argpromote to promote struct arguments with a specified number
of elements.  Patch by Matthijs Kooijman!

llvm-svn: 49962
2008-04-19 19:50:01 +00:00
Owen Anderson
cd1b9c4b43 Make GVN able to remove unnecessary calls to read-only functions again.
llvm-svn: 49842
2008-04-17 05:36:50 +00:00
Scott Michel
31b3639a2d Remove unused variable
llvm-svn: 49838
2008-04-17 01:30:44 +00:00
Scott Michel
4b37c88f48 Workaround for PR2207, in which pred_iterator assert gets triggered due to a
wee problem in Xcode 2.[45]/gcc 4.0.1.

llvm-svn: 49831
2008-04-16 23:46:39 +00:00
Chuck Rose III
fbfb612c4e VisualStudio project files updated. #include <algorithm> added to make VisualStudio happy. Also had to undefine setjmp because of #include <csetjmp> turning setjmp into _setjmp in VisualStudio.
llvm-svn: 49743
2008-04-15 21:27:11 +00:00
Dan Gohman
77049e31b6 Remove unnecessary <sstream> includes.
llvm-svn: 49681
2008-04-14 20:40:47 +00:00
Dan Gohman
3e7d0f3882 Minor whitespace and comment cleanups.
llvm-svn: 49671
2008-04-14 18:26:16 +00:00
Owen Anderson
8aaa632351 Revert r49614. As Dan pointed out, some of these aren't correct.
llvm-svn: 49657
2008-04-14 17:38:21 +00:00
Owen Anderson
b54defaff0 Replace calls of the form V1->setName(V2->getName()) with V1->takeName(V2),
which is significantly more efficient.

llvm-svn: 49614
2008-04-13 19:15:17 +00:00
Owen Anderson
f55bae07b7 Fix PR2213 by simultaneously making GVN more aggressive with the return values
of calls and less aggressive with non-readnone calls.

llvm-svn: 49516
2008-04-11 05:11:49 +00:00
Dan Gohman
318d9a6605 Teach InstCombine's ComputeMaskedBits to handle pointer expressions
in addition to integer expressions. Rewrite GetOrEnforceKnownAlignment
as a ComputeMaskedBits problem, moving all of its special alignment
knowledge to ComputeMaskedBits as low-zero-bits knowledge.

Also, teach ComputeMaskedBits a few basic things about Mul and PHI
instructions.

This improves ComputeMaskedBits-based simplifications in a few cases,
but more noticeably it significantly improves instcombine's alignment
detection for loads, stores, and memory intrinsics.

llvm-svn: 49492
2008-04-10 18:43:06 +00:00
Chris Lattner
0bd4d7eef1 Disable an xform we've had for a long time, pow(x,0.5) -> sqrt.
This is not safe for all inputs.

llvm-svn: 49458
2008-04-10 02:07:51 +00:00
Chris Lattner
be01a5f699 Generalize getUnaryFloatFunction to handle any FP unary function, automatically
figuring out the suffix to use.  implement pow(2,x) -> exp2(x).

llvm-svn: 49437
2008-04-09 17:48:11 +00:00
Chris Lattner
0eb93cf8d0 use the new ConstantFP::get method to make this work with
long double and simplify the code.

llvm-svn: 49435
2008-04-09 17:17:35 +00:00
Devang Patel
47b4a18b75 Be conservative if getresult operand is neither call nor invoke.
llvm-svn: 49430
2008-04-09 15:58:24 +00:00
Owen Anderson
ca7e0e21f3 Factor a bunch of functionality related to memcpy and memset transforms out of
GVN and into its own pass.

llvm-svn: 49419
2008-04-09 08:23:16 +00:00
Owen Anderson
0d844f6205 Remove accidentally duplicated code.
llvm-svn: 49418
2008-04-09 07:55:01 +00:00
Chris Lattner
976ea8990e many cleanups to the pow optimizer. Allow it to handle powf,
add support for  pow(x, 2.0) -> x*x.

llvm-svn: 49411
2008-04-09 00:07:45 +00:00
Devang Patel
1cf9e1e337 Fix insert point handling for multiple return values.
llvm-svn: 49367
2008-04-08 02:24:08 +00:00
Owen Anderson
4ad5a5201c Add operator= implementations to SparseBitVector, allowing it to be used in GVN. This results
in both time and memory savings for GVN.  For example, one testcase went from 10.5s to 6s with
this patch.

llvm-svn: 49345
2008-04-07 17:38:23 +00:00
Duncan Sands
64f15131d8 Use Intrinsic::getDeclaration in more places.
llvm-svn: 49338
2008-04-07 13:45:04 +00:00
Duncan Sands
98ed2df5f3 The "stacksave is not nounwind problem" no longer
needs to be fixed here - a previous commit made sure
that intrinsics always get the right attributes.
So remove no-longer needed code, and while there use
Intrinsic::getDeclaration rather than getOrInsertFunction. 

llvm-svn: 49337
2008-04-07 13:43:58 +00:00
Duncan Sands
9622724bc3 Use Intrinsic::getDeclaration to get hold of
intrinsics.  Fix up the argument type (should
be i8*, was an array*).

llvm-svn: 49336
2008-04-07 13:41:19 +00:00
Owen Anderson
93ab00f1d9 Make GVN more memory efficient, particularly on code that contains a large number of
allocations, which GVN can't optimize anyways.

llvm-svn: 49329
2008-04-07 09:59:07 +00:00
Dale Johannesen
5c2c09c01b Mark calls to llvm.stacksave, llvm.stackrestore as
nounwind.  When such calls are inlined into something
else that is invoked, they were getting changed to invokes,
which is badness.

llvm-svn: 49299
2008-04-07 00:08:48 +00:00
Chris Lattner
f8fac07b94 silence a warning when assertions are disabled.
llvm-svn: 49283
2008-04-06 21:44:08 +00:00
Gabor Greif
6c6b8a57f3 API changes for class Use size reduction, wave 1.
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.

llvm-svn: 49277
2008-04-06 20:25:17 +00:00
David Greene
0ca05878fe Iterators folloring a SmallVector erased element are invalidated so
don't access cached iterators from after the erased element.

Re-apply 49056 with SmallVector support.

llvm-svn: 49106
2008-04-02 18:24:46 +00:00
Evan Cheng
8a61b02bd8 1. Drop default inline threshold back down to 200.
2. Do not use # of basic blocks as part of the cost computation since it doesn't really figure into function size.
3. More aggressively inline function with vector code.

llvm-svn: 49061
2008-04-01 23:59:29 +00:00
Tanya Lattner
221aec3ddb Reverting 49056 due to the build being broken.
llvm-svn: 49060
2008-04-01 23:41:44 +00:00
David Greene
f322cc7462 Iterators folloring a SmallVector erased element are invalidated so
don't access cached iterators from after the erased element.

llvm-svn: 49056
2008-04-01 22:14:23 +00:00
Dale Johannesen
8813206b7f Revert 49006 for the moment.
llvm-svn: 49046
2008-04-01 20:00:57 +00:00
Dale Johannesen
fa4433be71 Emit exception handling info for functions which are
not marked nounwind, or for all functions when -enable-eh
is set, provided the target supports Dwarf EH.

llvm-gcc generates nounwind in the right places; other FEs
will need to do so also.  Given such a FE, -enable-eh should
no longer be needed.

llvm-svn: 49006
2008-03-31 23:40:23 +00:00
Nate Begeman
610aa2511c Don't eliminate bitcast instructions that change the type of a pointer
llvm-svn: 48971
2008-03-31 00:22:16 +00:00
Chris Lattner
49e9edd6f6 Fix "Control reaches the end of non-void function" warnings,
patch by David Chisnall.

llvm-svn: 48963
2008-03-30 18:22:13 +00:00
Chris Lattner
10e3ff7e5f change iterator invalidation avoidance to just move the iterator backward
when something changes, instead of moving forward.  This allows us to 
simplify memset lowering, inserting the memset at the end of the range of 
stuff we're touching instead of at the start.

This, in turn, allows us to make use of the addressing instructions already
used in the function instead of inserting our own.  For example, we now
codegen:

	%tmp41 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 0		; <i8*> [#uses=2]
	call void @llvm.memset.i64( i8* %tmp41, i8 -1, i64 8, i32 1 )

instead of:

	%tmp20 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 7		; <i8*> [#uses=1]
	%ptroffset = getelementptr i8* %tmp20, i64 -7		; <i8*> [#uses=1]
	call void @llvm.memset.i64( i8* %ptroffset, i8 -1, i64 8, i32 1 )

llvm-svn: 48940
2008-03-29 05:15:47 +00:00
Chris Lattner
48b3859ee9 make the common case of a single store (which clearly shouldn't be turned
into a memset!) faster by avoiding an allocation of an std::list node.

llvm-svn: 48939
2008-03-29 04:52:12 +00:00
Chris Lattner
722c9a539f give form-memset a significantly more sane heuristic, enable it by default.
llvm-svn: 48937
2008-03-29 04:36:18 +00:00
Chris Lattner
0a18724a00 make memset inference significantly more powerful: it can now handle
memsets that initialize "structs of arrays" and other store sequences
that are not sequential.  This is still only enabled if you pass 
-form-memset-from-stores.  The flag is not heavily tested and I haven't
analyzed the perf regressions when -form-memset-from-stores is passed
either, but this causes no make check regressions.

llvm-svn: 48909
2008-03-28 06:45:13 +00:00
Devang Patel
85770c83ba PHI->removeIncomingValue may remove PHInode.
Increment iterator in advance.

llvm-svn: 48890
2008-03-27 17:32:46 +00:00
Evan Cheng
563b265f37 Handle a special case xor undef, undef -> 0. Technically this should be transformed to undef. But this is such a common idiom (misuse) we are going to handle it.
llvm-svn: 48791
2008-03-25 20:07:13 +00:00
Devang Patel
425514c509 Add incoming value from header only if phi node has any use inside the loop.
llvm-svn: 48738
2008-03-24 20:16:14 +00:00
Evan Cheng
d01a2a18f8 Increasing the inline limit from (overly conservative) 200 to 300. Given each BB costs 20 and each instruction costs 5, 200 means a 4 BB function + 24 instructions (actually less because caller's size also contributes to it).
Furthermore, double the limit when more than 10% of the callee instructions are vector instructions. Multimedia kernels tend to love inlining.

llvm-svn: 48725
2008-03-24 06:37:48 +00:00
Evan Cheng
95cc5fca5c Temporarily disabling memset forming optimization. Add an option.
llvm-svn: 48720
2008-03-24 05:28:38 +00:00
Evan Cheng
1d63708523 Transform (zext (or (icmp), (icmp))) to (or (zext (cimp), (zext icmp))) if at least one of the (zext icmp) can be transformed to eliminate an icmp.
llvm-svn: 48715
2008-03-24 00:21:34 +00:00
Anton Korobeynikov
48f56482e8 Preserve calling convention during function cloning
llvm-svn: 48708
2008-03-23 16:03:00 +00:00
Chris Lattner
16f62d36e8 implement an initial hack at a straight-line store -> memset optimization.
This fires dozens of times across spec and multisource, but I don't know
if it actually speeds stuff up.  Hopefully the testers will show something
nice :)

llvm-svn: 48680
2008-03-22 05:37:16 +00:00
Chris Lattner
9a567d824d implement the logic for memset insertion and store deletion.
llvm-svn: 48679
2008-03-22 04:13:49 +00:00
Chris Lattner
9d8b1ee347 This is a partially implemented and currently disabled start of a store
merging optimization.  Nothing to see here, hopefully more later :)

llvm-svn: 48670
2008-03-22 00:31:52 +00:00
Dan Gohman
a363ba510c Don't include <map> in Pass.h, which doesn't need it. This requires
adding <map> to many files that actually do need it.

llvm-svn: 48667
2008-03-21 23:51:57 +00:00
Chris Lattner
18f7655a45 the size of a smallvector shouldn't be part of the interface to these methods.
llvm-svn: 48662
2008-03-21 22:01:16 +00:00
Chris Lattner
15d06c679b make gvn marginally faster by reallocating the lastSeenLoad map for
each basic block.

llvm-svn: 48660
2008-03-21 21:33:23 +00:00
Chris Lattner
b8102d9de3 Minor cleanups and shrinkification.
llvm-svn: 48658
2008-03-21 21:14:38 +00:00
Dan Gohman
59aeac6320 Handle getresult instructions in different basic blocks
from their aggregate operands by moving the getresult
instructions.

llvm-svn: 48657
2008-03-21 21:01:32 +00:00
Andrew Lenharth
2ff2bcbde8 FunctionExtractorPass has been superceded by GVExtractorPass
llvm-svn: 48648
2008-03-21 16:46:53 +00:00
Duncan Sands
530554ab0a Fix the build for gcc-4.2.
llvm-svn: 48639
2008-03-21 08:32:17 +00:00
Chris Lattner
96cdf21ed4 Teach masked value is zero about add and sub, and use MVIZ to
simplify things like (X & 4) >> 1 == 2  --> (X & 4) == 4.

since it is obvious that the shift doesn't remove any bits.

llvm-svn: 48631
2008-03-21 05:19:58 +00:00
Devang Patel
192124d0e6 Incorporate feedback.
- Fix loop nest.
- Use RetVals.size()
- Check for null return value.

llvm-svn: 48605
2008-03-20 18:30:32 +00:00
Gordon Henriksen
dca0a5c5dc C and Objective Caml bindings for mem2reg and reg2mem.
Patch by Erick Tryzelaar.

llvm-svn: 48602
2008-03-20 17:16:03 +00:00
Zhou Sheng
fc7856f528 Take the old function's name.
llvm-svn: 48588
2008-03-20 08:05:05 +00:00
Evan Cheng
c5f34f6463 80 col violation.
llvm-svn: 48573
2008-03-20 00:20:23 +00:00
Devang Patel
c9c6d88ee5 Add comment.
llvm-svn: 48567
2008-03-19 23:05:52 +00:00
Evan Cheng
5ef962445a Remove dead options.
llvm-svn: 48556
2008-03-19 22:02:26 +00:00
Devang Patel
7efcb7de6b Update heuritics that estimates cost of call instructions.
llvm-svn: 48474
2008-03-17 23:41:20 +00:00
Gordon Henriksen
8c33afc50c C and Objective Caml bindings for several scalar transforms.
Patch originally by Erick Tryzelaar, but has been modified somewhat.

llvm-svn: 48419
2008-03-16 16:32:40 +00:00
Bill Wendling
7d054f8b3f The inst combining of inttoptr into GEP with one index was using the bit size of
the type instead of the byte size. This was causing troublesome mis-compilations.

True to form, this took 2 days to find and is a one-line fix. :-P

llvm-svn: 48354
2008-03-14 05:12:19 +00:00
Owen Anderson
6c2454d9d1 Fix a bug in GVN that Duncan noticed, where we potentially need to insert a
pointer bitcast when performing return slot optimization.

llvm-svn: 48343
2008-03-13 22:07:10 +00:00
Nick Lewycky
b827640141 Update -mem2reg to use succ_iterator instead of iterating across TerminatorInst
successors. This makes it support nounwind.

llvm-svn: 48320
2008-03-13 02:42:41 +00:00
Chris Lattner
7925cc72c0 Reimplement the parameter attributes support, phase #1. hilights:
1. There is now a "PAListPtr" class, which is a smart pointer around
   the underlying uniqued parameter attribute list object, and manages
   its refcount.  It is now impossible to mess up the refcount.
2. PAListPtr is now the main interface to the underlying object, and
   the underlying object is now completely opaque.
3. Implementation details like SmallVector and FoldingSet are now no
   longer part of the interface.
4. You can create a PAListPtr with an arbitrary sequence of
   ParamAttrsWithIndex's, no need to make a SmallVector of a specific 
   size (you can just use an array or scalar or vector if you wish).
5. All the client code that had to check for a null pointer before
   dereferencing the pointer is simplified to just access the 
   PAListPtr directly.
6. The interfaces for adding attrs to a list and removing them is a
   bit simpler.

Phase #2 will rename some stuff (e.g. PAListPtr) and do other less 
invasive changes.

llvm-svn: 48289
2008-03-12 17:45:29 +00:00
Owen Anderson
5887233a3f Improve the return slot optimization to be both more aggressive (not limited to sret parameters), and
safer (when the passed pointer might be invalid).  Thanks to Duncan and Chris for the idea behind this, 
and extra thanks to Duncan for helping me work out the trap-safety.

llvm-svn: 48280
2008-03-12 07:37:44 +00:00
Devang Patel
0b10747ac8 Check multiple return values.
llvm-svn: 48267
2008-03-12 00:32:32 +00:00
Devang Patel
9e4d8236fc Fix attribute handling.
llvm-svn: 48262
2008-03-12 00:07:03 +00:00
Devang Patel
54b2c77a4e Handle multiple ret values.
llvm-svn: 48254
2008-03-11 22:24:29 +00:00
Devang Patel
0fbeba7276 Initialize.
llvm-svn: 48253
2008-03-11 22:08:21 +00:00
Dan Gohman
34ea45f10d Check to see if a two-entry PHI block can be simplified
before trying to merge the block into its predecessors.
This allows two-entry-phi-return.ll to be simplified
into a single basic block.

llvm-svn: 48252
2008-03-11 21:53:06 +00:00
Devang Patel
0c7fb89803 Skip functions that return multiple values.
llvm-svn: 48233
2008-03-11 18:04:06 +00:00
Devang Patel
cb8f342ea8 Become multiple return value aware.
Right now, the pass does not optimize tail recursions 
involving multiple return values.

llvm-svn: 48228
2008-03-11 17:33:32 +00:00
Devang Patel
e163bda565 Add TODO reminder.
llvm-svn: 48227
2008-03-11 17:32:05 +00:00
Devang Patel
6c189c16b5 Initial multiple return values support.
llvm-svn: 48210
2008-03-11 05:46:42 +00:00
Devang Patel
f749084aa3 Restore optimization that merges blocks when inline function
has single return value.

llvm-svn: 48162
2008-03-10 18:34:00 +00:00
Devang Patel
0df6cb288f Simplify
llvm-svn: 48161
2008-03-10 18:22:16 +00:00
Devang Patel
f81f0781cb simplify
llvm-svn: 48160
2008-03-10 18:11:41 +00:00
Nick Lewycky
5dd879d5b5 Turn unwind_to into "unwinds to".
llvm-svn: 48123
2008-03-10 02:20:00 +00:00
Ted Kremenek
b05e945be4 Fix some compilation errors on msvc:
- "Redefinition of I" (iterator masks previous definition)
- include missing header file

Patch by Argiris Kirtzidis!

llvm-svn: 48115
2008-03-09 18:32:50 +00:00
Nick Lewycky
efac6a28b4 And again.
llvm-svn: 48112
2008-03-09 17:13:05 +00:00
Nick Lewycky
dd4885aa80 Braces belong here. No functionality change.
llvm-svn: 48111
2008-03-09 17:11:18 +00:00
Nick Lewycky
8626cfb86d SCCP also needs to be taught to follow unwind_to
llvm-svn: 48109
2008-03-09 09:44:38 +00:00
Nick Lewycky
1d6b50743f Don't eliminate blocks that are only reachable by unwind_to.
llvm-svn: 48106
2008-03-09 08:50:23 +00:00
Nick Lewycky
4732d3c9b7 Firstly, having a BranchInst isn't exclusive with having an unwind_to.
Secondly, we have to check whether the branch is actually pointing to the block
with the unwind in it. We could have gotten here because of the unwind_to alone.

llvm-svn: 48099
2008-03-09 07:50:37 +00:00
Nick Lewycky
e93a1819dc A BB that unwind_to an "unwind" inst is that same as one that doesn't unwind_to
at all.

llvm-svn: 48096
2008-03-09 07:36:38 +00:00
Nick Lewycky
50c8d20ca2 Update the block cloner which fixes bugpoint on code using unwind_to (phew!)
and also update the cloning interface's major user, the loop optimizations.

llvm-svn: 48088
2008-03-09 05:24:34 +00:00
Nick Lewycky
d98272094e Update the inliner and simplifycfg to handle unwind_to.
llvm-svn: 48086
2008-03-09 05:10:13 +00:00
Nick Lewycky
c64eb33c52 Two things. Preserve the unwind_to when splitting a BB.
Add the ability to remove just one instance of a BB from a phi node. This fixes
the compile error in the tree now.

llvm-svn: 48085
2008-03-09 05:04:48 +00:00
Nick Lewycky
980738baf2 Prune the unwind_to labels on BBs that don't need them. Another step in the
removal of invoke, PR1269.

llvm-svn: 48084
2008-03-09 04:55:16 +00:00
Nick Lewycky
e13db2c263 Not all users of a BB are Instructions any more.
llvm-svn: 48047
2008-03-08 07:48:41 +00:00
Devang Patel
9543238662 Update inliner to handle functions that return multiple values.
llvm-svn: 48020
2008-03-07 20:06:16 +00:00
Andrew Lenharth
6c788376e9 add a pass that can extract all kinds of global values, not just functions. Update llvm-extract to use it and optionally extract a global variable if you want it too
llvm-svn: 48015
2008-03-07 19:51:57 +00:00
Gabor Greif
d746841e93 fix typos
llvm-svn: 47994
2008-03-06 10:36:00 +00:00
Nick Lewycky
f249c5d5ad Don't try to simplify urem and srem using arithmetic rules that don't work
under modulo (overflow). Fixes PR1933.

llvm-svn: 47987
2008-03-06 06:48:30 +00:00
Devang Patel
63e7d0fe7d Skip, for now, callsites where use of sret argument is not dominated by callsite.
llvm-svn: 47980
2008-03-05 23:39:23 +00:00
Devang Patel
e2c01a6c92 Handle 'ret' with multiple values.
llvm-svn: 47965
2008-03-05 21:50:24 +00:00
Devang Patel
4ca594a2d7 Skip functions that return multiple values.
llvm-svn: 47924
2008-03-05 00:36:59 +00:00
Devang Patel
844c248410 Use while loop.
llvm-svn: 47909
2008-03-04 21:59:49 +00:00
Devang Patel
84e9abbb60 Use cast instead of dyn_cast.
Update test to use multiple return value directly, instead of relying on -sretpromotion.

llvm-svn: 47907
2008-03-04 21:45:28 +00:00
Devang Patel
219be17d65 Filter nested structs
llvm-svn: 47906
2008-03-04 21:32:09 +00:00
Devang Patel
a14b91d6a3 Handle multiple return values.
llvm-svn: 47904
2008-03-04 21:15:15 +00:00
Devang Patel
1e76b493c7 Use appropriate index to get the result value.
llvm-svn: 47897
2008-03-04 19:22:54 +00:00
Devang Patel
9eb2e291fb Skip sret attribute while preparing attribute list for
new function and new call sites.

llvm-svn: 47896
2008-03-04 19:12:58 +00:00
Devang Patel
a880f004e8 Increment counter that keeps track of total number of sret promoted.
llvm-svn: 47892
2008-03-04 17:48:11 +00:00
Devang Patel
aef77854f9 Skip declarations.
llvm-svn: 47890
2008-03-04 17:47:06 +00:00
Devang Patel
e33efc5c23 Process externally visible functions also. Later on code generator will do the right thing.
llvm-svn: 47889
2008-03-04 17:46:26 +00:00
Devang Patel
10d720e1ba Collect statistics.
llvm-svn: 47888
2008-03-04 17:44:37 +00:00
Devang Patel
d0d7028a2b s/isReturnStruct()/hasStructRetAttr()/g
llvm-svn: 47857
2008-03-03 21:46:28 +00:00
Devang Patel
f7259bfa0b Preserve paramater attributes.
llvm-svn: 47847
2008-03-03 18:36:03 +00:00
Chris Lattner
1e21cae4cd allow specified inline threshold to be negative, as the value is
itself sometimes negative.

llvm-svn: 47786
2008-03-01 08:09:51 +00:00
Devang Patel
79236a7c7a Fix cut-n-pasto.
llvm-svn: 47777
2008-02-29 23:41:13 +00:00
Devang Patel
cb72d92471 Add pass to promote sret.
This pass transforms 

  %struct._Point = type { i32, i32, i32, i32, i32, i32 }
  define internal void @foo(%struct._Point* sret  %agg.result)

into

  %struct._Point = type { i32, i32, i32, i32, i32, i32 }
  define internal %struct._Point @foo()

This pass updates foo() clients appropriately to use
getresult instruction to extract return values.

This pass is not yet ready for prime time.

llvm-svn: 47776
2008-02-29 23:34:08 +00:00
Chris Lattner
75f5d14574 fix a bug Anders ran into where scalarrepl would crash when promoting
a union containing a vector and an array whose elements were smaller than
the vector elements.  this means we need to compile the load of the 
array elements into an extract element plus a truncate.

llvm-svn: 47752
2008-02-29 07:12:06 +00:00
Chris Lattner
8f87e409b2 Refactor some code out of ConvertUsesToScalar into their own methods, no
functionality change.

llvm-svn: 47751
2008-02-29 07:03:13 +00:00
Chris Lattner
5aeccb7353 Folding or(fcmp,fcmp) only works if the operands of the fcmps are the same fp type.
llvm-svn: 47750
2008-02-29 06:09:11 +00:00
Owen Anderson
eadd074b22 Fix an issue where GVN had the sizes of the two memcpy's reverse, resulting
in an invalid transformation.

llvm-svn: 47639
2008-02-26 23:06:17 +00:00
Gabor Greif
2cb16cddf1 fix http://llvm.org/bugs/show_bug.cgi?id=2097
llvm-svn: 47615
2008-02-26 19:13:21 +00:00
Eli Friedman
1f2cabfbcf Fix for pr2093: direct operands aren't necessarily addresses, so don't
try to simplify them.

llvm-svn: 47610
2008-02-26 18:37:49 +00:00
Bill Wendling
bd1f1ae160 De-tabify.
llvm-svn: 47599
2008-02-26 10:53:30 +00:00
Evan Cheng
6366bbf577 Fix PR2076. CodeGenPrepare now sinks address computation for inline asm memory
operands into inline asm block.

llvm-svn: 47589
2008-02-26 02:42:37 +00:00
Owen Anderson
6eafd532ab Fix an issue where GVN was performing the return slot optimization when it was
not safe.  This is fixed by more aggressively checking that the return slot is
not used elsewhere in the function.

llvm-svn: 47544
2008-02-25 04:08:09 +00:00
Owen Anderson
432abc0479 Fix an issue where GVN would try to use an instruction before its definition when performing return slot optimization.
llvm-svn: 47541
2008-02-25 00:40:41 +00:00
Dale Johannesen
ae08bdb4cf Split ParameterAttributes.h, putting the complicated
stuff into ParamAttrsList.h.  Per feedback from
ParamAttrs changes.

llvm-svn: 47504
2008-02-22 22:17:59 +00:00
Zhou Sheng
0742fbfedf Fixed a typo.
llvm-svn: 47478
2008-02-22 10:00:35 +00:00
Dan Gohman
48d03d5a2d Add explicit keywords.
llvm-svn: 47382
2008-02-20 16:44:09 +00:00
Anton Korobeynikov
c41f5b6af4 Fix newly-introduced 4.3 warnings
llvm-svn: 47375
2008-02-20 12:07:57 +00:00
Anton Korobeynikov
2523c8be38 Get rid of hash_map. Use StringMap instead
llvm-svn: 47373
2008-02-20 11:27:49 +00:00
Anton Korobeynikov
fd6b669c80 Make Transforms to be 4.3 warnings-clean
llvm-svn: 47371
2008-02-20 11:26:25 +00:00