1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 04:52:54 +02:00
Commit Graph

23289 Commits

Author SHA1 Message Date
Dan Gohman
8b6f4366ae Tidy up BasicBlock::getFirstNonPHI, and change a bunch of places to
use it instead of duplicating its functionality.

llvm-svn: 51499
2008-05-23 21:05:58 +00:00
Dan Gohman
c877140168 Add #includes to make some dependencies explicit.
llvm-svn: 51496
2008-05-23 20:40:06 +00:00
Dan Gohman
d3610b38ac Issue errors in several situations instead of aborting.
llvm-svn: 51493
2008-05-23 18:23:11 +00:00
Dan Gohman
e8422fc112 Elaborate on the entry on integer vector multiplication by constants.
llvm-svn: 51491
2008-05-23 18:05:39 +00:00
Evan Cheng
ec8bd19399 Fix a duplicated pattern.
llvm-svn: 51490
2008-05-23 18:00:18 +00:00
Dan Gohman
6cc0b4f262 Use PMULDQ for v2i64 multiplies when SSE4.1 is available. And add
load-folding table entries for PMULDQ and PMULLD.

llvm-svn: 51489
2008-05-23 17:49:40 +00:00
Evan Cheng
e7ec4690e1 New entry.
llvm-svn: 51487
2008-05-23 17:28:11 +00:00
Dale Johannesen
3d9a178ff9 Rewrite a loop to avoid using iterators pointing to
elements that have been erased.  Based on a patch
by Nicolas Capens.

llvm-svn: 51485
2008-05-23 17:19:02 +00:00
Dan Gohman
1bff0b83b0 Fix another isFirstClassType that now needs to be isSingleValueType.
This fixes recent CBE regressions.

llvm-svn: 51483
2008-05-23 16:57:00 +00:00
Matthijs Kooijman
e9217fe486 Replace some weird usage of UserOp1 introduced in r49492 by a plain if.
llvm-svn: 51482
2008-05-23 16:17:48 +00:00
Matthijs Kooijman
cf417144f6 Restucture a part of the SimplifyCFG pass and include a testcase.
The SimplifyCFG pass looks at basic blocks that contain only phi nodes,
followed by an unconditional branch. In a lot of cases, such a block (BB) can
be merged into their successor (Succ).

This merging is performed by TryToSimplifyUncondBranchFromEmptyBlock. It does
this by taking all phi nodes in the succesor block Succ and expanding them to
include the predecessors of BB. Furthermore, any phi nodes in BB are moved to
Succ and expanded to include the predecessors of Succ as well.

Before attempting this merge, CanPropagatePredecessorsForPHIs checks to see if
all phi nodes can be properly merged. All functional changes are made to
this function, only comments were updated in
TryToSimplifyUncondBranchFromEmptyBlock.

In the original code, CanPropagatePredecessorsForPHIs looks quite convoluted
and more like stack of checks added to handle different kinds of situations
than a comprehensive check. In particular the first check in the function did
some value checking for the case that BB and Succ have a common predecessor,
while the last check in the function simply rejected all cases where BB and
Succ have a common predecessor. The first check was still useful in the case
that BB did not contain any phi nodes at all, though, so it was not completely
useless.

Now, CanPropagatePredecessorsForPHIs is restructured to to look a lot more
similar to the code that actually performs the merge. Both functions now look
at the same phi nodes in about the same order.  Any conflicts (phi nodes with
different values for the same source) that could arise from merging or moving
phi nodes are detected. If no conflicts are found, the merge can happen.

Apart from only restructuring the checks, two main changes in functionality
happened.

Firstly, the old code rejected blocks with common predecessors in most cases.
The new code performs some extra checks so common predecessors can be handled
in a lot of cases. Wherever common predecessors still pose problems, the
blocks are left untouched.

Secondly, the old code rejected the merge when values (phi nodes) from BB were
used in any other place than Succ. However, it does not seem that there is any
situation that would require this check. Even more, this can be proven.

Consider that BB is a block containing of a single phi node "%a" and a branch
to Succ. Now, since the definition of %a will dominate all of its uses, BB
will dominate all blocks that use %a. Furthermore, since the branch from BB to
Succ is unconditional, Succ will also dominate all uses of %a.

Now, assume that one predecessor of Succ is not dominated by BB (and thus not
dominated by Succ). Since at least one use of %a (but in reality all of them)
is reachable from Succ, you could end up at a use of %a without passing
through it's definition in BB (by coming from X through Succ). This is a
contradiction, meaning that our original assumption is wrong. Thus, all
predecessors of Succ must also be dominated by BB (and thus also by Succ).

This means that moving the phi node %a from BB to Succ does not pose any
problems when the two blocks are merged, and any use checks are not needed.

llvm-svn: 51478
2008-05-23 09:09:41 +00:00
Matthijs Kooijman
c4ddb73290 Indent fix.
llvm-svn: 51477
2008-05-23 07:57:02 +00:00
Nick Lewycky
6a16ace643 Constant integer vectors may also be negated.
llvm-svn: 51476
2008-05-23 04:54:45 +00:00
Nick Lewycky
16773d5239 Typo.
llvm-svn: 51475
2008-05-23 04:39:38 +00:00
Nick Lewycky
bd2da8098d Revert X + X --> X * 2 optz'n which pessimizes heavily on x86.
llvm-svn: 51474
2008-05-23 04:34:58 +00:00
Chris Lattner
4c1ffef5af we compile multiply-by-constant into horrible code. Doesn't sse4 have some
instruction for doing this?

llvm-svn: 51473
2008-05-23 04:29:53 +00:00
Nick Lewycky
427209006f Implement X + X for vectors.
llvm-svn: 51472
2008-05-23 04:14:51 +00:00
Nick Lewycky
e62259c369 Fix a recently added optimization to not crash on vectors.
llvm-svn: 51471
2008-05-23 03:26:47 +00:00
Dan Gohman
67e1a58e22 Generalize the new code in instcombine's ComputeNumSignBits for handling
and/or to handle more cases (such as this add-sitofp.ll testcase), and
port it to selectiondag's ComputeNumSignBits.

llvm-svn: 51469
2008-05-23 02:28:01 +00:00
Dan Gohman
c7007dd0dc Make structs and arrays first-class types, and add assembly
and bitcode support for the extractvalue and insertvalue
instructions and constant expressions.

Note that this does not yet include CodeGen support.

llvm-svn: 51468
2008-05-23 01:55:30 +00:00
Dan Gohman
eafccb7d8f Use isSingleValueType instead of isFirstClassType to
exclude struct and array types.

llvm-svn: 51467
2008-05-23 01:52:21 +00:00
Bill Wendling
5fbba337e1 Remove warnings about comparison between signed and unsigned expressions.
llvm-svn: 51465
2008-05-23 01:29:08 +00:00
Dale Johannesen
da54faec0c Allow for switch with no cases. Was causing fault
in gcc.dg/pr27531-1.c.

llvm-svn: 51464
2008-05-23 01:01:31 +00:00
Evan Cheng
097e95b1f7 Bug: rcpps can only folds a load if the address is 16-byte aligned. Fixed many 'ps' load folding patterns in X86InstrSSE.td which are missing the proper alignment checks.
Also fixed some 80 col. violations.

llvm-svn: 51462
2008-05-23 00:37:07 +00:00
Dan Gohman
9674662036 Add more IR support for the new extractvalue and insertvalue
instructions.

llvm-svn: 51461
2008-05-23 00:36:11 +00:00
Dan Gohman
144390078f Use isSingleValueType instead of isFirstClassType to
exclude struct and array types.

llvm-svn: 51460
2008-05-23 00:34:04 +00:00
Dan Gohman
698b435f13 Use isSingleValueType instead of isFirstClassType to
exclude struct and array types.

llvm-svn: 51459
2008-05-23 00:17:26 +00:00
Dale Johannesen
7cc19db16f Put const weak stuff in appropriate section on Darwin.
g++.dg/abi/key2.C

llvm-svn: 51458
2008-05-23 00:16:59 +00:00
Dan Gohman
8df50ad902 Use isSingleValueType instead of isFirstClassType to
exclude struct and array types.

llvm-svn: 51456
2008-05-23 00:12:03 +00:00
Evan Cheng
2dc53b5d58 X86CodeEmitter should not set PIC style to None at initialization time. This will break codegen if relocation model is changed to PIC_ later.
llvm-svn: 51455
2008-05-22 23:55:24 +00:00
Dan Gohman
f25b89f697 Use isSingleValueType instead of isFirstClassType to
exclude struct and array types.

llvm-svn: 51452
2008-05-22 23:43:22 +00:00
Dan Gohman
bed6c00ef0 Recognize the "default" keyword, which is documented in LangRef.html
and supported in the grammar, in the lexer.

llvm-svn: 51448
2008-05-22 22:30:09 +00:00
David Greene
265bbfa154 When rewriting defs and uses after spilling, don't set the weight of a
live interval to infinity if the instruction being rewritten is an
original remat def instruction.  We were only checking against the clone
of the remat def which doesn't actually appear in the IR at all.

llvm-svn: 51440
2008-05-22 21:16:33 +00:00
David Greene
47ea993e83 Don't attempt to update SpillSlotToUsesMap for stack slots that aren't
generated by the spiller.

llvm-svn: 51439
2008-05-22 21:12:21 +00:00
Gabor Greif
0c41f351cc transform more loops to iterator form, detabify
llvm-svn: 51436
2008-05-22 19:24:54 +00:00
Evan Cheng
d1373cd497 Add missing patterns.
llvm-svn: 51435
2008-05-22 18:56:56 +00:00
Gabor Greif
0c8b237857 Rewrite operand loops to use iterators. This shrinks .o file (at gcc4.0.1 -O3 x86) substantially (>500 bytes). Reason still unknown.
llvm-svn: 51423
2008-05-22 06:43:33 +00:00
Chris Lattner
0a98796008 fix an off-by-one error in my previous patch, don't treat the callee as a incoming arg.
llvm-svn: 51422
2008-05-22 06:29:38 +00:00
Chris Lattner
6a45cf9dd6 Add support for multiple-return values in inline asm. This should
get inline asm working as well as it did previously with the CBE
with the new MRV support for inline asm.

llvm-svn: 51420
2008-05-22 06:19:37 +00:00
Chris Lattner
beb6254442 Fix PR2267, by allowing indirect outputs to be intermixed
with normal outputs.  Testcase here: 
test/CodeGen/X86/asm-indirect-mem.ll

llvm-svn: 51409
2008-05-22 04:46:38 +00:00
Chris Lattner
5a09a5fb88 Free and vaarg are not really volatile.
llvm-svn: 51407
2008-05-22 03:23:06 +00:00
Chris Lattner
fd83f89e21 rewrite the validity checking for memory promotion to be simpler,
more aggressive, and more correct.  Verify that we only attempt to
promote loads and stores.

llvm-svn: 51406
2008-05-22 03:22:42 +00:00
Chris Lattner
a34f7317e9 Use 'continue' to reduce nesting in this loop. No functionality change.
llvm-svn: 51399
2008-05-22 00:53:38 +00:00
Evan Cheng
8e02953de8 Fix PR2343. An *interesting* coalescer bug.
BB1:                                                                                                                                                  
  vr1025 = copy vr1024                                                                                                                                
  ..                                                                                                                                                  
BB2:                                                                                                                                                  
  vr1024 = op                                                                                                                                         
         = op vr1025                                                                                                                                     
  <loop eventually branch back to BB1>

Even though vr1025 is copied from vr1024, it's not safe to coalesced them since live range of vr1025 intersects the def of vr1024. This happens when vr1025 is assigned the value of the previous iteration of vr1024 in the loop.

llvm-svn: 51394
2008-05-21 22:34:12 +00:00
Bill Wendling
7ec2aad450 Follow-up to the reverting of r51218. This puts the checks out-of-line. Because
they aren't in the header file, systems with a <string> header file that isn't
64-bit clean shouldn't warn if #including Path.h and specifying
-Wshorten-64-to-32.

llvm-svn: 51393
2008-05-21 21:20:07 +00:00
Nate Begeman
26bb02a23a Fix a couple issues with the JIT and multiple modules:
1. The "JITState" object creates a PassManager with the ModuleProvider that the
   jit is created with.  If the ModuleProvider is removed and deleted, the
   PassManager is invalid.

2. The Global maps in the JIT were not invalidated with a ModuleProvider was 
   removed.  This could lead to a case where the Module would be freed, and a 
   new Module with Globals at the same addresses could return invalid results.

llvm-svn: 51384
2008-05-21 16:34:48 +00:00
Gabor Greif
aa0a5c230c suppress gcc3.4.6's <no value returned> warnings
llvm-svn: 51372
2008-05-21 14:07:30 +00:00
Dan Gohman
ad548e93f7 When LSR is replacing an instruction, call
ScalarEvolution::deleteValueFromRecords on it before doing the
replaceAllUsesWith, because ScalarEvolution looks at the instruction's
users to find SCEV references to the instruction's SCEV object in its
internal maps.

Move all of LSR's loop-related state clearing after processing the loop
and before cleaning up dead PHI nodes. This eliminates all of LSR's SCEV
references just before the calls to ScalarEvolution::deleteValueFromRecords
so that when ScalarEvolution drops its own SCEV references, the reference
counts will reach zero and the SCEVs will be deleted immediately.

These changes fix some compiler aborts involving ScalarEvolution holding
onto and reusing SCEV objects for instructions that have been deleted.
No regression test unfortunately; because the symptoms were due to
dangling pointers, reduced testcases ended up being fairly arbitrary.

llvm-svn: 51359
2008-05-21 00:54:12 +00:00
Chris Lattner
821dc30131 Fix PR2346 by marking vaarg as volatile so that licm doesn't try to
hoist them.

llvm-svn: 51356
2008-05-20 22:05:28 +00:00
Dan Gohman
b48d4a75f6 Port SelectionDAG's ComputeNumSignBits-using code to instcombine,
now that instcombine also has ComputeNumSignBits.

llvm-svn: 51350
2008-05-20 21:01:12 +00:00
Dan Gohman
d545f5b229 Port the fix for the select operator from instcombine's
ComputeNumSignBits to SelectionDAG's ComputeNumSignBits.

llvm-svn: 51348
2008-05-20 20:59:51 +00:00
Dan Gohman
287e750e64 Code simplification.
llvm-svn: 51345
2008-05-20 20:56:33 +00:00
Evan Cheng
d694e78e36 movsd and movq do not require 16-byte alignment. This fixes vec_set-5.ll on Linux.
llvm-svn: 51327
2008-05-20 18:24:47 +00:00
Evan Cheng
55e3957c96 More local spiller complexity!
If local spiller optimization turns some instruction into an identity copy, it will be removed. If the output register happens to be dead (and source is obviously killed), transfer the kill / dead information to last use / def in the same MBB.

llvm-svn: 51306
2008-05-20 08:13:21 +00:00
Evan Cheng
408425f0e0 Don't spill dead def.
llvm-svn: 51305
2008-05-20 08:10:37 +00:00
Matthijs Kooijman
9247675761 Fix typo.
llvm-svn: 51303
2008-05-20 07:26:45 +00:00
Chris Lattner
b387fd90fc Teach instcombine 4 new xforms:
(add (sext x), cst) --> (sext (add x, cst'))
  (add (sext x), (sext y)) --> (sext (add int x, y))
  (add double (sitofp x), fpcst) --> (sitofp (add int x, intcst))
  (add double (sitofp x), (sitofp y)) --> (sitofp (add int x, y))

This generally reduces conversions.  For example MiBench/telecomm-gsm
gets these simplifications:

HACK2: 	%tmp67.i142.i.i = sext i16 %tmp6.i141.i.i to i32		; <i32> [#uses=1]
	%tmp23.i139.i.i = sext i16 %tmp2.i138.i.i to i32		; <i32> [#uses=1]
	%tmp8.i143.i.i = add i32 %tmp67.i142.i.i, %tmp23.i139.i.i		; <i32> [#uses=3]
HACK2: 	%tmp67.i121.i.i = sext i16 %tmp6.i120.i.i to i32		; <i32> [#uses=1]
	%tmp23.i118.i.i = sext i16 %tmp2.i117.i.i to i32		; <i32> [#uses=1]
	%tmp8.i122.i.i = add i32 %tmp67.i121.i.i, %tmp23.i118.i.i		; <i32> [#uses=3]
HACK2: 	%tmp67.i.i190.i = sext i16 %tmp6.i.i189.i to i32		; <i32> [#uses=1]
	%tmp23.i.i187.i = sext i16 %tmp2.i.i186.i to i32		; <i32> [#uses=1]
	%tmp8.i.i191.i = add i32 %tmp67.i.i190.i, %tmp23.i.i187.i		; <i32> [#uses=3]
HACK2: 	%tmp67.i173.i.i.i = sext i16 %tmp6.i172.i.i.i to i32		; <i32> [#uses=1]
	%tmp23.i170.i.i.i = sext i16 %tmp2.i169.i.i.i to i32		; <i32> [#uses=1]
	%tmp8.i174.i.i.i = add i32 %tmp67.i173.i.i.i, %tmp23.i170.i.i.i		; <i32> [#uses=3]
HACK2: 	%tmp67.i152.i.i.i = sext i16 %tmp6.i151.i.i.i to i32		; <i32> [#uses=1]
	%tmp23.i149.i.i.i = sext i16 %tmp2.i148.i.i.i to i32		; <i32> [#uses=1]
	%tmp8.i153.i.i.i = add i32 %tmp67.i152.i.i.i, %tmp23.i149.i.i.i		; <i32> [#uses=3]
HACK2: 	%tmp67.i.i.i.i = sext i16 %tmp6.i.i.i.i to i32		; <i32> [#uses=1]
	%tmp23.i.i5.i.i = sext i16 %tmp2.i.i.i.i to i32		; <i32> [#uses=1]
	%tmp8.i.i7.i.i = add i32 %tmp67.i.i.i.i, %tmp23.i.i5.i.i		; <i32> [#uses=3]


This also fixes a bug in ComputeNumSignBits handling select and
makes it more aggressive with and/or.

llvm-svn: 51302
2008-05-20 05:46:13 +00:00
Chris Lattner
323a985507 fix two issues Neil noticed, thanks!
llvm-svn: 51296
2008-05-20 03:50:52 +00:00
Chris Lattner
5c3ce73720 Add a bool to isEdgeFeasible that tells it whether to treat unknown
value as undef or untracked.

llvm-svn: 51295
2008-05-20 03:39:39 +00:00
Dan Gohman
e6bb320822 Fix ExecutionEngine's constant code to work properly when structs and arrays
will become first-class types.

llvm-svn: 51293
2008-05-20 03:20:09 +00:00
Dan Gohman
c2bd39553c Refine the fix in r51169 to only apply when the operand val being
replaced is a PHI. This prevents it from inserting uses before defs
in the case that it isn't a PHI and it depends on other instructions
later in the block. This fixes the 447.dealII regression on x86-64.

llvm-svn: 51292
2008-05-20 03:01:48 +00:00
Evan Cheng
e95fc3e83d runOnMachineFunction should set IsPIC because relocation model may have been changed.
llvm-svn: 51291
2008-05-20 01:56:59 +00:00
Dan Gohman
3f6b53dba0 Make AssociativeOpt static.
llvm-svn: 51290
2008-05-20 01:14:05 +00:00
Devang Patel
9f385d71c2 Do not erase induction variable increment if it is used outside the loop.
llvm-svn: 51280
2008-05-19 22:23:55 +00:00
Dan Gohman
2d2351f037 Add a ComputeNumSignBits function for use by instcombine, based on the
code in SelectionDAG.

llvm-svn: 51279
2008-05-19 22:14:15 +00:00
Dale Johannesen
e6977495aa Handle quoted names when constructing $stub's,
$non_lazy_ptr's and $lazy_ptr's.

llvm-svn: 51277
2008-05-19 21:38:18 +00:00
Chris Lattner
859485412b switch to Type::getFPMantissaWidth instead of reinventing it.
llvm-svn: 51275
2008-05-19 21:17:23 +00:00
Chris Lattner
92599bcc72 minor cleanups, teach instcombine that sitofp/uitofp cannot
produce a negative zero.

llvm-svn: 51272
2008-05-19 20:27:56 +00:00
Chris Lattner
63c384df1e convert fptosi(sitofp x) -> x if the fp value has enough bits in its mantissa
to accurately represent the integer.  This triggers 9 times in 471.omnetpp,
though 8 of those seem to be inlined from the same place.

llvm-svn: 51271
2008-05-19 20:25:04 +00:00
Chris Lattner
1435b94f62 Fold FP comparisons where one operand is converted from an integer
type and the other operand is a constant into integer comparisons.
This happens surprisingly frequently (e.g. 10 times in 471.omnetpp),
which are things like this:

	%tmp8283 = sitofp i32 %tmp82 to double	
	%tmp1013 = fcmp ult double %tmp8283, 0.0

Clearly comparing tmp82 against i32 0 is cheaper here.

this also triggers 8 times in gobmk, including this one:

	%tmp375376 = sitofp i32 %tmp375 to double
	%tmp377 = fcmp ogt double %tmp375376, 8.150000e+01

which is comparing an integer against 81.5 :).

llvm-svn: 51268
2008-05-19 20:18:56 +00:00
Chris Lattner
ad02ff166e remove debug output
llvm-svn: 51264
2008-05-19 20:03:53 +00:00
Chris Lattner
510a6b249c be more aggressive about transforming add -> or when the operands have no
intersecting bits.  This triggers all over the place, for example in lencode,
with adds of stuff like:

	%tmp580 = mul i32 %tmp579, 2	
	%tmp582 = and i32 %b8, 1
and

	%tmp28 = shl i32 %abs.i, 1		
	%sign.0 = select i1 %tmp23, i32 1, i32 0
and
	%tmp344 = shl i32 %tmp343, 2	
	%tmp346 = and i32 %tmp96, 3

etc.

llvm-svn: 51263
2008-05-19 20:01:56 +00:00
Duncan Sands
7b84c36791 Fix PR2341 - when the length is 4 use an i32 not
an i16!  Cleaned up trailing whitespace while there.

llvm-svn: 51240
2008-05-19 09:27:24 +00:00
Gordon Henriksen
27c184c385 Reverting accidental commit of generated files.
llvm-svn: 51239
2008-05-19 05:57:12 +00:00
Gordon Henriksen
a1f7004038 Remove a duplicative binding. Patch by Mahadevan R.
llvm-svn: 51238
2008-05-19 05:47:10 +00:00
Nate Begeman
fdedac42c7 Teach GVN to not assert on vector comparisons
llvm-svn: 51230
2008-05-18 19:49:05 +00:00
Nate Begeman
f924b6e0d9 Fix a backwards check in the JIT symbol table code
llvm-svn: 51229
2008-05-18 19:09:10 +00:00
Chris Lattner
8c0f0a0e6c Fix PR2339
llvm-svn: 51226
2008-05-18 04:11:26 +00:00
Nick Lewycky
46e3a168c0 Revert constant-folding change that will miscompile in some cases.
llvm-svn: 51223
2008-05-17 19:00:05 +00:00
Chris Lattner
504c367af9 trip count computation deficiency
llvm-svn: 51222
2008-05-17 15:37:38 +00:00
Nick Lewycky
baa90d4eef Unbreak the build.
llvm-svn: 51217
2008-05-17 09:05:22 +00:00
Nick Lewycky
1df40102a9 Constant fold inttoptr and ptrtoint.
llvm-svn: 51216
2008-05-17 09:03:26 +00:00
Nick Lewycky
6f3744c685 Move isTrueWhenEqual to ICmpInst.
llvm-svn: 51215
2008-05-17 07:33:39 +00:00
Dale Johannesen
415dc434d6 Less conservative verison of previous patch,
suggested by Duncan.

llvm-svn: 51211
2008-05-16 23:18:52 +00:00
Dale Johannesen
b2411740b7 Weak functions not declared non-throwing might be
replaced at linktime with a body that throws, even
if the body in this file does not.  Make PruneEH
be more conservative in this case.
g++.dg/eh/weak1.C

llvm-svn: 51207
2008-05-16 21:31:48 +00:00
Eric Christopher
11359e9b1c Add functions to enable adding a single attribute to a function and
its associated call site.

llvm-svn: 51204
2008-05-16 20:39:43 +00:00
Dale Johannesen
16fa5c08cb Record weak external linkage in a case where we were
missing it. gcc.dg/darwin-weakimport-2.c.
Handle common and weak differently for darwin ppc32.

llvm-svn: 51201
2008-05-16 20:09:25 +00:00
Gabor Greif
d61f20217a API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. Legacy interfaces will be in place for some time. (Merge from use-diet branch.)
llvm-svn: 51200
2008-05-16 19:29:10 +00:00
Evan Cheng
538403664e If the result of a BIT_CONVERT is a v1* vector, it doesn't mean its source is a v1* vector.
llvm-svn: 51192
2008-05-16 17:19:05 +00:00
Duncan Sands
e77eede842 Bill pointed out that system headers should be
included after local headers.

llvm-svn: 51187
2008-05-16 09:30:00 +00:00
Duncan Sands
a018f1f47e Silence the compiler warning differently. The
original method caused gcc-4.2 to complain.

llvm-svn: 51186
2008-05-16 09:19:16 +00:00
Evan Cheng
ffbaf56075 Do not dup malloc, vector instructions, etc. Throttle the default theshold way down.
llvm-svn: 51183
2008-05-16 07:55:50 +00:00
Owen Anderson
6fbcec4778 Remove ADCE's ability to delete loops. This ability is now implemented in a
safer manner by loop deletion.

llvm-svn: 51182
2008-05-16 04:34:51 +00:00
Owen Anderson
791223eac7 Clean ups for loop deletion based on Chris' feedback.
Also, use SCEV to determine the trip count of the loop, which is more powerful
and accurate that Loop::getTripCount.

llvm-svn: 51179
2008-05-16 04:32:45 +00:00
Chris Lattner
00e8e1e258 implement PR2328.
llvm-svn: 51176
2008-05-16 02:59:42 +00:00
Dale Johannesen
ebc511c6aa Treat common as distinct from weak global on Darwin x86.
llvm-svn: 51172
2008-05-16 00:52:06 +00:00
Dan Gohman
fe7f6bc9ce Revert the change from r51157 in
test/Verifier/2002-11-05-GetelementptrPointers.ll, which was incorrect.
Instead, fix getIndexedType to not follow pointer types, as
PointerType is a subclass of CompositeType.

llvm-svn: 51171
2008-05-16 00:16:32 +00:00
Dan Gohman
2da4145cd8 Fix a bug in LoopStrengthReduce that caused it to emit IR with
use-before-def. The problem comes up in code with multiple PHIs where
one PHI is being rewritten in terms of the other, but the other needs
to be casted first. LLVM rules requre the cast instruction to be
inserted after any PHI instructions, but when instructions were
inserted to replace the second PHI value with a function of the first,
they were ended up going before the cast instruction. Avoid this
problem by remembering the location of the cast instruction, when one
is needed, and inserting the expansion of the new value after it.

This fixes a bug that surfaced in 255.vortex on x86-64 when
instcombine was removed from the middle of the loop optimization
passes. 

llvm-svn: 51169
2008-05-15 23:26:57 +00:00
Evan Cheng
73dadf21ce Fix typos and comments.
llvm-svn: 51165
2008-05-15 22:13:02 +00:00
Dale Johannesen
8e66b309b4 Allow an extra bit for CommonLinkage.
This changes the .bc file format, but if I understand
how it works correctly, old .bc files continue to
be readable.

llvm-svn: 51161
2008-05-15 20:49:28 +00:00
Nate Begeman
b38ee2e03b Actually scalarize the operand to BIT_CONVERT instead of asking someone to do
something with a v1 type.

llvm-svn: 51160
2008-05-15 20:40:58 +00:00
Dan Gohman
821bf58428 IR support for extractvalue and insertvalue instructions. Also, begin
moving toward making structs and arrays first-class types.

llvm-svn: 51157
2008-05-15 19:50:34 +00:00
Dan Gohman
48ac9aec33 Use static and anonymous namespaces consistently with other passes.
llvm-svn: 51156
2008-05-15 19:43:55 +00:00
Devang Patel
66480d1c07 Remove useless check.
Patch by Matthijs Kooijman.

llvm-svn: 51154
2008-05-15 18:04:29 +00:00
Evan Cheng
d86d86bbdf Disable JIT symbol table for now.
llvm-svn: 51152
2008-05-15 17:31:35 +00:00
Duncan Sands
130254e1ff Use of UINT_MAX requires climits, at least when
compiling with gcc 4.3.

llvm-svn: 51145
2008-05-15 11:22:50 +00:00
Gabor Greif
48ffb6c7dc Fix a bunch of 80col violations that arose from the Create API change. Tweak makefile targets to find these better.
llvm-svn: 51143
2008-05-15 10:04:30 +00:00
Evan Cheng
778a5e27b0 Make use of vector load and store operations to implement memcpy, memmove, and memset. Currently only X86 target is taking advantage of these.
llvm-svn: 51140
2008-05-15 08:39:06 +00:00
Nate Begeman
253fc69ff3 Move the operator new and operator delete out of line. This fixes an issue with
operator new() referring to the static initTags function, which has to be in the 
same linkage unit as any file including User.h.

llvm-svn: 51136
2008-05-15 01:23:11 +00:00
Dale Johannesen
809ad5df81 Don't assume underlying APInt type is limited
to 64 bits.

llvm-svn: 51135
2008-05-14 22:53:25 +00:00
Bill Wendling
c1d9f9604b Situations can arise when you have a function called that returns a 'void', but
is bitcast to return a floating point value. The result of the instruction may
not be used by the program afterwards, and LLVM will happily remove all
instructions except the call. But, on some platforms, if a value is returned as
a floating point, it may need to be removed from the stack (like x87). Thus, we
can't get rid of the bitcast even if there isn't a use of the value.

llvm-svn: 51134
2008-05-14 22:45:20 +00:00
Dale Johannesen
b9d2bc9303 Remove undefined behavior in hex string->APFloat
conversion.  Try 0x1.0000a4p+0f.  Neil, please review.

llvm-svn: 51132
2008-05-14 22:05:31 +00:00
Evan Cheng
e935a1ac40 Use a better idiom to silence compiler warnings.
llvm-svn: 51131
2008-05-14 21:08:07 +00:00
Chris Lattner
3d3dfa7b2c rename SimplifyCFG.cpp -> SimplifyCFGPass.cpp
llvm-svn: 51130
2008-05-14 20:38:44 +00:00
Evan Cheng
d4c4bd4241 Silence warnings.
llvm-svn: 51129
2008-05-14 20:33:21 +00:00
Evan Cheng
9d22a90b0b Really silence compiler warnings.
llvm-svn: 51126
2008-05-14 20:29:30 +00:00
Evan Cheng
1b39709701 Really silence compiler warnings.
llvm-svn: 51123
2008-05-14 20:26:35 +00:00
Dale Johannesen
8edeae6888 CommonLinkage (missed a file)
llvm-svn: 51120
2008-05-14 20:14:09 +00:00
Dale Johannesen
dcdf2760f2 Generated files for CommonLinkage.
llvm-svn: 51119
2008-05-14 20:13:36 +00:00
Dale Johannesen
768b6f281e Add CommonLinkage; currently tentative definitions
are represented as "weak", but there are subtle differences
in some cases on Darwin, so we need both.  The intent
is that "common" will behave identically to "weak" unless
somebody changes their target to do something else.
No functional change as yet.

llvm-svn: 51118
2008-05-14 20:12:51 +00:00
Evan Cheng
e7684b9e91 Silence some compiler warnings.
llvm-svn: 51115
2008-05-14 20:07:51 +00:00
Devang Patel
047ba6df54 Simplify internalize pass. Add test case.
Patch by Matthijs Kooijman!

llvm-svn: 51114
2008-05-14 20:01:01 +00:00
Dan Gohman
cd29e1fa60 When bit-twiddling CondCode values for integer comparisons produces
SETOEQ, is it does with (SETEQ & SETULE), map it to SETEQ.

llvm-svn: 51112
2008-05-14 18:17:09 +00:00
Sanjiv Gupta
7cc26f0421 Detabification. Fixed indentation and spacing.
Changed cout to DOUT, and TODOs to FIXMEs.
Other changes as per coding conventions.

llvm-svn: 51105
2008-05-14 11:31:39 +00:00
Nicolas Geoffray
9f633abc38 Fix typo in ParameterAttribute fields usage. Add an include
to make the Cpp backend output compilable.

llvm-svn: 51095
2008-05-14 07:52:03 +00:00
Sanjiv Gupta
3563f7bc68 Fixed the file description header at the top to remove the developer name.
llvm-svn: 51094
2008-05-14 06:50:01 +00:00
Evan Cheng
95987c2586 Doh. Alignment is in bytes, not in bits.
llvm-svn: 51092
2008-05-14 02:49:43 +00:00
Dan Gohman
f9d5689496 Change target-specific classes to use more precise static types.
This eliminates the need for several awkward casts, including
the last dynamic_cast under lib/Target.

llvm-svn: 51091
2008-05-14 01:58:56 +00:00
Dan Gohman
ffe0b1f40e Whitespace cleanups.
llvm-svn: 51089
2008-05-14 00:43:10 +00:00
Dan Gohman
fe628b229c Make PreVerifyID, IntSigsEnd, and KillSigsEnd const.
llvm-svn: 51088
2008-05-14 00:42:30 +00:00
Dan Gohman
4dc39991f8 Split the loop unroll mechanism logic out into a utility function.
Patch by Matthijs Kooijman!

llvm-svn: 51083
2008-05-14 00:24:14 +00:00
Owen Anderson
6a2ee9af7a Fix Analysis/BasicAA/pure-const-dce.ll. This turned out to be a correctness
bug as well as a missed optimization.  We weren't properly checking for local
dependencies before moving on to non-local ones when doing non-local read-only 
call CSE.

llvm-svn: 51082
2008-05-13 23:18:30 +00:00
Gabor Greif
dd2f5c797d Merge of r51073-51074 from use-diet branch.
Do not rely on std::swap<Use>, provide a (faster) member function instead.
This change is primarily necessitated by MSVC++'s incompatibility with
declaring std::swap<Use> to be a friend of Use.

Also contains some minor tweaks to Use inline functions,
to undo pointless changes that sneaked in with the last merge.

llvm-svn: 51078
2008-05-13 22:51:52 +00:00
Devang Patel
bae88af8c1 Dominance Frontier is cfg only pass.
llvm-svn: 51075
2008-05-13 22:43:21 +00:00
Owen Anderson
5e6431c140 Fix memdep's handling of invokes when finding the dependency of another call
instruction.  This fixes some Ada miscompiles reported in PR2324.

llvm-svn: 51069
2008-05-13 21:25:37 +00:00
Dale Johannesen
676a1d026b Fix for PR 2323, infinite loop in tail dup.
llvm-svn: 51063
2008-05-13 20:06:43 +00:00
Chris Lattner
a11adf725d add a note
llvm-svn: 51062
2008-05-13 19:56:20 +00:00
Evan Cheng
cb56638548 - Fix the pasto in the fix for a previous pasto.
- Incorporate Chris' comment suggestion.

llvm-svn: 51061
2008-05-13 18:59:59 +00:00
Chris Lattner
c9eb6a7d64 add a note
llvm-svn: 51060
2008-05-13 18:48:54 +00:00
Nate Begeman
c290daf581 Fix one more encoding bug.
llvm-svn: 51057
2008-05-13 17:52:09 +00:00
Evan Cheng
cf6928983b - Don't treat anyext 16-bit load as a 32-bit load if it's volatile.
- Correct a pasto.

llvm-svn: 51054
2008-05-13 16:45:56 +00:00
Owen Anderson
7f6db08b5f Make the non-local CSE safety checks slightly more thorough.
llvm-svn: 51035
2008-05-13 13:41:23 +00:00
Sanjiv Gupta
fa065a1455 Adding files for Microchip's PIC16 target.
A brief description about PIC16:
===============================
PIC16 is an 8-bit microcontroller with only one 8-bit register which is the 
accumulator. All arithmetic/load/store operations are 8-bit only.
The architecture has two address spaces: program and data. The program memory 
is divided into 2K pages and the data memory is divided into banks of 128 byte, with only 80 usable bytes, resulting in an non-contiguous data memory. 

It supports direct data memory access (by specifying the address as part of the instruction) and indirect data and program memory access (in an unorthodox fashion which utilize a 16 bit pointer register). 

Two classes of registers exist: (8-bit class which is only one
accumulator) (16-bit class, which contains one or more 16 bit
pointer(s))

llvm-svn: 51027
2008-05-13 09:02:57 +00:00
Evan Cheng
9e15622879 Instead of a vector load, shuffle and then extract an element. Load the element from address with an offset.
pshufd $1, (%rdi), %xmm0
        movd %xmm0, %eax
=>
        movl 4(%rdi), %eax

llvm-svn: 51026
2008-05-13 08:35:03 +00:00
Owen Anderson
c54c61634c Add support for non-local CSE of read-only calls.
llvm-svn: 51024
2008-05-13 08:17:22 +00:00
Gabor Greif
22afb1f8f0 Derive GetResultInst from UnaryInstruction, this simplifies code and removes a FIXME.
llvm-svn: 51023
2008-05-13 07:09:08 +00:00
Dan Gohman
138a53b303 Change class' public PassInfo variables to by initialized with the
address of the PassInfo directly instead of calling getPassInfo.
This eliminates a bunch of dynamic initializations of static data.

Also, fold RegisterPassBase into PassInfo, make a bunch of its
data members const, and rearrange some code to initialize data
members in constructors instead of using setter member functions.

llvm-svn: 51022
2008-05-13 02:05:11 +00:00
Nate Begeman
b4412e7652 80 col / tabs fixes
llvm-svn: 51021
2008-05-13 01:48:26 +00:00
Nate Begeman
b9a3d141aa Fix and encoding error in the psrad xmm, imm8 instruction.
llvm-svn: 51020
2008-05-13 01:47:52 +00:00
Evan Cheng
e4ee4c2870 On x86, it's safe to treat i32 load anyext as a normal i32 load. Ditto for i8 anyext load to i16.
llvm-svn: 51019
2008-05-13 00:54:02 +00:00
Dan Gohman
bab18cae46 Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.

llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Nate Begeman
5d939498c3 Teach Legalize how to scalarize VSETCC
Teach X86 a few more vsetcc patterns.  Custom lowering for unsupported ones is next.

llvm-svn: 51009
2008-05-12 23:09:43 +00:00
Evan Cheng
fcbdc8bd6e Xform bitconvert(build_pair(load a, load b)) to a single load if the load locations are at the right offset from each other.
llvm-svn: 51008
2008-05-12 23:04:07 +00:00
Dale Johannesen
b4da55c4a3 Be more aggressive about tail-merging small blocks
if those blocks consist entirely of common instructions;
merging will not add an extra branch in this case.

llvm-svn: 51006
2008-05-12 22:53:12 +00:00
Bill Wendling
2f2610cf51 Constify isSourceDefinedByImplicitDef function. Otherwise, just formatting
changes that don't change functionality.

llvm-svn: 51004
2008-05-12 22:15:05 +00:00
Bill Wendling
646f3458c4 Constify the machine instruction passed into the
"is{Trivially,Really}ReMaterializable" methods.

llvm-svn: 51001
2008-05-12 20:54:26 +00:00
Nate Begeman
2ae55cecc6 Initial X86 codegen support for VSETCC.
llvm-svn: 51000
2008-05-12 20:34:32 +00:00
Dale Johannesen
25896f8e93 Further rework of tail merge algorithm. Not quite
semantically identical, but little difference in
either results or execution speed; but it's much
easier to read, at least IMO.

llvm-svn: 50999
2008-05-12 20:33:57 +00:00
Nate Begeman
a3a9e89b61 Simplify some checks
llvm-svn: 50998
2008-05-12 20:33:52 +00:00
Dan Gohman
efa0925915 Fix a copy+paste bug; pseudo-instructions shouldn't have
encoding information.

llvm-svn: 50997
2008-05-12 20:22:45 +00:00
Nate Begeman
e9476924d9 Pointer comparisons should use icmp, not vicmp
llvm-svn: 50996
2008-05-12 20:16:55 +00:00
Owen Anderson
0256b368f8 Go back to passing the analyses around as parameters.
llvm-svn: 50995
2008-05-12 20:15:55 +00:00
Nate Begeman
b72a398339 Pointer comparisons should be handled by icmp, not vicmp :)
llvm-svn: 50994
2008-05-12 20:11:05 +00:00
Nate Begeman
6258a36fe3 Hard code CmpInst back to i1 for now while I go track down what in the bitcode reader/writer is assuming i1
This was breaking a bunch of tests

llvm-svn: 50992
2008-05-12 20:01:56 +00:00
Evan Cheng
c7e9acfed7 Refactor isConsecutiveLoad from X86 to TargetLowering so DAG combiner can make use of it.
llvm-svn: 50991
2008-05-12 19:56:52 +00:00
Bill Wendling
f3c4b7fbb5 Revert the previous commit. Go ahead and hoist rematerializable instructions.
llvm-svn: 50990
2008-05-12 19:47:18 +00:00
Nate Begeman
11c0772a30 Add support for vicmp/vfcmp codegen, more legalize support coming.
This is necessary to unbreak the build.

llvm-svn: 50988
2008-05-12 19:40:03 +00:00
Bill Wendling
74cabebb44 One real change - don't hoist something that's trivially rematerializable. It's
possible for it to produce worse code than before.

The rest of this patch is code cleanup.

llvm-svn: 50987
2008-05-12 19:38:32 +00:00
Nate Begeman
e2b25610bb Fix build breakage
llvm-svn: 50986
2008-05-12 19:23:22 +00:00
Nate Begeman
b5b1e1353b Add two new instructions to the llvm IR, vicmp and vfcmp. see updated LangRef
for details.  CodeGen support coming in a follow up patch

llvm-svn: 50985
2008-05-12 19:01:56 +00:00
Dan Gohman
4224373cc8 Make firstEightPowers const.
llvm-svn: 50975
2008-05-12 16:38:14 +00:00
Dan Gohman
4f0d9d18c3 Update comments.
llvm-svn: 50974
2008-05-12 16:34:30 +00:00
Dan Gohman
8212eaa43a Fix a compile error on compilers that still want a return value
in a non-void function that calls abort.

llvm-svn: 50969
2008-05-12 16:17:19 +00:00
Dan Gohman
6fcb44e191 Fix a missing break in the ISD::FLT_ROUNDS_ handling. Patch by giuma!
llvm-svn: 50967
2008-05-12 16:07:15 +00:00
Owen Anderson
3f2d12126f Move the various analyses used by GVN into static variables so we don't have to keep passing them around or refetching them.
llvm-svn: 50963
2008-05-12 08:15:27 +00:00
Chris Lattner
0eb3dfb3b0 prune #includes.
llvm-svn: 50962
2008-05-12 01:13:53 +00:00
Chris Lattner
f459fcde61 Add a new SparsePropagation analysis utility, which allows you to do
SCCP like sparse lattice analysis with relative ease.  Just pick your
lattice function and implement the transfer function and you're good.
Just make sure you don't break monotonicity ;-)

llvm-svn: 50961
2008-05-12 01:12:24 +00:00
Nick Lewycky
6bc321fbdf Make constructors target-specific. This fixes problems where the path would
include backslashes on Windows. This should fix llvm-ld problems on win32.

llvm-svn: 50960
2008-05-11 17:37:40 +00:00
Anton Korobeynikov
ad83aeb489 Add note
llvm-svn: 50959
2008-05-11 14:33:15 +00:00
Chris Lattner
b700ffd977 Fix various DOUTs to not call the extremely expensive Value::getName()
method.  DOUT statements are disabled when assertions are off, but the
side effects of getName() are still evaluated.  Just call getNameSTart,
which is close enough and doesn't cause heap traffic.

llvm-svn: 50958
2008-05-11 01:55:59 +00:00
Chris Lattner
858c3299c1 Simplify code by using SwitchInst::findCaseValue instead of reimplementing it.
llvm-svn: 50957
2008-05-10 23:56:54 +00:00
Anton Korobeynikov
0f39a96feb Fix linking of internal aliases
llvm-svn: 50950
2008-05-10 14:41:43 +00:00
Gabor Greif
49bf1a4cf6 merge of use-diet branch to trunk
llvm-svn: 50943
2008-05-10 08:32:32 +00:00
Evan Cheng
c19c639ad7 When transforming a vector_shuffle to a load, the base address must not be an undef.
llvm-svn: 50940
2008-05-10 06:46:49 +00:00
Dan Gohman
4b23d9e60a For now, abort when an ISD::VAARG is encountered on x86-64, rather
than silently generate invalid code.

llvm-gcc does not currently use VAArgInst; it lowers va_arg in the
front-end.

llvm-svn: 50930
2008-05-10 01:26:14 +00:00
Evan Cheng
6a3fa28b38 Some clean up.
llvm-svn: 50929
2008-05-10 00:59:18 +00:00
Evan Cheng
79230955a8 If movl top bits are undef, let it be selected to movlps, etc.
llvm-svn: 50928
2008-05-10 00:58:41 +00:00
Evan Cheng
cf4d5567d5 If all sources of a PHI node are defined by an implicit_def, just emit an implicit_def instead of a copy.
llvm-svn: 50927
2008-05-10 00:17:50 +00:00
Bill Wendling
89c91f81ae Cosmetic changes:
- Comment fixes.
 - Moar whitespace.
 - Made ivars "private" by default.
No functionality change.

llvm-svn: 50926
2008-05-10 00:12:52 +00:00
Evan Cheng
2adea48f7e Add a pattern to do move the low element of a v4f32 and zero extend the rest.
llvm-svn: 50922
2008-05-09 23:37:55 +00:00
Dale Johannesen
a422bcbec2 Remove an evil vector bool. Cosmetic refactoring,
no functional change.

llvm-svn: 50921
2008-05-09 23:28:24 +00:00
Evan Cheng
3493e43afd Handle a few more cases of folding load i64 into xmm and zero top bits.
Note, some of the code will be moved into target independent part of DAG combiner in a subsequent patch.

llvm-svn: 50918
2008-05-09 21:53:03 +00:00
Dale Johannesen
09a45f2ca3 Rewrite tail merging algorithm to handle the
case where there are multiple blocks with a large
number of common tail instructions more efficiently
(compile time optimization).

llvm-svn: 50916
2008-05-09 21:24:35 +00:00
Torok Edwin
9b85a8dc92 put LibCallAliasAnalysis into anonymous namespace to avoid
clashes on ::X

llvm-svn: 50912
2008-05-09 20:35:45 +00:00
Chris Lattner
b6db834a47 don't sink invokes, even if they are readonly. This fixes a
crash on kimwitu++.

llvm-svn: 50901
2008-05-09 15:07:33 +00:00
Duncan Sands
dd33da4795 Fix a type and formatting.
llvm-svn: 50900
2008-05-09 12:20:10 +00:00
Chris Lattner
02ca137915 Implement PR2298. This transforms:
~x < ~y --> y < x
   -x == -y --> x == y

llvm-svn: 50882
2008-05-09 05:19:28 +00:00
Chris Lattner
8ec87dd865 restore doxygen comment.
llvm-svn: 50881
2008-05-09 04:43:13 +00:00
Anton Korobeynikov
0f467b9965 Check for validity of aliasee pointer before dereference.
llvm-svn: 50878
2008-05-08 23:11:06 +00:00
Evan Cheng
f824b47188 Use movq to move low half of XMM register and zero-extend the rest.
llvm-svn: 50874
2008-05-08 22:35:02 +00:00
Chris Lattner
e3970f1e95 conservatively say that volatile stores read memory.
llvm-svn: 50872
2008-05-08 21:58:49 +00:00
Chris Lattner
1e4afe8fa7 store can't read from memory.
llvm-svn: 50869
2008-05-08 21:47:43 +00:00
Chris Lattner
dfd5ee9b42 Remove dead return. Thanks to Bill for the review!
llvm-svn: 50863
2008-05-08 18:26:56 +00:00
Gordon Henriksen
846171a09e Improve pass documentation and comments.
Patch by Matthijs Kooijman!

llvm-svn: 50861
2008-05-08 17:46:35 +00:00
Chris Lattner
4c1ef3628b More than just loads can read from memory: readonly calls like strlen
also need to be checked for memory modifying instructions before we
can sink them.  THis fixes the second half of PR2297.

llvm-svn: 50860
2008-05-08 17:37:37 +00:00
Chris Lattner
cba8b4c7e8 Make instcombine's DSE respect loads as well as stores. It is not safe to
delete the first store in:

store x -> p
load p
store y -> p

This is for PR2297.

llvm-svn: 50859
2008-05-08 17:20:30 +00:00
Chris Lattner
3c362081d5 add a new Instruction::mayReadFromMemory predicate, make
Instruction::mayWriteToMemory stronger for invokes.

llvm-svn: 50858
2008-05-08 17:16:51 +00:00
Devang Patel
3dce0e9d2e Check linkage.
llvm-svn: 50851
2008-05-08 15:08:39 +00:00
Duncan Sands
5775b74165 Get exception handling working again on 64 bit
Darwin.  This is a hack of course, but it does
at least look at the right thing: gotpcrel means
that this is already an offset, so an explicit
offset is not needed (and wrong).  I think this
is good enough for the moment: Anton is working
on something better.

llvm-svn: 50850
2008-05-08 12:33:11 +00:00
Chris Lattner
9011ceba89 Add support for constant folding the 'offsetof' pattern even if the
base is not zero.  This fixes test/C++Frontend/2008-05-07-CrazyOffsetOf.cpp

llvm-svn: 50840
2008-05-08 04:54:43 +00:00
Evan Cheng
f97e716511 Handle vector move / load which zero the destination register top bits (i.e. movd, movq, movss (addr), movsd (addr)) with X86 specific dag combine.
llvm-svn: 50838
2008-05-08 00:57:18 +00:00
Anton Korobeynikov
ddb93e7a02 Turn StripPointerCast() into a method
llvm-svn: 50836
2008-05-07 22:54:15 +00:00
Chris Lattner
3ee18d7c51 Add a new LibCallAliasAnalysis pass, which is parameterized
by an instance of LibCallInfo to provide mod/ref info of
standard library functions.  This is powerful enough to
say that 'sqrt' is readonly except that it modifies errno,
or that "printf doesn't store to memory unless the %n
constraint is present" etc.

llvm-svn: 50827
2008-05-07 19:53:05 +00:00
Duncan Sands
6f4e916c6a Output correct exception handling and frame info
on x86-64 linux.  This causes no regressions on
32 bit linux and 32 bit ppc.  More tests pass
on 64 bit ppc with no regressions.  I didn't
turn on eh on 64 bit linux because the intrinsics
needed to compile the eh runtime aren't done
yet.  But if you turn it on and link with the
mainline runtime then eh seems to work fine
on x86-64 linux with this patch.  Thanks to
Dale for testing.  The main point of the patch
is that if you output that some object is
encoded using 4 bytes you had better not output
8 bytes for it: the patch makes everything
consistent.

llvm-svn: 50825
2008-05-07 19:11:09 +00:00
Chris Lattner
e70ff7b21c Add a new interface for describing the behavior of library calls. This
Currently is sufficient to describe mod/ref behavior but will hopefully
eventually be extended for other purposes.

This isn't used by anything yet.

llvm-svn: 50820
2008-05-07 18:21:13 +00:00
Evan Cheng
c86c035346 Yet another nasty spiller bug.
%ecx = op
store %cl<kill>, (addr)
(addr) = op %al

It's not safe to unfold the last operand and eliminate store even though %cl is marked kill. It's a sub-register use which means one of its super-register(s) may be used below.

llvm-svn: 50794
2008-05-07 00:49:28 +00:00
Dan Gohman
6ea87fa437 Fix a bug in the ComputeMaskedBits logic for multiply.
llvm-svn: 50793
2008-05-07 00:35:55 +00:00
Anton Korobeynikov
ef80f5dbca If weak GlobalVariable was bitcast'ed to different type during linking
we will need to strip all casts for intializer lookup.

llvm-svn: 50776
2008-05-06 22:52:54 +00:00
Anton Korobeynikov
90ee6d6616 Make StripPointerCast a common function (should we mak it method of Value instead?)
llvm-svn: 50775
2008-05-06 22:52:30 +00:00
Owen Anderson
d82a778214 We need to update PHIs containing the exiting block, not the exit block. We really should come up with better names for these.
llvm-svn: 50770
2008-05-06 20:55:16 +00:00
Devang Patel
c5aee6c84d Fix typo.
llvm-svn: 50713
2008-05-06 05:40:11 +00:00
Nick Lewycky
6705f7577b Fix typo and indentation.
llvm-svn: 50706
2008-05-06 04:03:18 +00:00
Nick Lewycky
2121ef05f4 Fix renamePathOnDisk on Win32, patch from David Leon. This fixes problems with
llvm-ar being unable to rename files.

llvm-svn: 50702
2008-05-06 03:42:21 +00:00
Chris Lattner
a75e149023 fix typo Duncan noticed
llvm-svn: 50699
2008-05-06 02:31:18 +00:00
Chris Lattner
d46c148cf8 Match things like 'armv5tejl-unknown-linux-gnu' for PR2290
llvm-svn: 50698
2008-05-06 02:29:28 +00:00
Dan Gohman
d4a670284c Make several variable declarations static.
llvm-svn: 50696
2008-05-06 01:53:16 +00:00
Dan Gohman
a84b75df17 Remove uses of llvm/System/IncludeFile.h that are no longer needed.
llvm-svn: 50695
2008-05-06 01:32:53 +00:00
Dan Gohman
0ad61a718c Instead of enumerating each opcode that isn't handled that
ComputeMaskedBits handles, just use a 'default:'. This avoids
TargetLowering's list getting out of date with SelectionDAG's.

llvm-svn: 50693
2008-05-06 00:53:29 +00:00
Dan Gohman
faf9df7227 Correct the value of LowBits in srem and urem handling in
ComputeMaskedBits.

llvm-svn: 50692
2008-05-06 00:51:48 +00:00
Dan Gohman
f7f3f7ab8f Fix a broken doxygen comment, and reword it for clarity.
llvm-svn: 50687
2008-05-06 00:20:10 +00:00
Chris Lattner
9f4f2444ea add a micro optzn.
llvm-svn: 50681
2008-05-05 23:19:45 +00:00
Mon P Wang
34b3f18a70 Improved generated code for atomic operators
llvm-svn: 50677
2008-05-05 22:56:23 +00:00
Evan Cheng
44d49e72a1 Code clean up. No functionality change.
llvm-svn: 50675
2008-05-05 22:12:23 +00:00
Bill Wendling
5234187c50 Fix: Some classes were derived from a class in an anonymous namespace, but they
themselves weren't in the anonymous namespace.

llvm-svn: 50673
2008-05-05 21:37:59 +00:00
Chris Lattner
50d16c2939 Fix a crash when threading a block that includes a MRV call result.
DemoteRegToStack doesn't work with MRVs yet, because it relies on the
ability to load/store things.

This fixes PR2285.

llvm-svn: 50667
2008-05-05 20:21:22 +00:00
Mon P Wang
84a269e023 Added addition atomic instrinsics and, or, xor, min, and max.
llvm-svn: 50663
2008-05-05 19:05:59 +00:00
Dan Gohman
4a674dc536 Fix IsLinux being uninitialized on non-Linux targets.
llvm-svn: 50660
2008-05-05 18:43:07 +00:00
Evan Cheng
d9353009b7 Fix more -Wshorten-64-to-32 warnings.
llvm-svn: 50659
2008-05-05 18:30:58 +00:00
Anton Korobeynikov
12c48230f9 Fix 80col violation
llvm-svn: 50654
2008-05-05 17:08:59 +00:00
Dan Gohman
3dfc43343b Fix a bug in the ELF writer that caused it to produce malformed
ELF headers. The ELF writer still isn't generally usable though.

llvm-svn: 50652
2008-05-05 16:48:32 +00:00
Dan Gohman
8ee7bf053e Use a dedicated IsLinux flag instead of an ELFLinux TargetType.
llvm-svn: 50649
2008-05-05 16:11:31 +00:00
Dan Gohman
c860d9c77c Add AsmPrinter support for emitting a directive to declare that
the code being generated does not require an executable stack.

Also, add target-specific code to make use of this on Linux
on x86. 

llvm-svn: 50634
2008-05-05 00:28:39 +00:00
Anton Korobeynikov
04c974b1b2 Add General Dynamic TLS model for X86-64. Some parts looks really ugly (look for tlsaddr pattern),
but should work. Work is in progress, more models will follow

llvm-svn: 50630
2008-05-04 21:36:32 +00:00
Chris Lattner
57a81e6804 regenerate
llvm-svn: 50621
2008-05-04 17:18:47 +00:00
Gordon Henriksen
6f33fd36ab Use (void) instead of () in C code.
llvm-svn: 50620
2008-05-04 12:55:34 +00:00
Evan Cheng
a7747df955 Select vector shift with non-immediate i32 shift amount operand by first moving the operand into the right register.
llvm-svn: 50619
2008-05-04 09:15:50 +00:00
Torok Edwin
a68816f876 processStore may delete the instruction, avoid
using dyn_cast<> on already freed memory.

llvm-svn: 50618
2008-05-04 08:51:25 +00:00
Torok Edwin
d016bb2685 Implement destructor for PostDominatorTree to eliminate a memory leak.
llvm-svn: 50607
2008-05-03 20:25:26 +00:00
Devang Patel
e8518dd7ff Handle multiple return values.
llvm-svn: 50604
2008-05-03 01:12:15 +00:00
Evan Cheng
c1c2adbfc6 Add separate intrinsics for MMX / SSE shifts with i32 integer operands. This allow us to simplify the horribly complicated matching code.
llvm-svn: 50601
2008-05-03 00:52:09 +00:00