Commit Graph

7919 Commits

Author SHA1 Message Date
Chris Lattner
f8d1097e9d If we are trying to create a ConstantExpr cast that is really a GEP to the
first element of an array, return a GEP instead of a cast.  This allows us
to transparently fold this:

int* getelementptr (int* cast ([100 x int]* %Gbody to int*), int 40)

into this:

int* getelementptr ([100 x int]* %Gbody, int 0, int 40)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16911 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-11 03:57:30 +00:00
Misha Brukman
de2a9432f9 ModuloScheduling has moved to lib/Target/SparcV9
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16906 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 23:37:40 +00:00
Misha Brukman
b15d4c6072 Add ModuloScheduling to the recursive build tree
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16905 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 23:36:09 +00:00
Misha Brukman
7da1e6e27c Adjust header file inclusion due to move
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16904 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 23:34:50 +00:00
Misha Brukman
0a18934a23 Adjust comment header and paths to refect move
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16903 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 23:34:36 +00:00
Misha Brukman
f60a149df6 ModuloScheduling moved to lib/Target/SparcV9 as it is SparcV9-specific
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16902 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 23:33:20 +00:00
Chris Lattner
708148e41f Just because we cannot completely eliminate all uses of a global, we can
still optimize away all of the indirect calls and loads, etc from it.
This turns code like this:

  if (G != 0)
    G();

into
   if (G != 0)
     ActualCallee();

This triggers a couple of times in gcc and libstdc++.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16901 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 23:14:11 +00:00
Reid Spencer
769dd7d5ec Initial version of automake Makefile.am file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16898 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 22:52:14 +00:00
Reid Spencer
adb6c05f91 Add the new InstrSched directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16897 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 22:51:03 +00:00
Tanya Lattner
420025b04f Added debug information. Fixed several bugs in the reconstruct loop function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16895 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 22:44:35 +00:00
Reid Spencer
81f76b324e Initial version of automake Makefile.am file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16893 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 22:20:40 +00:00
Reid Spencer
ddef0b3a6c Build both archive and relinked objects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16892 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 22:17:39 +00:00
Reid Spencer
01930c4891 Remove the InstrSched directory (moved to SparcV9)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16887 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 21:19:41 +00:00
Reid Spencer
d9a9925f87 Directory no long exists (moved to Targets/SparcV9).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16886 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 21:18:31 +00:00
Reid Spencer
9f41a5fe85 Initial version of automake Makefile.am file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16885 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 20:43:57 +00:00
Brian Gaeke
299b39d356 Fix assertion failure when calling or returning from a function which
returns 'bool' type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16884 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 20:34:17 +00:00
Brian Gaeke
85c08351ce Implement eliminateCallFramePseudoInstr().
Wrap a long comment line.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16883 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 19:57:21 +00:00
Brian Gaeke
9f0cecd438 Model calls as *both* using *and* killing O0..O5, because callees use the
argument values passed in (so they're not dead until *after* the call),
and callees are free to modify those registers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16882 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 19:57:20 +00:00
Brian Gaeke
50094edf96 Fix whitespace and wrap some long lines.
Deal with allocating stack space for outgoing args and copying them into the
correct stack slots (at least, we can copy <=32-bit int args).
We now correctly generate ADJCALLSTACK* instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16881 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 19:57:18 +00:00
Chris Lattner
8be8012ba4 Fix 2004-10-10-CastStoreOnce.llx, by adjusting types back if we strip off a cast
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16878 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 17:07:12 +00:00
Chris Lattner
c4d81b0388 Implement GlobalOpt/deadglobal-2.llx, deletion of globals that are only
stored to, but are stored at variable indexes.  This occurs at least in
176.gcc, but probably others, and we should handle it for completeness.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16876 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 16:47:33 +00:00
Chris Lattner
031955d462 Avoid calling use_size() which could (in theory) be expensive if the global
has a large number of users.  Instead, just keep track of whether we're
making changes as we do so.

This patch has no functionlity changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16874 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 16:43:46 +00:00
Chris Lattner
cbb9812d0d bling bling!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16873 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-10 16:26:13 +00:00
Chris Lattner
9b34a61019 Eliminate global pointers that are only stored a single value and null if
we know that all uses of the global will trap if the pointer contained is
null.  In this case, we forward substitute the stored value to any uses.

This has the effect of devirtualizing trivial globals in trivial cases.  For
example, 164.gzip contains this:

gzip.h:extern   int (*read_buf) OF((char *buf, unsigned size));
bits.c: read_buf  = file_read;
deflate.c:    lookahead = read_buf((char*)window,
deflate.c:        n = read_buf((char*)window+strstart+lookahead, more);

Since read_buf has to point to file_read at every use, we just replace
the calls through read_buf with a direct call to file_read.

This occurs in several benchmarks, including 176.gcc and 164.gzip.  Direct
calls are good and stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16871 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-09 21:48:45 +00:00
Chris Lattner
83d72bcd11 Instead of silently breaking, print notification of why this doesn't work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16870 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-09 21:13:51 +00:00
Chris Lattner
dd27827733 Use DEBUG instead of DebugFlag directly, as DebugFlag does not respect
-debug-only!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16868 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-09 19:30:36 +00:00
Brian Gaeke
03203b423f update according to tonight's info
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16866 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-09 05:58:27 +00:00
Brian Gaeke
0e2d466ce9 Implement getModuleMatchQuality and getJITMatchQuality so that v8 will be the
default 32/BE target on sparc hosts, and ppc will continue to be the default
on other hosts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16865 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-09 05:57:01 +00:00
Chris Lattner
930f475604 Fix infinite loop due to iteration
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16864 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-09 03:32:52 +00:00
Chris Lattner
a052f8297a Implement sub.ll:test17, -X/C -> X/-C
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16863 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-09 02:50:40 +00:00
Chris Lattner
1c1bb33534 Add a check to avoid an assertion on malformed input
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16861 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-09 02:18:58 +00:00
Chris Lattner
222b86f694 The person who was planning to add SSE support isn't anymore, so disable
the -sse* options (to avoid misleading people).

Also, the stack alignment of the target doesn't depend on whether SSE is
eventually implemented, so remove a comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16860 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 22:41:46 +00:00
Chris Lattner
b0f4e389db Fix a major regression from the bugfix for 2004-10-08-SelectSetCCFold.llx,
which prevented setcc's from being folded into branches.  It appears that
conditional branchinst's CC operand is actually operand(2), not operand(0)
as we might expect. :(


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16859 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 22:24:31 +00:00
Chris Lattner
8f57e9c083 If we found a dead global, we should at least delete it...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16858 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 22:05:31 +00:00
Chris Lattner
a4be1dc0a1 * Pull out the meat of runOnModule into another function for clarity.
* Do not lead dangling dead constants prevent optimization
* Iterate global optimization while we're making progress.

These changes allow us to be more aggressive, handling cases like
GlobalOpt/iterate.llx without a problem (turning it into 'ret int 0').


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16857 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 20:59:28 +00:00
Chris Lattner
e40e2d1a71 We might as well delete the known-dead global sooner rather than later since
we know it is dead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16855 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 20:25:55 +00:00
Misha Brukman
6a134dedf6 Hyphenate target-(in)dependent for more tasty grammar goodness (tm)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16854 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 19:43:31 +00:00
Chris Lattner
340a05fb3a Temporarily disable a buggy transformation until it can be fixed. This fixes
254.gap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16853 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 19:15:44 +00:00
Misha Brukman
7ced638072 Adjust paths due to moving InstrSched to lib/Target/SparcV9
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16852 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 18:30:22 +00:00
Misha Brukman
6b68973617 InstrSched has been moved to lib/Target/SparcV9
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16850 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 18:12:53 +00:00
Misha Brukman
c8e049124e InstrSched is SparcV9-specific and so has been moved to lib/Target/SparcV9/
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16849 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 18:12:14 +00:00
Misha Brukman
855ae5a8f7 Single-space instead of double-spacing in the Makefile
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16848 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 18:11:14 +00:00
Misha Brukman
222c98bf82 Build InstrSched as well, and all three subdirs can be built independently
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16847 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 18:10:48 +00:00
Misha Brukman
13e4f6eb04 * Adjust for the move to lib/Target/SparcV9/InstrSched
* Rename library to mark it SparcV9-specific


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16846 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 18:10:01 +00:00
Misha Brukman
1481a5c4c7 Single-space instead of double-spacing in the Makefile
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16845 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 18:05:25 +00:00
Chris Lattner
670c889ac9 Implement SRA for global variables. This allows the other global variable
optimizations to trigger much more often.  This allows the elimination of
several dozen more global variables in Programs/External.  Note that we only
do this for non-constant globals: constant globals will already be optimized
out if the accesses to them permit it.

This implements Transforms/GlobalOpt/globalsra.llx


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16842 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 17:32:09 +00:00
Chris Lattner
d04cd55796 Fix bug: 2004-10-08-SelectSetCCFold.llx. Normally this is hidden by the
instcombine xform, which is why we didn't notice it before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16840 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 16:34:13 +00:00
Chris Lattner
b99d6b1cac Instcombine (X & FF00) + xx00 -> (X+xx00) & FF00, implementing and.ll:test27
This comes up when doing adds to bitfield elements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16836 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 05:07:56 +00:00
Chris Lattner
1f7e160f77 Little patch to turn (shl (add X, 123), 4) -> (add (shl X, 4), 123 << 4)
This triggers in cases of bitfield additions, opening opportunities for
future improvements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16834 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 03:46:20 +00:00
Nate Begeman
bdf69847a9 Implement logical and with an immediate that consists of a contiguous block
of one or more 1 bits (may wrap from least significant bit to most
significant bit) as the rlwinm rather than andi., andis., or some longer
instructons sequence.

int andn4(int z) { return z & -4; }
int clearhi(int z) { return z & 0x0000FFFF; }
int clearlo(int z) { return z & 0xFFFF0000; }
int clearmid(int z) { return z & 0x00FFFF00; }
int clearwrap(int z) { return z & 0xFF0000FF; }

_andn4:
        rlwinm r3, r3, 0, 0, 29
        blr

_clearhi:
        rlwinm r3, r3, 0, 16, 31
        blr

_clearlo:
        rlwinm r3, r3, 0, 0, 15
        blr

_clearmid:
        rlwinm r3, r3, 0, 8, 23
        blr

_clearwrap:
        rlwinm r3, r3, 0, 24, 7
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16832 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-08 02:49:24 +00:00