Chris Lattner
e369c35a84
refactor some code, no functionality change.
...
llvm-svn: 50094
2008-04-22 06:36:15 +00:00
Chris Lattner
8fb13cbe4e
remove dead code.
...
llvm-svn: 50080
2008-04-22 03:21:48 +00:00
Chris Lattner
c3a439351c
optimize "p != gep p, ..." better. This allows us to compile
...
getelementptr-seteq.ll into:
define i1 @test(i64 %X, %S* %P) {
%C = icmp eq i64 %X, -1 ; <i1> [#uses=1]
ret i1 %C
}
instead of:
define i1 @test(i64 %X, %S* %P) {
%A.idx.mask = and i64 %X, 4611686018427387903 ; <i64> [#uses=1]
%C = icmp eq i64 %A.idx.mask, 4611686018427387903 ; <i1> [#uses=1]
ret i1 %C
}
And fixes the second half of PR2235. This speeds up the insertion sort
case by 45%, from 1.12s to 0.77s. In practice, this will significantly
speed up for loops structured like:
for (double *P = Base + N; P != Base; --P)
...
Which happens frequently for C++ iterators.
llvm-svn: 50079
2008-04-22 02:53:33 +00:00
Chris Lattner
bab7bec9c8
fix grammar-o, thanks to Duncan for noticing.
...
llvm-svn: 50047
2008-04-21 18:25:01 +00:00
Owen Anderson
a5b96ecef9
Remove unneeded #include's.
...
llvm-svn: 50035
2008-04-21 07:47:38 +00:00
Owen Anderson
6a7355caa2
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
ad0d42ba15
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
f6236cc2e9
Use the new SplitBlockPredecessors to implement a todo.
...
llvm-svn: 50022
2008-04-21 02:57:57 +00:00
Chris Lattner
a5b11705b6
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
d418b06abf
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
96e9e22269
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
559c867ece
fit some more code in 80 cols.
...
llvm-svn: 50016
2008-04-21 00:25:49 +00:00
Chris Lattner
aca912d793
simplify code, fit in 80 cols.
...
llvm-svn: 50015
2008-04-21 00:23:14 +00:00
Chris Lattner
38806c3e9c
fit in 80 cols
...
llvm-svn: 50014
2008-04-21 00:19:16 +00:00
Chris Lattner
ff1c6e388c
finish the first cut of a jump threading pass implementation.
...
llvm-svn: 50006
2008-04-20 22:39:42 +00:00
Chris Lattner
567166c0a8
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
9c1f1a82bf
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
2115722ffa
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
b3b6007c8b
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
ab20784740
g++-4.3 build-fix: CHAR_BIT requires <climits>.
...
llvm-svn: 49989
2008-04-20 08:33:11 +00:00
Chris Lattner
3b18762f40
Switch to using Simplified ConstantFP::get API.
...
llvm-svn: 49977
2008-04-20 00:41:09 +00:00
Chris Lattner
eb6bb803a7
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
f9ae76d89c
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
376acf4aaa
Remove unused variable
...
llvm-svn: 49838
2008-04-17 01:30:44 +00:00
Scott Michel
f66cb3696a
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
c6a47e8a79
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
4fff979a43
Remove unnecessary <sstream> includes.
...
llvm-svn: 49681
2008-04-14 20:40:47 +00:00
Dan Gohman
e36714c0b4
Minor whitespace and comment cleanups.
...
llvm-svn: 49671
2008-04-14 18:26:16 +00:00
Owen Anderson
7629b71dd4
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
1f6fbc4bc3
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
1e73f29a7f
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
99b7b3f03b
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
a29d2536aa
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
802134fc02
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
cca74e5ab9
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
a7dfbc0366
Be conservative if getresult operand is neither call nor invoke.
...
llvm-svn: 49430
2008-04-09 15:58:24 +00:00
Owen Anderson
ef9a6fd5c2
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
8ee792d1b6
Remove accidentally duplicated code.
...
llvm-svn: 49418
2008-04-09 07:55:01 +00:00
Chris Lattner
b859fb49ed
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
8cd2a3ae2a
Fix insert point handling for multiple return values.
...
llvm-svn: 49367
2008-04-08 02:24:08 +00:00
Owen Anderson
ed92b41a39
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
813384951e
Use Intrinsic::getDeclaration in more places.
...
llvm-svn: 49338
2008-04-07 13:45:04 +00:00
Duncan Sands
1416ebf1fe
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
fbc6adcc59
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
0c1e634cbb
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
87e484f08b
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
a39cfc5c5b
silence a warning when assertions are disabled.
...
llvm-svn: 49283
2008-04-06 21:44:08 +00:00
Gabor Greif
e9ecc68d8f
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
586740f401
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
ac38d444e2
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
052838c55d
Reverting 49056 due to the build being broken.
...
llvm-svn: 49060
2008-04-01 23:41:44 +00:00
David Greene
7f7edc3824
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
5e4e051c2a
Revert 49006 for the moment.
...
llvm-svn: 49046
2008-04-01 20:00:57 +00:00
Dale Johannesen
7d02cf3c9c
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
f2b0b0eb17
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
0f760dfe09
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
4311ad2dae
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
ac95515741
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
d528b21a65
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
d62964a7d8
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
eb1e3fcbe0
PHI->removeIncomingValue may remove PHInode.
...
Increment iterator in advance.
llvm-svn: 48890
2008-03-27 17:32:46 +00:00
Evan Cheng
2b72c05992
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
a38f58aa5c
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
3471ae8c5d
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
21a8e3d260
Temporarily disabling memset forming optimization. Add an option.
...
llvm-svn: 48720
2008-03-24 05:28:38 +00:00
Evan Cheng
c3cf9f872a
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
d38b3fb127
Preserve calling convention during function cloning
...
llvm-svn: 48708
2008-03-23 16:03:00 +00:00
Chris Lattner
53ccb62712
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
168be766a8
implement the logic for memset insertion and store deletion.
...
llvm-svn: 48679
2008-03-22 04:13:49 +00:00
Chris Lattner
f5d41c67af
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
9988569af8
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
804209d17c
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
beb216da0a
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
2876a645c3
Minor cleanups and shrinkification.
...
llvm-svn: 48658
2008-03-21 21:14:38 +00:00
Dan Gohman
a25dde6fee
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
74d154ce57
FunctionExtractorPass has been superceded by GVExtractorPass
...
llvm-svn: 48648
2008-03-21 16:46:53 +00:00
Duncan Sands
c9e09a0588
Fix the build for gcc-4.2.
...
llvm-svn: 48639
2008-03-21 08:32:17 +00:00
Chris Lattner
c44160ce6e
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
5ca2ea6479
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
b81777a354
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
a30cdb9417
Take the old function's name.
...
llvm-svn: 48588
2008-03-20 08:05:05 +00:00
Evan Cheng
5daf090a1a
80 col violation.
...
llvm-svn: 48573
2008-03-20 00:20:23 +00:00
Devang Patel
b727960f78
Add comment.
...
llvm-svn: 48567
2008-03-19 23:05:52 +00:00
Evan Cheng
a90fdc4340
Remove dead options.
...
llvm-svn: 48556
2008-03-19 22:02:26 +00:00
Devang Patel
924ca7f01d
Update heuritics that estimates cost of call instructions.
...
llvm-svn: 48474
2008-03-17 23:41:20 +00:00
Gordon Henriksen
82a0e74f43
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
68a930b33e
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
7a69e3aef3
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
7698bfbe16
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
8a923e7c28
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
6ff0b822b4
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
cc189b5606
Check multiple return values.
...
llvm-svn: 48267
2008-03-12 00:32:32 +00:00
Devang Patel
fa8667a2dd
Fix attribute handling.
...
llvm-svn: 48262
2008-03-12 00:07:03 +00:00
Devang Patel
7358165c99
Handle multiple ret values.
...
llvm-svn: 48254
2008-03-11 22:24:29 +00:00
Devang Patel
f6269f0914
Initialize.
...
llvm-svn: 48253
2008-03-11 22:08:21 +00:00
Dan Gohman
20af5a0fe7
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
70c238a1d8
Skip functions that return multiple values.
...
llvm-svn: 48233
2008-03-11 18:04:06 +00:00
Devang Patel
5663fe6613
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
e418de3023
Add TODO reminder.
...
llvm-svn: 48227
2008-03-11 17:32:05 +00:00
Devang Patel
a7a2075ab8
Initial multiple return values support.
...
llvm-svn: 48210
2008-03-11 05:46:42 +00:00
Devang Patel
64d0f07085
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
72ea2dc9a9
Simplify
...
llvm-svn: 48161
2008-03-10 18:22:16 +00:00
Devang Patel
c0325b2040
simplify
...
llvm-svn: 48160
2008-03-10 18:11:41 +00:00
Nick Lewycky
fb2c1a999a
Turn unwind_to into "unwinds to".
...
llvm-svn: 48123
2008-03-10 02:20:00 +00:00
Ted Kremenek
d48ed17d18
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
0ac65c3b99
And again.
...
llvm-svn: 48112
2008-03-09 17:13:05 +00:00
Nick Lewycky
929703b29e
Braces belong here. No functionality change.
...
llvm-svn: 48111
2008-03-09 17:11:18 +00:00
Nick Lewycky
83750d9caf
SCCP also needs to be taught to follow unwind_to
...
llvm-svn: 48109
2008-03-09 09:44:38 +00:00
Nick Lewycky
271506f29c
Don't eliminate blocks that are only reachable by unwind_to.
...
llvm-svn: 48106
2008-03-09 08:50:23 +00:00
Nick Lewycky
42445be0df
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
f3d637fa14
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
11fc6f8765
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
5ce9b521d7
Update the inliner and simplifycfg to handle unwind_to.
...
llvm-svn: 48086
2008-03-09 05:10:13 +00:00
Nick Lewycky
cc24104703
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
4d0ed842b1
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
35e92c7bea
Not all users of a BB are Instructions any more.
...
llvm-svn: 48047
2008-03-08 07:48:41 +00:00
Devang Patel
780b3ca64b
Update inliner to handle functions that return multiple values.
...
llvm-svn: 48020
2008-03-07 20:06:16 +00:00
Andrew Lenharth
3f13b6630a
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
ad19df0687
fix typos
...
llvm-svn: 47994
2008-03-06 10:36:00 +00:00
Nick Lewycky
d0b62a1552
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
26cabc447c
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
3b1c95f885
Handle 'ret' with multiple values.
...
llvm-svn: 47965
2008-03-05 21:50:24 +00:00
Devang Patel
e516aa1127
Skip functions that return multiple values.
...
llvm-svn: 47924
2008-03-05 00:36:59 +00:00
Devang Patel
4566d885dd
Use while loop.
...
llvm-svn: 47909
2008-03-04 21:59:49 +00:00
Devang Patel
941ab37ea8
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
ea4cb89d34
Filter nested structs
...
llvm-svn: 47906
2008-03-04 21:32:09 +00:00
Devang Patel
841322b32a
Handle multiple return values.
...
llvm-svn: 47904
2008-03-04 21:15:15 +00:00
Devang Patel
297ea0de75
Use appropriate index to get the result value.
...
llvm-svn: 47897
2008-03-04 19:22:54 +00:00
Devang Patel
748c77f530
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
ed6e4b0b7d
Increment counter that keeps track of total number of sret promoted.
...
llvm-svn: 47892
2008-03-04 17:48:11 +00:00
Devang Patel
6bb36e686d
Skip declarations.
...
llvm-svn: 47890
2008-03-04 17:47:06 +00:00
Devang Patel
5b69f3fa33
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
ecce5af83d
Collect statistics.
...
llvm-svn: 47888
2008-03-04 17:44:37 +00:00
Devang Patel
9d91785987
s/isReturnStruct()/hasStructRetAttr()/g
...
llvm-svn: 47857
2008-03-03 21:46:28 +00:00
Devang Patel
b0faf89133
Preserve paramater attributes.
...
llvm-svn: 47847
2008-03-03 18:36:03 +00:00
Chris Lattner
a683edb2d8
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
e8ddaba169
Fix cut-n-pasto.
...
llvm-svn: 47777
2008-02-29 23:41:13 +00:00
Devang Patel
4eedfd2421
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
c966cebe93
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
77205def10
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
c612571555
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
d29ed0b122
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
aa2617206f
fix http://llvm.org/bugs/show_bug.cgi?id=2097
...
llvm-svn: 47615
2008-02-26 19:13:21 +00:00
Eli Friedman
666bbe34f4
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
d188e03715
De-tabify.
...
llvm-svn: 47599
2008-02-26 10:53:30 +00:00
Evan Cheng
1da250097b
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
df1d2b02f9
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
40dca46ddb
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
09f410b6d7
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
3b8eb704fc
Fixed a typo.
...
llvm-svn: 47478
2008-02-22 10:00:35 +00:00
Dan Gohman
360c86aed5
Add explicit keywords.
...
llvm-svn: 47382
2008-02-20 16:44:09 +00:00
Anton Korobeynikov
18991d78fa
Fix newly-introduced 4.3 warnings
...
llvm-svn: 47375
2008-02-20 12:07:57 +00:00
Anton Korobeynikov
6f74afea32
Get rid of hash_map. Use StringMap instead
...
llvm-svn: 47373
2008-02-20 11:27:49 +00:00
Anton Korobeynikov
1bfd121321
Make Transforms to be 4.3 warnings-clean
...
llvm-svn: 47371
2008-02-20 11:26:25 +00:00
Anton Korobeynikov
579f07135a
Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
...
llvm-svn: 47367
2008-02-20 11:08:44 +00:00
Owen Anderson
b4724dbda2
When performing return slot optimization, remember to inform memdep when we're removing the memcpy.
...
llvm-svn: 47364
2008-02-20 08:23:02 +00:00
Dale Johannesen
89268bc6e2
Expand ParameterAttributes to 32 bits (in preparation
...
for adding alignment info, not there yet). Clean up
interfaces to reference ParameterAttributes consistently.
llvm-svn: 47342
2008-02-19 21:38:47 +00:00
Chris Lattner
c3591a0d48
remove the LowerSelect pass. The last client was the old Sparc backend, which is long dead by now.
...
llvm-svn: 47323
2008-02-19 07:49:17 +00:00
Chris Lattner
032fb2eda9
remove the lower packed pass. It can never work and even the parts that
...
could work don't work fully. This fixes PR1705. Oh yeah, we don't have
packed types anymore either ;-)
llvm-svn: 47322
2008-02-19 07:39:17 +00:00
Owen Anderson
e92e303582
Refactor this method a bit, and correct a test that was completely wrong but happened to work out anyways. :-)
...
llvm-svn: 47321
2008-02-19 07:07:51 +00:00
Chris Lattner
f7b7ba9c5a
isa+cast -> dyncast.
...
llvm-svn: 47320
2008-02-19 06:53:20 +00:00
Chris Lattner
c130e3afc4
simplify this code again, try 2 :)
...
llvm-svn: 47319
2008-02-19 06:52:38 +00:00
Owen Anderson
e71d6e37b2
Fix a comment.
...
llvm-svn: 47318
2008-02-19 06:51:23 +00:00
Owen Anderson
806cbde53b
Major improvements to yesterday's return slot optimization. Remove some unneccessary constraints,
...
and add some others that should have been in from the first place. Document the whole thing better.
llvm-svn: 47315
2008-02-19 06:35:43 +00:00
Chris Lattner
0fe6bce9ce
fdiv/frem of undef can produce undef, because the undef operand
...
can be a SNaN. We could be more aggressive and turn this into
unreachable, but that is less nice, and not really worth it.
llvm-svn: 47313
2008-02-19 06:12:18 +00:00
Owen Anderson
c0c3cd8e27
Factor the profitability check for return slot optimization out into a static function.
...
At some point in the future, this check will become smarter.
llvm-svn: 47310
2008-02-19 03:27:34 +00:00
Owen Anderson
551b8eeb5c
An sret parameter is required to be the first parameter, so there's no need to loop
...
over all the parameters of the callee looking for it.
llvm-svn: 47309
2008-02-19 03:15:29 +00:00
Owen Anderson
336824f102
Cleanup some of my patches from yesterday. Refactor the check for which xform
...
to apply to a memcpy into processInstruction. Also, fix a bug in the check due to
missing braces.
llvm-svn: 47307
2008-02-19 03:09:45 +00:00
Owen Anderson
ffca8e99b2
Fix Transforms/GVN/memcpy.ll, which Chris broke in r47275 by reordering the branches. memcpy's are a kind of CallInst.
...
llvm-svn: 47305
2008-02-19 02:53:23 +00:00
Nick Lewycky
fefd0202c9
Correctly fold divide-by-constant, even when faced with overflow.
...
llvm-svn: 47287
2008-02-18 22:48:05 +00:00
Chris Lattner
1e3c501cb8
Transforming -A + -B --> -(A + B) isn't safe for FP, thanks
...
to Dale for noticing this!
llvm-svn: 47276
2008-02-18 17:50:16 +00:00
Chris Lattner
0af5601028
minor code simplification, no functionality change.
...
llvm-svn: 47275
2008-02-18 17:47:29 +00:00
Duncan Sands
85fab3a3ad
Simplify caller updating using a CallSite, as
...
requested by Chris. While there, do the same
for an existing function committed by someone
called "lattner" :)
llvm-svn: 47273
2008-02-18 17:32:13 +00:00
Owen Anderson
3549553262
Add support to GVN for performing sret return slot optimization. This means that, if an sret function tail calls
...
another sret function, it should pass its own sret parameter to the tail callee, allowing it to fill in the correct
return value. llvm-gcc does not emit this by default. Instead, it allocates space in the caller for the sret of
the tail call and then uses memcpy to copy the result into the caller's sret parameter. This optimization detects
and optimizes that case.
llvm-svn: 47265
2008-02-18 09:24:53 +00:00
Chris Lattner
6b39cb907b
switch simplifycfg from using vectors for most things to smallvectors,
...
this speeds it up 2.3% on eon.
llvm-svn: 47261
2008-02-18 07:42:56 +00:00
Chris Lattner
024f8c8f09
optimize away stackrestore calls that have no intervening alloca or call.
...
llvm-svn: 47258
2008-02-18 06:12:38 +00:00
Chris Lattner
0e7fd2f1a8
simplify some code, BreakUpSubtract always returns nonnull now.
...
llvm-svn: 47251
2008-02-18 02:18:25 +00:00
Chris Lattner
cc22601bc3
Fold (-x + -y) -> -(x+y) which promotes better association, fixing
...
the second half of PR2047
llvm-svn: 47244
2008-02-17 21:03:36 +00:00
Chris Lattner
5f08ec854f
fix pasto
...
llvm-svn: 47242
2008-02-17 20:54:40 +00:00
Chris Lattner
a70d138457
Split up subtracts into add+negate if they have a reassociable use or operand
...
that is also a subtract. This implements PR2047 and Transforms/Reassociate/subtest2.ll
llvm-svn: 47241
2008-02-17 20:51:26 +00:00
Chris Lattner
902537cd8d
make the logic for breaking up subtracts more explicit, no
...
functionality change.
llvm-svn: 47239
2008-02-17 20:44:51 +00:00
Duncan Sands
573b3f89e4
Remove any 'nest' parameter attributes if the function
...
is not passed as an argument to a trampoline intrinsic.
llvm-svn: 47220
2008-02-16 20:56:04 +00:00
Devang Patel
a42c3147cc
Fix PR2028
...
llvm-svn: 47150
2008-02-15 01:24:49 +00:00
Devang Patel
2e622e4c2b
If loop header is also loop exiting block then OrigPN is incoming value for B loop header.
...
Fixes PR 2030.
llvm-svn: 47141
2008-02-14 23:18:47 +00:00
Chris Lattner
70e294660a
Fix PR2029
...
llvm-svn: 47129
2008-02-14 19:18:13 +00:00
Chris Lattner
89acd61805
simplify code, no functionality change.
...
llvm-svn: 47116
2008-02-14 07:39:01 +00:00
Nick Lewycky
7c77e2bc65
Fix PR2032. Inform the alias analysis of changes to the underlying program.
...
llvm-svn: 47111
2008-02-14 07:11:24 +00:00
Devang Patel
0ecb76d820
A loop latch phi node may have uses inside loop, not just in loop header.
...
llvm-svn: 47093
2008-02-13 22:23:07 +00:00
Dan Gohman
1ee8dc97d9
Rename APInt's isPositive to isNonNegative, to reflect what it
...
actually does.
llvm-svn: 47090
2008-02-13 22:09:18 +00:00
Devang Patel
22c3caab6e
While moving exit condition, do not drop loop latch on the floor.
...
llvm-svn: 47089
2008-02-13 22:06:36 +00:00
Devang Patel
c281d8031b
Keep track of exit value operand number when operands are swapped.
...
llvm-svn: 47082
2008-02-13 19:48:48 +00:00
Chris Lattner
67b9ef7be8
remove some dead code.
...
llvm-svn: 47066
2008-02-13 17:18:26 +00:00
Owen Anderson
00dba4f734
Re-apply the patch to improve the optimizations of memcpy's, with several
...
bugs fixed. This now passes PPC bootstrap.
llvm-svn: 47026
2008-02-12 21:15:18 +00:00
Eli Friedman
716c10c01e
Fix for bug 1996: optimize out loads of undef. This code basically just
...
checks for a malloc/alloca immediately followed by a load.
llvm-svn: 47006
2008-02-12 12:08:14 +00:00
Chris Lattner
dcddd64424
Fix scalarrepl to not 'miscompile' undefined code, part #2 .
...
This fixes the store case, my previous patch just fixed the load
case. rdar://5707076.
llvm-svn: 46932
2008-02-10 19:05:37 +00:00
Devang Patel
26f75e2576
Fix PR 1995.
...
llvm-svn: 46898
2008-02-08 22:49:13 +00:00
Bill Wendling
c676a0329c
Temporarily reverting:
...
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080128/057882.html
This is causing a miscompilation on PPC G5 and just now seeing it on iMac x86-64.
llvm-svn: 46822
2008-02-06 20:03:07 +00:00
Chris Lattner
a838141957
Make RenamePass faster by making the 'is this a new phi node'
...
check more intelligent. This speeds up mem2reg from 5.29s to
0.79s on a synthetic testcase with tons of predecessors and
phi nodes.
llvm-svn: 46767
2008-02-05 21:26:23 +00:00
Chris Lattner
682a7dc653
Fix a bug compiling PR1978 (perhaps not the only one though) which
...
was incorrectly simplifying "x == (gep x, 1, i)" into false, even
though i could be negative. As it turns out, all the code to
handle this already existed, we just need to disable the incorrect
optimization case and let the general case handle it.
llvm-svn: 46739
2008-02-05 04:45:32 +00:00
Owen Anderson
a82c9931f4
Be more precise when eliminating pointers bue to memcpy's. This allows more
...
stores to be deleted in some cases.
llvm-svn: 46694
2008-02-04 04:53:00 +00:00
Owen Anderson
c4a7c41869
Allow GVN to hack on memcpy's, making them open to further optimization.
...
llvm-svn: 46693
2008-02-04 02:59:58 +00:00
Nick Lewycky
3b59214320
There are some cases where icmp(add) can be folded into a new icmp. Handle them.
...
llvm-svn: 46687
2008-02-03 16:33:09 +00:00
Nick Lewycky
c7a4ba044b
Hack on vectors too.
...
llvm-svn: 46684
2008-02-03 08:19:11 +00:00
Nick Lewycky
e6e3a7f6ea
Fold away one multiply in instcombine. This would normally be caught in
...
reassociate anyways, but they could be generated during instcombine's run.
llvm-svn: 46683
2008-02-03 07:42:09 +00:00
Duncan Sands
9aa789fda3
Don't drop function/call return attributes like 'nounwind'.
...
llvm-svn: 46645
2008-02-01 20:37:16 +00:00
Nick Lewycky
6b016703a9
Remove a couple more cases of "getNumUses() == 0". No need to walk the linked
...
list just to see if whether the list is empty.
llvm-svn: 46555
2008-01-30 08:01:28 +00:00
Nick Lewycky
625e89c8b0
Use empty() instead of comparing size() with zero.
...
llvm-svn: 46554
2008-01-30 07:54:16 +00:00
Nick Lewycky
0e3a5cb14a
Don't DCE FreeInst's. We were using those! Patch from Owen Anderson.
...
llvm-svn: 46553
2008-01-30 07:45:37 +00:00
Owen Anderson
4e4b116750
Make DSE much more aggressive by performing DCE earlier. Update a testcase to reflect this increased aggressiveness.
...
llvm-svn: 46542
2008-01-30 01:24:47 +00:00
Chris Lattner
b9e5b8fb9e
Fix a bug where scalarrepl would discard offset if type would match.
...
In practice this can only happen on code with already undefined behavior,
but this is still a good thing to handle correctly.
llvm-svn: 46539
2008-01-30 00:39:15 +00:00
Chris Lattner
ade0abb498
Don't let globalopt hack on volatile loads or stores.
...
llvm-svn: 46523
2008-01-29 19:01:37 +00:00
Dan Gohman
70de4cb1cd
Use empty() instead of comparing size() with zero.
...
llvm-svn: 46514
2008-01-29 13:02:09 +00:00
Chris Lattner
17819d971e
eliminate additions of 0.0 when they are obviously dead. This has to be careful to
...
avoid turning -0.0 + 0.0 -> -0.0 which is incorrect.
llvm-svn: 46499
2008-01-29 06:52:45 +00:00
Owen Anderson
48d37806e2
Add support for eliminating memcpy's at the end of functions. Also fix some errors I noticed in
...
the handling of eliminating stores to byval arguments.
llvm-svn: 46494
2008-01-29 06:18:36 +00:00
Devang Patel
67fa0521b6
Filter loops that subtract induction variables.
...
These loops are not yet handled.
Fix PR 1912.
llvm-svn: 46484
2008-01-29 02:20:41 +00:00
Chris Lattner
a8b4a56061
Transform calls to memcpy into llvm.memcpy calls, patch by Eli Friedman.
...
llvm-svn: 46433
2008-01-28 04:41:43 +00:00
Nick Lewycky
8ea81e8ba4
Handle some more combinations of extend and icmp. Fixes PR1940.
...
llvm-svn: 46431
2008-01-28 03:48:02 +00:00
Chris Lattner
710b441174
Fix PR1932 by disabling an xform invalid for fdiv.
...
llvm-svn: 46429
2008-01-28 00:58:18 +00:00
Chris Lattner
1b706dd680
Fix PR1938 by forcing the code that uses an undefined value to branch one
...
way or the other. Rewriting the code itself prevents subsequent analysis
passes from making contradictory conclusions about the code that could
cause an infeasible path to be made feasible.
llvm-svn: 46427
2008-01-28 00:32:30 +00:00
Nick Lewycky
efb16f7057
Be more careful modifying the use_list while also iterating through it.
...
llvm-svn: 46417
2008-01-27 18:35:00 +00:00
Duncan Sands
053c9871cd
Revert r46393: readonly/readnone functions are no
...
longer allowed to write through byval arguments.
llvm-svn: 46416
2008-01-27 18:12:58 +00:00
Bill Wendling
60361a16f8
The CorrelatedExpressionElimination pass is known to be buggy. Remove it.
...
This fixes PR1769.
llvm-svn: 46408
2008-01-27 06:11:41 +00:00
Chris Lattner
fa1e7eef30
Fold fptrunc(add (fpextend x), (fpextend y)) -> add(x,y), as GCC does.
...
llvm-svn: 46406
2008-01-27 05:29:54 +00:00
Bill Wendling
5079483957
If there are no machine instructions emitted for a function, then insert
...
a "nop" instruction so that we don't have the function's label associated
with something that it's not supposed to be associated with.
llvm-svn: 46394
2008-01-26 06:51:24 +00:00
Duncan Sands
c4dc3dc3a2
Create an explicit copy for byval parameters even
...
when inlining a readonly function.
llvm-svn: 46393
2008-01-26 06:41:49 +00:00
Bill Wendling
0862e3421d
If we have a function like this:
...
void bork() {
int *address = 0;
*address = 0;
}
It's compiled into LLVM code that looks like this:
define void @bork() noreturn nounwind {
entry:
unreachable
}
This is bad on some platforms (like PPC) because it will generate the label for
the function but no body. The label could end up being associated with some
non-code related stuff, like a section. This places a "trap" instruction if the
SimplifyCFG pass removed all code from the function leaving only one
"unreachable" instruction.
llvm-svn: 46387
2008-01-26 01:43:44 +00:00
Duncan Sands
f52faf9a64
Do this more neatly.
...
llvm-svn: 46369
2008-01-25 22:06:51 +00:00
Owen Anderson
6af19fd1e2
DeadStoreElimination can treat byval parameters as if there were alloca's for the purpose of removing end-of-function stores.
...
llvm-svn: 46351
2008-01-25 10:10:33 +00:00
Nick Lewycky
f069264164
Enable the fix I just checked in, silly me.
...
llvm-svn: 46247
2008-01-22 05:42:02 +00:00
Nick Lewycky
78712e5b59
Multiply can be evaluated in a different type, so long as the target type has
...
a smaller bitwidth.
llvm-svn: 46244
2008-01-22 05:08:48 +00:00
Duncan Sands
afa84da4e0
Make sure the caller doesn't use freed memory.
...
Fixes PR1935.
llvm-svn: 46203
2008-01-20 16:51:46 +00:00
Duncan Sands
fe3bef091f
Initializing an unsigned with ~0UL causes the compiler
...
to complain on x86-64 (gcc 4.1). Use ~0U instead.
llvm-svn: 46197
2008-01-20 10:49:23 +00:00
Evan Cheng
04af661b1f
DAE bug fix. Don't lose parameter attributes on vararg arguments.
...
llvm-svn: 46113
2008-01-17 04:18:54 +00:00
Chris Lattner
5630c4f217
Fix arg promotion to propagate the correct attrs on the calls to
...
promoted functions. This is important for varargs calls in
particular. Thanks to duncan for providing a great testcase.
llvm-svn: 46108
2008-01-17 01:17:03 +00:00
Chris Lattner
39f156183d
Handle attribute(used) global variables that are i8.
...
llvm-svn: 46090
2008-01-16 21:35:43 +00:00
Devang Patel
b3696e4f14
Do not strip llvm.used values.
...
llvm-svn: 46045
2008-01-16 03:33:05 +00:00
Duncan Sands
b5ca2e9fcb
I noticed that the trampoline straightening transformation could
...
drop attributes on varargs call arguments. Also, it could generate
invalid IR if the transformed call already had the 'nest' attribute
somewhere (this can never happen for code coming from llvm-gcc,
but it's a theoretical possibility). Fix both problems.
llvm-svn: 45973
2008-01-14 19:52:09 +00:00
Chris Lattner
26fe7ebc03
Fix the miscompilation of MiBench/consumer-lame that was exposed by Evan's
...
byval work. This miscompilation is due to the program indexing an array out
of range and us doing a transformation that broke this.
llvm-svn: 45949
2008-01-14 02:09:12 +00:00
Chris Lattner
9a6db18b04
The isNotSuitableForSRA property is now dead, don't compute it.
...
llvm-svn: 45948
2008-01-14 01:32:52 +00:00
Chris Lattner
ab0537258f
Change SRAGlobal to not depend on isNotSuitableForSRA, which makes it very
...
difficult to understand the invariants.
llvm-svn: 45947
2008-01-14 01:31:05 +00:00
Chris Lattner
20bbac3435
Make the 'shrink global to bool' optimization more self contained, and thus
...
easier to show that its safe. No functionality change.
llvm-svn: 45946
2008-01-14 01:17:44 +00:00
Chris Lattner
92bd785323
Turn a memcpy from a double* into a load/store of double instead of
...
a load/store of i64. The later prevents promotion/scalarrepl of the
source and dest in many cases.
This fixes the 300% performance regression of the byval stuff on
stepanov_v1p2.
llvm-svn: 45945
2008-01-14 00:28:35 +00:00
Chris Lattner
57974c8d51
factor memcpy/memmove simplification out to its own SimplifyMemTransfer
...
method, no functionality change.
llvm-svn: 45944
2008-01-13 23:50:23 +00:00
Chris Lattner
8c5cdddfb9
simplify some code. If we can infer alignment for source and dest that are
...
greater than memcpy alignment, and if we lower to load/store, use the best
alignment info we have.
llvm-svn: 45943
2008-01-13 22:30:28 +00:00
Chris Lattner
5a86612d3f
simplify some code by adding a InsertBitCastBefore method,
...
make memmove->memcpy conversion a bit simpler.
llvm-svn: 45942
2008-01-13 22:23:22 +00:00
Chris Lattner
5bc253c8f2
Fix PR1907, a nasty miscompilation because instcombine didn't
...
realize that ne & sgt was a signed comparison (it was only
looking at whether the left compare was signed).
llvm-svn: 45937
2008-01-13 20:59:02 +00:00
Duncan Sands
ff70c5de69
Small simplification.
...
llvm-svn: 45932
2008-01-13 08:12:17 +00:00
Duncan Sands
781f6549db
When turning a call to a bitcast function into a direct call,
...
if this becomes a varargs call then deal correctly with any
parameter attributes on the newly vararg call arguments.
llvm-svn: 45931
2008-01-13 08:02:44 +00:00
Chris Lattner
4f6c81ac68
we don't have to make an explicit copy of a byval argument when
...
inlining a function if we know that the function does not write
to *any* memory. This implements test/Transforms/Inline/byval2.ll
llvm-svn: 45912
2008-01-12 18:54:29 +00:00
Chris Lattner
22ad7abdfe
Allow clients to specify the inline threshold when creating
...
the inliner pass. Patch by Robert Zeh.
llvm-svn: 45903
2008-01-12 06:49:13 +00:00