Commit Graph

1886 Commits

Author SHA1 Message Date
Chris Lattner
c4ced268d8 implement CodeGen/PowerPC/div-2.ll:test2-4 by propagating zero bits through
C-X's


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23662 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-07 15:30:32 +00:00
Chris Lattner
6c4dad0b8b fix indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23660 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-07 06:37:02 +00:00
Chris Lattner
094c8fcd14 Turn sdivs into udivs when we can prove the sign bits are clear. This
implements CodeGen/PowerPC/div-2.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23659 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-07 06:10:46 +00:00
Chris Lattner
cf5c79b34f silence a bogus GCC warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23646 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-06 17:39:10 +00:00
Chris Lattner
8a61a7524a Fix the LLC regressions on X86 last night. In particular, when undoing
previous copy elisions and we discover we need to reload a register, make
sure to use the regclass of the original register for the reload, not the
class of the current register.  This avoid using 16-bit loads to reload 32-bit
values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23645 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-06 17:19:06 +00:00
Chris Lattner
32fca00a23 Make the legalizer completely non-recursive
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23642 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-06 01:20:27 +00:00
Nate Begeman
0558f61b0c Let the combiner handle more cases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23641 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-05 21:44:43 +00:00
Nate Begeman
829cb81806 Remove some bad code from Legalize
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23640 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-05 21:44:10 +00:00
Nate Begeman
e17daebb30 Check in some more DAGCombiner pieces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23639 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-05 21:43:42 +00:00
Chris Lattner
22480c4350 Fix a bug in the local spiller, where we could take code like this:
store r12 -> [ss#2]
  R3 = load [ss#1]
  use R3
  R3 = load [ss#2]
  R4 = load [ss#1]

and turn it into this code:

  store R12 -> [ss#2]
  R3 = load [ss#1]
  use R3
  R3 = R12
  R4 = R3    <- oops!

The problem was that promoting R3 = load[ss#2] to a copy missed the fact that
the instruction invalidated R3 at that point.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23638 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-05 18:30:19 +00:00
Chris Lattner
3ea0b47f81 implement visitBR_CC so that PowerPC/inverted-bool-compares.ll passes
with the dag combiner.  This speeds up espresso by 8%, reaching performance
parity with the dag-combiner-disabled llc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23636 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-05 06:47:48 +00:00
Chris Lattner
ad13715ed4 fix some pastos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23635 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-05 06:37:22 +00:00
Chris Lattner
9503859c54 Add a new HandleNode class, which is used to handle (haha) cases in the
dead node elim and dag combiner passes where the root is potentially updated.
This fixes a fixme in the dag combiner.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23634 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-05 06:35:28 +00:00
Chris Lattner
5c46f74ec7 Implement the code for PowerPC/inverted-bool-compares.ll, even though it
that testcase still does not pass with the dag combiner.  This is because
not all forms of br* are folded yet.

Also, when we combine a node into another one, delete the node immediately
instead of waiting for the node to potentially come up in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23632 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-05 06:11:08 +00:00
Chris Lattner
d48050aa15 make sure that -view-isel-dags is the input to the isel, not the input to
the second phase of dag combining


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23631 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-05 06:09:10 +00:00
Chris Lattner
91559026d3 Fix a crash compiling Olden/tsp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23630 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-05 04:45:43 +00:00
Jim Laskey
9d528dc2b4 Reverting to version - until problem isolated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23622 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-04 16:41:51 +00:00
Nate Begeman
1aa1972c63 Fix some faulty logic in the libcall inserter.
Since calls return more than one value, don't bail if one of their uses
happens to be a node that's not an MVT::Other when following the chain
from CALLSEQ_START to CALLSEQ_END.

Once we've found a CALLSEQ_START, we can just return; there's no need to
tail-recurse further up the graph.

Most importantly, just because something only has one use doesn't mean we
should use it's one use to follow from start to end.  This faulty logic
caused us to follow a chain of one-use FP operations back to a much earlier
call, putting a cycle in the graph from a later start to an earlier end.

This is a better fix that reverting to the workaround committed earlier
today.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23620 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-04 02:10:55 +00:00
Nate Begeman
27d404ccd1 Add back a workaround that fixes some breakages from chris's last change.
Neither of us have yet figured out why this code is necessary, but stuff
breaks if its not there.  Still tracking this down...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23617 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-04 00:37:37 +00:00
Jim Laskey
8ba732bb1c Refactor gathering node info and emission.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23610 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-03 12:30:32 +00:00
Chris Lattner
6db0756f02 clean up this code a bit, no functionality change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23609 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-03 07:22:07 +00:00
Chris Lattner
53a79aaae9 Break the body of the loop out into a new method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23606 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-03 04:47:08 +00:00
Chris Lattner
ab510a76d6 Fix a problem where the legalizer would run out of stack space on extremely
large basic blocks because it was purely recursive.  This switches it to an
iterative/recursive hybrid.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23596 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-02 17:49:46 +00:00
Chris Lattner
dcd5abc70c silence a bogus warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23595 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-02 16:30:51 +00:00
Chris Lattner
a3638c0f1f Add assertions to the trivial scheduler to check that the value types match
up between defs and uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23590 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-02 07:10:55 +00:00
Chris Lattner
14765be0bc Codegen CopyFromReg using the regclass that matches the valuetype of the
destination vreg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23586 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-02 06:34:16 +00:00
Chris Lattner
505277a7f5 Add some very paranoid checking for operand/result reg class matchup
For instructions that define multiple results, use the right regclass
to define the result, not always the rc of result #0


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23580 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-01 07:45:09 +00:00
Jeff Cohen
2aeaf4e839 Fix VC++ warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23579 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-01 03:57:14 +00:00
Chris Lattner
37345fe3cd add a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23575 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-01 00:17:07 +00:00
Jim Laskey
22f6212e9f typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23574 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-01 00:08:23 +00:00
Jim Laskey
41755e2c7e 1. Simplify the gathering of node groups.
2. Printing node groups when displaying nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23573 91177308-0d34-0410-b5e6-96231b3b80d8
2005-10-01 00:03:07 +00:00
Jim Laskey
b6d4c2cf2d 1. Made things node-centric (from operand).
2. Added node groups to handle flagged nodes.

3. Started weaning simple scheduling off existing emitter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23566 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-30 19:15:27 +00:00
Chris Lattner
8fb040e584 now that we have a reg class to spill with, get this info from the regclass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23559 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-30 17:19:22 +00:00
Chris Lattner
80a4f169b4 Now that we have getCalleeSaveRegClasses() info, use it to pass the register
class into the spill/reload methods.  Targets can now rely on that argument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23556 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-30 16:59:07 +00:00
Chris Lattner
bf9716b9c4 Change this code ot pass register classes into the stack slot spiller/reloader
code.  PrologEpilogInserter hasn't been updated yet though, so targets cannot
use this info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23536 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-30 01:29:00 +00:00
Chris Lattner
473a99073c Fix two bugs in my patch earlier today that broke int->fp conversion on X86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23522 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-29 06:44:39 +00:00
Jeff Cohen
fef80f43e0 Silence VC++ redeclaration warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23516 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-29 01:59:49 +00:00
Chris Lattner
01b3d73c20 Add FP versions of the binary operators, keeping the int and fp worlds seperate.
Though I have done extensive testing, it is possible that this will break
things in configs I can't test.  Please let me know if this causes a problem
and I'll fix it ASAP.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23504 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-28 22:28:18 +00:00
Chris Lattner
6c38b33613 If the target prefers it, use _setjmp/_longjmp should be used instead of setjmp/longjmp for llvm.setjmp/llvm.longjmp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23481 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 22:15:53 +00:00
Chris Lattner
8e6be8b921 initialize new flag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23480 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 22:13:56 +00:00
Jim Laskey
5324fec644 Remove some redundancies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23469 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-27 17:32:45 +00:00
Jim Laskey
e6b90fba4a Addition of a simple two pass scheduler. This version is currently hacked up
for testing and will require target machine info to do a proper scheduling.
The simple scheduler can be turned on using -sched=simple (defaults
to -sched=none)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23455 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 21:57:04 +00:00
Chris Lattner
5ae7911b24 Turn (X^C1) == C2 into X == C1^C2 iff X&~C1 = 0 (and move a function)
This happens all the time on PPC for bool values, e.g. eliminating a xori
in inverted-bool-compares.ll.

This should be added to the dag combiner as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23403 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 00:55:52 +00:00
Chris Lattner
3c3fe462f7 Expose the LiveInterval interfaces as public headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23400 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-21 04:19:09 +00:00
Nate Begeman
44728a7bb6 Stub out the rest of the DAG Combiner. Just need to fill in the
select_cc bits and then wrap it in a convenience function for  use with
regular select.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23389 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-19 22:34:01 +00:00
Chris Lattner
cea8688ee4 Teach the local spiller to turn stack slot loads into register-register copies
when possible, avoiding the load (and avoiding the copy if the value is already
in the right register).

This patch came about when I noticed code like the following being generated:

  store R17 -> [SS1]
  ...blah...
  R4 = load [SS1]

This was causing an LSU reject on the G5.  This problem was due to the register
allocator folding spill code into a reg-reg copy (producing the load), which
prevented the spiller from being able to rewrite the load into a copy, despite
the fact that the value was already available in a register.  In the case
above, we now rip out the R4 load and replace it with a R4 = R17 copy.

This speeds up several programs on X86 (which spills a lot :) ), e.g.
smg2k from 22.39->20.60s, povray from 12.93->12.66s, 168.wupwise from
68.54->53.83s (!), 197.parser from 7.33->6.62s (!), etc.  This may have a larger
impact in some cases on the G5 (by avoiding LSU rejects), though it probably
won't trigger as often (less spilling in general).

Targets that implement folding of loads/stores into copies should implement
the isLoadFromStackSlot hook to get this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23388 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-19 06:56:21 +00:00
Nate Begeman
452d7bebaa More DAG combining. Still need the branch instructions, and select_cc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23371 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-16 00:54:12 +00:00
Chris Lattner
fa57702388 If a function has liveins, and if the target requested that they be plopped
into particular vregs, emit copies into the entry MBB.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23331 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-13 19:30:54 +00:00
Chris Lattner
13d58e71b7 Allow targets to say they don't support truncstore i1 (which includes a mask
when storing to an 8-bit memory location), as most don't.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23303 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-10 00:20:18 +00:00
Chris Lattner
a500fc681d Add a missing #include, patch courtesy of Baptiste Lepilleur.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23302 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-09 23:53:39 +00:00
Chris Lattner
3ec5d74fc5 Fix a problem duraid encountered on itanium where this folding:
select (x < y), 1, 0 -> (x < y) incorrectly: the setcc returns i1 but the
select returned i32.  Add the zero extend as needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23301 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-09 23:00:07 +00:00
Chris Lattner
08addbd477 Fix a crash viewing dags that have target nodes in them
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23300 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-09 22:35:03 +00:00
Chris Lattner
50ea01ed5b Use continue in the use-processing loop to make it clear what the early exits
are, simplify logic, and cause things to not be nested as deeply.  This also
uses MRI->areAliases instead of an explicit loop.

No functionality change, just code cleanup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23296 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-09 20:29:51 +00:00
Nate Begeman
39ee1ac7e5 Last round of 2-node folds from SD.cpp. Will move on to 3 node ops such
as setcc and select next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23295 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-09 19:49:52 +00:00
Chris Lattner
ceb0a52231 remove debugging code *slaps head*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23294 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-09 19:19:20 +00:00
Chris Lattner
b11443dc84 When spilling a live range that is used multiple times by one instruction,
only add a reload live range once for the instruction.  This is one step
towards fixing a regalloc pessimization that Nate notice, but is later undone
by the spiller (so no code is changed).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23293 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-09 19:17:47 +00:00
Nate Begeman
223df2269d Move yet more folds over to the dag combiner from sd.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23278 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-08 20:18:10 +00:00
Nate Begeman
9980119270 Another round of dag combiner changes. This fixes some missing XOR folds
as well as fixing how we replace old values with new values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23260 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-07 23:25:52 +00:00
Chris Lattner
dc6e2e0a5f Fix a bug that Tzu-Chien Chiu noticed: live interval analysis does NOT
preserve livevar


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23259 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-07 17:34:39 +00:00
Nate Begeman
f89d78d7c7 Implement a common missing fold, (add (add x, c1), c2) -> (add x, c1+c2).
This restores all of stanford to being identical with and without the dag
combiner with the add folding turned off in sd.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23258 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-07 16:09:19 +00:00
Chris Lattner
1e111c7bbb Fix a bug nate ran into with replacealluseswith. In the recursive cse case,
we were losing a node, causing an assertion to fail.  Now we eagerly delete
discovered CSE's, and provide an optional vector to keep track of these
discovered equivalences.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23255 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-07 05:37:01 +00:00
Nate Begeman
2300f55046 Add an option to the DAG Combiner to enable it for beta runs, and turn on
that option for PowerPC's beta.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23253 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-07 00:15:36 +00:00
Nate Begeman
83e75ecd27 Next round of DAGCombiner changes. This version now passes all the tests
I have run so far when run before Legalize.  It still needs to pick up the
SetCC folds, and nodes that use SetCC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23243 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-06 04:43:02 +00:00
Chris Lattner
6a8a21ced4 Fix a checking failure in gs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23235 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-03 01:04:40 +00:00
Nate Begeman
646d7e2727 Next round of DAG Combiner changes. Just need to support multiple return
values, and then we should be able to hook it up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23231 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 21:18:40 +00:00
Chris Lattner
6fdcb250d5 Clean up some code from the last checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23229 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 20:32:45 +00:00
Chris Lattner
99c25b86aa Fix a bug in legalize where it would emit two calls to libcalls that return
i64 values on targets that need that expanded to 32-bit registers.  This fixes
PowerPC/2005-09-02-LegalizeDuplicatesCalls.ll and speeds up 189.lucas from
taking 122.72s to 81.96s on my desktop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23228 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 20:26:58 +00:00
Chris Lattner
70b9b1098a Make sure to auto-cse nullary ops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23224 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 19:36:17 +00:00
Chris Lattner
6621e3b963 Fix some buggy logic where we would try to remove nodes with two operands
from the binary ops map, even if they had multiple results.  This latent bug
caused a few failures with the dag isel last night.

To prevent stuff like this from happening in the future, add some really
strict checking to make sure that the CSE maps always match up with reality!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23221 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 19:15:44 +00:00
Chris Lattner
fd88f64934 Don't create zero sized stack objects even for array allocas with a zero
number of elements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23219 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 18:41:28 +00:00
Chris Lattner
a639a43602 Fix the release build, noticed by Eric van Riet Paap
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23215 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 07:09:28 +00:00
Chris Lattner
08951a32fb Make sure to legalize assert[zs]ext's operand correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23208 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 01:15:01 +00:00
Chris Lattner
5ab6f5fe66 Teach live intervals to not crash on dead livein regs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23206 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 00:20:32 +00:00
Chris Lattner
fab08875b7 For values that are live across basic blocks and need promotion, use ANY_EXTEND
instead of ZERO_EXTEND to eliminate extraneous extensions.  This eliminates
dead zero extensions on formal arguments and other cases on PPC, implementing
the newly tightened up test/Regression/CodeGen/PowerPC/small-arguments.ll test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23205 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 00:19:37 +00:00
Chris Lattner
13c78e2e5f legalize ANY_EXTEND appropriately
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23204 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 00:18:10 +00:00
Chris Lattner
4ed11b4b79 Add support for ANY_EXTEND and add a few minor folds for it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23203 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 00:17:32 +00:00
Nate Begeman
39f60a2302 Fix some code in the current node combining code, spotted when it was moved
over to DAGCombiner.cpp

1. Don't assume that SetCC returns i1 when folding (xor (setcc) constant)
2. Don't duplicate code in folding AND with AssertZext that is handled by
   MaskedValueIsZero


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23196 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-01 23:25:49 +00:00
Nate Begeman
4ebd805c6a Implement first round of feedback from chris (there's still a couple things
left to do).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23195 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-01 23:24:04 +00:00
Chris Lattner
da8abb0239 It is NDEBUG not _NDEBUG
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23186 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-01 18:44:10 +00:00
Nate Begeman
4942a9687d Add the rest of the currently implemented visit routines to the switch
statement in visit().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23185 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-01 00:33:32 +00:00
Nate Begeman
1d4d414111 First pass at the DAG Combiner. It isn't used anywhere yet, but it should
be mostly functional.  It currently has all folds from SelectionDAG.cpp
that do not involve a condition code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23184 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-01 00:19:25 +00:00
Chris Lattner
a1f68ca94e If a function has live ins/outs, print them
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23181 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-31 22:34:59 +00:00
Chris Lattner
50ec897904 Allow targets to custom expand shifts that are too large for their registers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23173 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-31 19:01:53 +00:00
Jeff Cohen
7383ce4127 Fix VC++ precedence warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23169 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-31 02:47:06 +00:00
Nate Begeman
fe75a2836a Sigh, not my day. Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23166 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-31 00:43:49 +00:00
Nate Begeman
9f52f2838d Fix a mistake in my previous patch pointed out by sabre; the AssertZext
case in MaskedValueIsZero was wrong.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23165 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-31 00:43:08 +00:00
Nate Begeman
b85dfab889 Remove some unnecessary casts, and add the AssertZext case to
MaskedValueIsZero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23164 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-31 00:27:53 +00:00
Chris Lattner
0fdd768094 Allow physregs to occur in the dag with multiple types. Though I don't likethis, it is a requirement on PPC, which can have an f32 value in r3 at onepoint in a function and a f64 value in r3 at another point. :(
This fixes compilation of mesa


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23161 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-30 22:38:38 +00:00
Chris Lattner
e836ad6736 When checking the fixed intervals, don't forget to check for register aliases.
This fixes PR621 and Regression/CodeGen/X86/2005-08-30-RegAllocAliasProblem.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23158 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-30 21:03:36 +00:00
Chris Lattner
cc0675a4be Fix FreeBench/fourinarow with the dag isel, by not adding a bogus result
to SHIFT_PARTS nodes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23151 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-30 17:21:17 +00:00
Chris Lattner
ec176e30d6 Fix a miscompile of PtrDist/bc. Sign extending bools is not the right thing,
at least tends to expose problems elsewhere.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23149 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-30 16:56:19 +00:00
Nate Begeman
5ffcd9b56c Remove a bogus piece of my AssertSext/AssertZext patch. oops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23148 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-30 02:54:28 +00:00
Nate Begeman
56eb86806d Add support for AssertSext and AssertZext, folding other extensions with
them.  This allows for elminination of redundant extends in the entry
blocks of functions on PowerPC.

Add support for i32 x i32 -> i64 multiplies, by recognizing when the inputs
to ISD::MUL in ExpandOp are actually just extended i32 values and not real
i64 values.  this allows us to codegen

int mulhs(int a, int b) { return ((long long)a * b) >> 32; }
as:
_mulhs:
        mulhw r3, r4, r3
        blr

instead of:
_mulhs:
        mulhwu r2, r4, r3
        srawi r5, r3, 31
        mullw r5, r4, r5
        add r2, r2, r5
        srawi r4, r4, 31
        mullw r3, r4, r3
        add r3, r2, r3
        blr

with a similar improvement on x86.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23147 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-30 02:44:00 +00:00
Chris Lattner
f155635b53 Name this variable to be what it really is!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23145 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-30 01:58:51 +00:00
Chris Lattner
55334fc45c Handle CopyToReg nodes with flag operands correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23144 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-30 01:57:23 +00:00
Chris Lattner
82e14db9a9 Add a hack to avoid some horrible code in some cases by always emitting
token chains first.  For this C function:

int test() {
  int i;
  for (i = 0; i < 100000; ++i)
    foo();
}

Instead of emitting this (condition before call)

.LBB_test_1:    ; no_exit
        addi r30, r30, 1
        lis r2, 1
        ori r2, r2, 34464
        cmpw cr2, r30, r2
        bl L_foo$stub
        bne cr2, .LBB_test_1    ; no_exit

Emit this:

.LBB_test_1:    ; no_exit
        bl L_foo$stub
        addi r30, r30, 1
        lis r2, 1
        ori r2, r2, 34464
        cmpw cr0, r30, r2
        bne cr0, .LBB_test_1    ; no_exit

Which makes it so we don't have to save/restore cr2 in the prolog/epilog of
the function.

This also makes the code much more similar to what the pattern isel produces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23135 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-29 23:21:29 +00:00
Chris Lattner
c26aefa15a Add a new API for Nate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23131 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-29 21:59:31 +00:00
Andrew Lenharth
5e3efbc2ca Some of us cared about the the promote path
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23130 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-29 20:46:51 +00:00
Chris Lattner
507f752f6e Fix an infinite loop on x86
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23129 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-29 17:30:00 +00:00
Chris Lattner
dfd58709cc Fix a bug in my previous patch that was using the wrong iterator. This fixes
Olden/bisort among others.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23124 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-29 00:10:46 +00:00