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

333 Commits

Author SHA1 Message Date
Owen Anderson
a4ff15c69f 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
78780f175b 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
Evan Cheng
ca434b34ff Test case for varargs parameter attribute issue I just fixed.
llvm-svn: 46127
2008-01-17 07:26:31 +00:00
Chris Lattner
c32be7e6b2 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
Devang Patel
a8d63b0b30 Do not strip llvm.used values.
llvm-svn: 46045
2008-01-16 03:33:05 +00:00
Chris Lattner
f0dd2bb4e6 add a test to ensure that argpromote of one argument doesn't
break the byval attr on some other argument.

llvm-svn: 46025
2008-01-15 22:38:12 +00:00
Duncan Sands
81e35b4d47 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
efb498eddb 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
d22a5f6314 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
32eae5daa5 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
7414cc131b 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
d90840eddc 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
Duncan Sands
6f49217a5e When DAE drops the varargs part of a function, ensure any
attributes on the vararg call arguments are also dropped.

llvm-svn: 45892
2008-01-11 23:13:45 +00:00
Chris Lattner
a1246ba8ed Teach argpromote to ruthlessly hack small byval structs when it can
get away with it, which exposes opportunities to eliminate the memory
objects entirely.  For example, we now compile byval.ll to:

define internal void @f1(i32 %b.0, i64 %b.1) {
entry:
	%tmp2 = add i32 %b.0, 1		; <i32> [#uses=0]
	ret void
}

define i32 @main() nounwind  {
entry:
	call void @f1( i32 1, i64 2 )
	ret i32 0
}

This seems like it would trigger a lot for code that passes around small
structs (e.g. SDOperand's or _Complex)...

llvm-svn: 45886
2008-01-11 22:31:41 +00:00
Chris Lattner
bf51fecdc4 When inlining a functino with a byval argument, make an explicit
copy of it in case the callee modifies the struct.

llvm-svn: 45853
2008-01-11 06:09:30 +00:00
Chris Lattner
67f581b344 Implement PR1795, an instcombine hack for forming GEPs with integer pointer arithmetic.
llvm-svn: 45745
2008-01-08 07:23:51 +00:00
Duncan Sands
fd975e4b3d The transform that tries to turn calls to bitcast functions into
direct calls bails out unless caller and callee have essentially
equivalent parameter attributes.  This is illogical - the callee's
attributes should be of no relevance here.  Rework the logic, which
incidentally fixes a crash when removed arguments have attributes.

llvm-svn: 45658
2008-01-06 18:27:01 +00:00
Duncan Sands
b8489f09a2 When transforming a call to a bitcast function into
a direct call with cast parameters and cast return
value (if any), instcombine was prepared to cast any
non-void return value into any other, whether castable
or not.  Add a new predicate for testing whether casting
is valid, and check it both for the return value and
(as a cleanup) for the parameters.

llvm-svn: 45657
2008-01-06 10:12:28 +00:00
Chris Lattner
7e1c3aa702 remove a couple more unsafe xforms in the face of overflow.
llvm-svn: 45613
2008-01-05 01:22:42 +00:00
Chris Lattner
d4c66656a1 Fix PR1896
llvm-svn: 45568
2008-01-04 05:04:53 +00:00
Chris Lattner
26b89fd30a don't hoist FP additions into unconditional adds + selects. This
could theoretically introduce a trap, but is also a performance issue.
This speeds up ptrdist/ks by 8%.

llvm-svn: 45533
2008-01-03 07:25:26 +00:00
Bill Wendling
e6898cbe7a Update this testcase. The output needs to be disabled to pass.
llvm-svn: 45478
2008-01-01 01:34:36 +00:00
Chris Lattner
2369d2f4ab dead calls to llvm.stacksave can be deleted, even though they
have potential side-effects.

llvm-svn: 45392
2007-12-29 00:59:12 +00:00
Chris Lattner
e26989231e upgrade this test
llvm-svn: 45391
2007-12-29 00:57:06 +00:00
Devang Patel
d601ada369 Test -simplifycfg only.
llvm-svn: 45389
2007-12-28 22:59:48 +00:00
Owen Anderson
ddb5d73f0a Add a testcase for my recent InstCombine fix, written by Nicholas.
llvm-svn: 45386
2007-12-28 21:08:43 +00:00
Chris Lattner
d64df490ca implement InstCombine/shift-trunc-shift.ll. This allows
us to compile:
#include <math.h>
int t1(double d) { return signbit(d); }

into:

_t1:
	movd	%xmm0, %rax
	shrq	$63, %rax
	ret

instead of:

_t1:
	movd	%xmm0, %rax
	shrq	$32, %rax
	shrl	$31, %eax
	ret

on x86-64.

llvm-svn: 45311
2007-12-22 09:07:47 +00:00
Devang Patel
e035f776e9 If succ has succ itself as one of the predecessors then do
not merge current bb and succ even if bb's terminator is
unconditional branch to succ.

llvm-svn: 45305
2007-12-22 01:32:53 +00:00
Duncan Sands
85ca85c070 Make DAE not wipe out attributes on calls, and not drop
return attributes on the floor.  In the case of a call
to a varargs function where the varargs arguments are
being removed, any call attributes on those arguments
need to be dropped.  I didn't do this because I plan to
make it illegal to have such attributes (see next patch).
With this change, compiling the gcc filter2 eh test at -O0
and then running opt -std-compile-opts on it results in
a correctly working program (compiling at -O1 or higher
results in the test failing due to a problem with how we
output eh info into the IR).

llvm-svn: 45285
2007-12-21 19:16:16 +00:00
Christopher Lamb
7ca648a7b1 Implement review feedback, including additional transforms
(icmp slt (sub A B) 1) -> (icmp sle A B)
icmp sgt (sub A B) -1) -> (icmp sge A B)

and add testcase.

llvm-svn: 45256
2007-12-20 07:21:11 +00:00
Duncan Sands
56f3add5b7 When inlining through an 'nounwind' call, mark inlined
calls 'nounwind'.  It is important for correct C++
exception handling that nounwind markings do not get
lost, so this transformation is actually needed for
correctness.

llvm-svn: 45218
2007-12-19 21:13:37 +00:00
Christopher Lamb
d56318b885 Remove an orthogonal transformation of the selection condition from my most recent submission.
llvm-svn: 45169
2007-12-18 20:30:28 +00:00
Christopher Lamb
437b4d229e Fix typos.
llvm-svn: 45159
2007-12-18 09:45:40 +00:00
Christopher Lamb
aeb76743dc Fold certain additions through selects (and their compares) so as to eliminate subtractions. This code is often produced by the SMAX expansion in SCEV.
This implements test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll

llvm-svn: 45158
2007-12-18 09:34:41 +00:00
Duncan Sands
3a0d757bd5 Make invokes of inline asm legal. Teach codegen
how to lower them (with no attempt made to be
efficient, since they should only occur for
unoptimized code).

llvm-svn: 45108
2007-12-17 18:08:19 +00:00
Duncan Sands
bf62f62058 Make instcombine promote inline asm calls to 'nounwind'
calls.  Remove special casing of inline asm from the
inliner.  There is a potential problem: the verifier
rejects invokes of inline asm (not sure why).  If an
asm call is not marked "nounwind" in some .ll, and
instcombine is not run, but the inliner is run, then
an illegal module will be created.  This is bad but
I'm not sure what the best approach is.  I'm tempted
to remove the check in the verifier...

llvm-svn: 45073
2007-12-16 15:51:49 +00:00
Wojciech Matyjewicz
8bb1d9e67c 1. "Upgrage" comments.
2. Using zero-extended value of Scale and unsigned division is safe provided
   that Scale doesn't have the sign bit set.
   Previously these 2 instructions:
        %p = bitcast [100 x {i8,i8,i8}]* %x to i8*
        %q = getelementptr i8* %p, i32 -4
   were combined into:
        %q = getelementptr [100 x { i8, i8, i8 }]* %x, i32 0,
               i32 1431655764, i32 0
   what was incorrect.

llvm-svn: 44936
2007-12-12 15:21:32 +00:00
Chris Lattner
568d56425b Implement constant folding if vector<->vector bitcasts where the number
of source/dest elements changes.  This implements
test/Transforms/InstCombine/bitcast-vector-fold.ll

llvm-svn: 44855
2007-12-11 07:29:44 +00:00
Chris Lattner
5ca42cd342 Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.
Reimplement the xform in Analysis/ConstantFolding.cpp where we can use
targetdata to validate that it is safe.  While I'm in there, fix some const
correctness issues and generalize the interface to the "operand folder".

llvm-svn: 44817
2007-12-10 22:53:04 +00:00
Duncan Sands
b7ac459292 Make PruneEH update the nounwind/noreturn attributes
on functions as it calculates them.

llvm-svn: 44802
2007-12-10 19:09:40 +00:00
Devang Patel
c47f68e747 If ExitValue operand is also defined in Loop header then
insert new ExitValue after this operand definition.

This fixes PR1828.

llvm-svn: 44539
2007-12-03 19:17:21 +00:00
Duncan Sands
1b0feb42e2 Add some convenience methods for querying attributes, and
use them.

llvm-svn: 44403
2007-11-28 17:07:01 +00:00
Duncan Sands
3602011bec Fix PR1146: parameter attributes are longer part of
the function type, instead they belong to functions
and function calls.  This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll).  Hopefully
a bitcode guru (who might that be? :) ) will fix it.

llvm-svn: 44359
2007-11-27 13:23:08 +00:00
Nick Lewycky
1536b3f230 Add new SCEV, SCEVSMax. This allows LLVM to analyze do-while loops.
llvm-svn: 44319
2007-11-25 22:41:31 +00:00
Chris Lattner
d1e03b5387 Implement PR1822
llvm-svn: 44318
2007-11-25 21:27:53 +00:00
Duncan Sands
114968a3e8 Fix PR1816. If a bitcast of a function only exists because of a
trivial difference in function attributes, allow calls to it to
be converted to direct calls.  Based on a patch by Török Edwin.
While there, move the various lists of mutually incompatible
parameters etc out of the verifier and into ParameterAttributes.h.

llvm-svn: 44315
2007-11-25 14:10:56 +00:00
Chris Lattner
36854c740d Fix PR1816, by correcting the broken definition of APInt::countTrailingZeros.
llvm-svn: 44296
2007-11-23 22:42:31 +00:00
Duncan Sands
265752ae8f Ding dong, the DoesntAccessMemoryFns and
OnlyReadsMemoryFns tables are dead!  We
get more, and more accurate, information
from gcc via the readnone and readonly
function attributes.

llvm-svn: 44288
2007-11-23 19:30:27 +00:00
Chris Lattner
ac2de0424b Fix a bug where we'd try to find a scev value for a bitcast operand,
even though the bitcast operand did not have integer type.  This fixes
PR1814.

llvm-svn: 44286
2007-11-23 08:46:22 +00:00
Chris Lattner
bff48b8f0d Fix PR1817.
llvm-svn: 44284
2007-11-22 23:47:13 +00:00