Commit Graph

3945 Commits

Author SHA1 Message Date
Tanya Lattner
48afd9f8a9 Reverting 49056 due to the build being broken.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49060 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 23:41:44 +00:00
David Greene
da2903f028 Iterators folloring a SmallVector erased element are invalidated so
don't access cached iterators from after the erased element.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 22:14:23 +00:00
Dale Johannesen
b6d5b14390 Revert 49006 for the moment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49046 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 20:00:57 +00:00
Dale Johannesen
1544e4713b 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49006 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 23:40:23 +00:00
Nate Begeman
83ad90a779 Don't eliminate bitcast instructions that change the type of a pointer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48971 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 00:22:16 +00:00
Chris Lattner
d27c991ceb Fix "Control reaches the end of non-void function" warnings,
patch by David Chisnall.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48963 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-30 18:22:13 +00:00
Chris Lattner
97ae12a988 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 )



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48940 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-29 05:15:47 +00:00
Chris Lattner
d22fe2b51f 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48939 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-29 04:52:12 +00:00
Chris Lattner
9f8a6a7498 give form-memset a significantly more sane heuristic, enable it by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48937 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-29 04:36:18 +00:00
Chris Lattner
7f0965e7da 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-28 06:45:13 +00:00
Devang Patel
4a3c0ac798 PHI->removeIncomingValue may remove PHInode.
Increment iterator in advance.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48890 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 17:32:46 +00:00
Evan Cheng
d34af7875b 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48791 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 20:07:13 +00:00
Devang Patel
60a12907c3 Add incoming value from header only if phi node has any use inside the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48738 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 20:16:14 +00:00
Evan Cheng
8d84d5b62c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48725 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 06:37:48 +00:00
Evan Cheng
88ffdddcc4 Temporarily disabling memset forming optimization. Add an option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48720 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 05:28:38 +00:00
Evan Cheng
b98a10e8a3 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48715 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 00:21:34 +00:00
Anton Korobeynikov
9e49f1bc58 Preserve calling convention during function cloning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48708 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-23 16:03:00 +00:00
Chris Lattner
b017c9e89c 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 :)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48680 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 05:37:16 +00:00
Chris Lattner
d27290d733 implement the logic for memset insertion and store deletion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48679 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 04:13:49 +00:00
Chris Lattner
641dae19eb This is a partially implemented and currently disabled start of a store
merging optimization.  Nothing to see here, hopefully more later :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48670 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 00:31:52 +00:00
Dan Gohman
c9235d2e85 Don't include <map> in Pass.h, which doesn't need it. This requires
adding <map> to many files that actually do need it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48667 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 23:51:57 +00:00
Chris Lattner
8e1e95cb04 the size of a smallvector shouldn't be part of the interface to these methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48662 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 22:01:16 +00:00
Chris Lattner
2e60701b9d make gvn marginally faster by reallocating the lastSeenLoad map for
each basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48660 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 21:33:23 +00:00
Chris Lattner
88365bb404 Minor cleanups and shrinkification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48658 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 21:14:38 +00:00
Dan Gohman
f1d3d666c1 Handle getresult instructions in different basic blocks
from their aggregate operands by moving the getresult
instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48657 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 21:01:32 +00:00
Andrew Lenharth
7623716e61 FunctionExtractorPass has been superceded by GVExtractorPass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48648 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 16:46:53 +00:00
Duncan Sands
1d57a752a2 Fix the build for gcc-4.2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48639 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 08:32:17 +00:00
Chris Lattner
41dc0fcb68 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48631 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 05:19:58 +00:00
Devang Patel
488b678a49 Incorporate feedback.
- Fix loop nest.
- Use RetVals.size()
- Check for null return value.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-20 18:30:32 +00:00
Gordon Henriksen
69cf031ee3 C and Objective Caml bindings for mem2reg and reg2mem.
Patch by Erick Tryzelaar.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48602 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-20 17:16:03 +00:00
Zhou Sheng
2b3407f5b3 Take the old function's name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48588 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-20 08:05:05 +00:00
Evan Cheng
71d83741d2 80 col violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48573 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-20 00:20:23 +00:00
Devang Patel
ac3844d3f9 Add comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48567 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 23:05:52 +00:00
Evan Cheng
55e641b766 Remove dead options.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48556 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 22:02:26 +00:00
Devang Patel
b176038f98 Update heuritics that estimates cost of call instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48474 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-17 23:41:20 +00:00
Gordon Henriksen
41ba1546eb C and Objective Caml bindings for several scalar transforms.
Patch originally by Erick Tryzelaar, but has been modified somewhat.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 16:32:40 +00:00
Bill Wendling
b9d4f8df70 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48354 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-14 05:12:19 +00:00
Owen Anderson
8a97fddbc2 Fix a bug in GVN that Duncan noticed, where we potentially need to insert a
pointer bitcast when performing return slot optimization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48343 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 22:07:10 +00:00
Nick Lewycky
6e7aeb16fa Update -mem2reg to use succ_iterator instead of iterating across TerminatorInst
successors. This makes it support nounwind.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48320 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 02:42:41 +00:00
Chris Lattner
58d74910c6 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48289 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 17:45:29 +00:00
Owen Anderson
6bb0bd52ec 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48280 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 07:37:44 +00:00
Devang Patel
045497ae27 Check multiple return values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48267 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 00:32:32 +00:00
Devang Patel
8f9b551147 Fix attribute handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48262 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 00:07:03 +00:00
Devang Patel
7db30ba701 Handle multiple ret values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48254 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 22:24:29 +00:00
Devang Patel
a0238778db Initialize.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48253 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 22:08:21 +00:00
Dan Gohman
882d87d168 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48252 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 21:53:06 +00:00
Devang Patel
75e6f02445 Skip functions that return multiple values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48233 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 18:04:06 +00:00
Devang Patel
826c49132a Become multiple return value aware.
Right now, the pass does not optimize tail recursions 
involving multiple return values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48228 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 17:33:32 +00:00
Devang Patel
9af014f80c Add TODO reminder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48227 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 17:32:05 +00:00
Devang Patel
7c490d4104 Initial multiple return values support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48210 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 05:46:42 +00:00