Commit Graph

7790 Commits

Author SHA1 Message Date
Brian Gaeke
9ed920437a Recognize FpMOVD as a move.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16586 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 16:45:47 +00:00
Chris Lattner
0ed7f42c1b Do not insert trivially dead select instructions, which allows us to
potentially fold more in one pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16583 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 05:43:32 +00:00
Chris Lattner
4e998b2fea Fold binary expressions and casts into PHI nodes that have all constant inputs.
This takes something like this:

%A = phi int [ 3, %cond_false.0 ], [ 2, %endif.0.i ], [ 2, %endif.1.i ]
%B = div int %tmp.243, 4

and turns it into:

%A = phi int [ 3/4, %cond_false.0 ], [ 2/4, %endif.0.i ], [ 2/4, %endif.1.i ]

which is later simplified (in this case) into %A = 0.

This triggers thousands of times in spec, for example, 269 times in 176.gcc.

This is tested by InstCombine/add.ll:test23 and set.ll:test18.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16582 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 05:07:12 +00:00
Nate Begeman
1f49e868aa Generate better code by being far less clever when it comes to the select instruction. Don't create overlapping register lifetimes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16580 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 05:00:31 +00:00
Brian Gaeke
a771347336 add results
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16579 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:48:55 +00:00
Nate Begeman
1b99fd3e8a improve Type::BoolTy codegen by eliminating unnecessary clears and sign extends
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16578 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:45:33 +00:00
Brian Gaeke
1df468ea9b Simplify copyConstantToRegister() for longs, using a pair of recursive calls.
Copy constant-pool entries' addresses into registers before loading out of them,
to avoid errors from the assembler.
Handle loading call args past the 6th one off the stack.
Add IMPLICIT_DEF pseudo-instrs for double and long arguments passed in register
pairs.
Use FpMOVD to copy doubles around instead of the horrible store-load thing we
were doing before.
Handle 'ret double' and 'ret long'.
Fix a bug in handling 'and/or/xor long'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16577 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:34:41 +00:00
Brian Gaeke
9b8ed0e04a Fix bug recognizing moves: isMoveInstr should only treat ORs with %g0 as
moves, not all ORs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16576 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:28:15 +00:00
Brian Gaeke
bcf2ad296f Use FpMOVD pseudo-instruction to move doubles around.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16575 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:27:30 +00:00
Brian Gaeke
a036b53929 Add new FpMOVD pseudo-instruction, used to move doubles around.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16574 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:27:29 +00:00
Brian Gaeke
8a9acd1e31 Fix double and long alignment.
Call the FPMover pass after register allocation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16573 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:26:27 +00:00
Brian Gaeke
b27df44b62 Put quotes around argument to .section directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16572 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:25:40 +00:00
Brian Gaeke
1162ed2900 Add createSparcV8FPMoverPass().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16571 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:25:39 +00:00
Brian Gaeke
15b2838035 Pass which converts FpMOVD (double move pseudoinstructions) to pairs
of FMOVS instrs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16570 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:24:34 +00:00
Chris Lattner
dd763f401e Hrm, really, all tests passed without this, but it is scary to think how...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16568 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:16:24 +00:00
Chris Lattner
f6d1d7d2ba Remove debugging printout
Instcombine (setcc (truncate X), C1).

This occurs THOUSANDS of times in many benchmarks.  Particularlly common
seem to be things like (seteq (cast bool X to int), int 0)

This turns it into (seteq bool %X, false), which then becomes (not %X).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16567 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 03:09:18 +00:00
Nate Begeman
a41fc77ae4 To go along with sabre's improved InstCombining, improve recognition of
integers that we can use as immediate values in instructions.

Example from yacr2:
-       lis r10, -1
-       ori r10, r10, 65535
-       add r28, r28, r10
+       addi r28, r28, -1
        addi r7, r7, 1
        addi r9, r9, 1
        b .LBB_main_9   ; loopentry.1.i214


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16566 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 02:35:05 +00:00
Reid Spencer
6a0ec6fcf6 Improve validity checking of windows path names and fix file creation
problems.

Patch contributed by Jeff Cohen. Thanks Jeff!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16565 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-29 00:01:17 +00:00
Reid Spencer
ced4110f5b Use llvm::sys::Path to destroy the file.
Patch contributed by Jeff Cohen. Thanks Jeff!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16564 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 23:58:03 +00:00
Reid Spencer
10366a4ad9 Win32 implementation of TimeValue::now().
Patch contributed by Jeff Cohen. Thanks Jeff!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16563 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 23:56:20 +00:00
Reid Spencer
d722bf5c28 FreeBSD implementation of the TimeValue::now() method.
Patch kindly contributed by Jeff Cohen. Thanks Jeff!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16562 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 23:54:12 +00:00
Chris Lattner
b4f40d2059 Fold (X setcc C1) | (X setcc C2)
This implements or.ll:test1[89]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16561 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 22:33:08 +00:00
Chris Lattner
955f331a77 Fold (and (setcc X, C1), (setcc X, C2))
This is important for several reasons:

1. Benchmarks have lots of code that looks like this (perlbmk in particular):

  %tmp.2.i = setne int %tmp.0.i, 128              ; <bool> [#uses=1]
  %tmp.6343 = seteq int %tmp.0.i, 1               ; <bool> [#uses=1]
  %tmp.63 = and bool %tmp.2.i, %tmp.6343          ; <bool> [#uses=1]

   we now fold away the setne, a clear improvement.

2. In the more important cases, such as (X >= 10) & (X < 20), we now produce
   smaller code: (X-10) < 10.

3. Perhaps the nicest effect of this patch is that it really helps out the
   code generators.  In particular, for a 'range test' like the above,
   instead of generating this on X86 (the difference on PPC is even more
   pronounced):

        cmp %EAX, 50
        setge %CL
        cmp %EAX, 100
        setl %AL
        and %CL, %AL
        cmp %CL, 0

   we now generate this:

        add %EAX, -50
        cmp %EAX, 50

   Furthermore, this causes setcc's to be folded into branches more often.

These combinations trigger dozens of times in the spec benchmarks, particularly
in 176.gcc, 186.crafty, 253.perlbmk, 254.gap, & 099.go.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16559 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 21:48:02 +00:00
Nate Begeman
8d5c50329b Add support for the isLoad and isStore flags, needed by the instruction scheduler
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16555 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 21:29:00 +00:00
Chris Lattner
7baaf09f9f Capture delay slot info
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16551 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 18:34:14 +00:00
Chris Lattner
18d19ca6df Implement X / C1 / C2 folding
Implement (setcc (shl X, C1), C2) folding.

The second one occurs several dozen times in spec.  The first was added
just in case.  :)

These are tested by shift.ll:test2[12], and div.ll:test5


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16549 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 18:22:15 +00:00
Chris Lattner
0cba71b0d6 shl is always zero extending, so always use a zero extending shift right.
This latent bug was exposed by recent changes, and is tested as:
llvm/test/Regression/Transforms/InstCombine/2004-09-28-BadShiftAndSetCC.llx


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16546 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 17:54:07 +00:00
Misha Brukman
44666b15b1 Fix doxygen comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16542 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 16:57:46 +00:00
Alkis Evlogimenos
c72c617a4e Add includes and use std:: for standard library calls to make code
compile on windows. This patch was contributed by Paolo Invernizzi.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16539 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 14:42:44 +00:00
Alkis Evlogimenos
f3ba6ddbec Since we use alloca now make sure we include the proper headers for it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16536 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 02:53:15 +00:00
Alkis Evlogimenos
0ee6e2a6da Use alloca instead of a C99 style array. This should fix the
compilation problem in windows.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16535 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 02:47:38 +00:00
Alkis Evlogimenos
200a360ec6 Pull assignment out of for loop conditional in order for this to
compile under windows. Patch contributed by Paolo Invernizzi!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16534 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 02:40:37 +00:00
Alkis Evlogimenos
c4d3b91816 Fix includes. Patch contributed by Paolo Invernizzi!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16533 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-28 02:38:58 +00:00
Chris Lattner
83c4ec0372 Fix two bugs: one where a condition was mistakenly swapped, and another
where we folded (X & 254) -> X < 1 instead of X < 2.  These problems were
latent problems exposed by the latest patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16528 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-27 19:29:18 +00:00
Misha Brukman
f90a656a9f SparcV8 int regs are not only 32-bits in width, but they are 32-bit aligned!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16526 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-27 18:22:18 +00:00
Chris Lattner
56bc894d06 The system ranlib on darwin occasionally adds two extra newlines to the
end of files, breaking the CFE build.  As a gross hack around this,
ignore any trailing garbage on bytecode files.  Thanks to Brian for digging
in and identifying the problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16525 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-27 16:59:06 +00:00
Chris Lattner
f63f647345 Fold: (setcc (shr X, ShAmt), CI), where 'cc' is eq or ne. This xform
triggers often, for example:

6x in povray, 1x in gzip, 279x in gcc, 1x in crafty, 8x in eon, 11x in perlbmk,
362x in gap, 4x in vortex, 14 in m88ksim, 211x in 126.gcc, 1x in compress,
11x in ijpeg, and 4x in 147.vortex.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16521 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-27 16:18:50 +00:00
Nate Begeman
da721e74f8 Correct some BuildMI arguments for the upcoming simple scheduler
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16519 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-27 05:08:17 +00:00
Misha Brukman
c6e7430499 Fix the copy-pasto that Brian noticed: V8 int regs are 32-bits wide, not 64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16518 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-26 21:07:43 +00:00
Reid Spencer
725f2c82c9 Updated to reflect changes in the interface of TimeValue::now().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16515 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-25 08:32:37 +00:00
Reid Spencer
0d5716e3af Added stub implementations of TimeValue concept for remaining platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16513 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-25 05:03:54 +00:00
Reid Spencer
1fc194c610 Wrap to 80 cols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16512 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-25 05:03:22 +00:00
Reid Spencer
9926c31351 Initial implementation of the TimeValue abstraction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16511 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-24 23:25:19 +00:00
Chris Lattner
0c96766c90 Implement shift-and combinations, implementing InstCombine/and.ll:test19-21
These combinations trigger 4 times in povray, 7x in gcc, 4x in gap, and 2x in bzip2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16508 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-24 15:21:34 +00:00
Chris Lattner
648e3bc39c Move LHSI->hasOneUse() into the arms of the conditional, reindenting code.
No functionality changes here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16505 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-23 21:52:49 +00:00
Chris Lattner
b20ba0a83f Implement Transforms/InstCombine/and.ll:test18, a case that occurs 20 times
in perlbmk


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16504 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-23 21:46:38 +00:00
Chris Lattner
684fe210a9 Implement select.ll:test16: fold load (select C, X, null) -> load X
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16499 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-23 15:46:00 +00:00
Reid Spencer
f6cbc0fd64 Patch for MINGW. Patch provided by Henrik Bach.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16495 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-23 14:47:10 +00:00
Nate Begeman
645495d2e6 Fix the last of the major PPC GEP folding deficiencies. This will allow
the ISel to use indexed and non-zero immediate offsets for GEPs that have
more than one use.  This is common for instruction sequences such as a load
followed by a modify and store to the same address.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16493 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-23 05:31:33 +00:00
Misha Brukman
c95759c2f5 Use the V8/V9 shared register file description
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16485 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-22 21:48:50 +00:00