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