oota-llvm.git
19 years agoModel calls as *both* using *and* killing O0..O5, because callees use the
Brian Gaeke [Sun, 10 Oct 2004 19:57:20 +0000 (19:57 +0000)]
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

19 years agoFix whitespace and wrap some long lines.
Brian Gaeke [Sun, 10 Oct 2004 19:57:18 +0000 (19:57 +0000)]
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

19 years agoTop level makefile for building LLVM with automake.
Reid Spencer [Sun, 10 Oct 2004 19:13:03 +0000 (19:13 +0000)]
Top level makefile for building LLVM with automake.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16880 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoEnsure timestamp on saved contents of configure.ac is not changed.
Reid Spencer [Sun, 10 Oct 2004 19:09:33 +0000 (19:09 +0000)]
Ensure timestamp on saved contents of configure.ac is not changed.
Use correct options to automake.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16879 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix 2004-10-10-CastStoreOnce.llx, by adjusting types back if we strip off a cast
Chris Lattner [Sun, 10 Oct 2004 17:07:12 +0000 (17:07 +0000)]
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

19 years agoNew testcase that crashes -globalopt. I found this through inspection, not
Chris Lattner [Sun, 10 Oct 2004 17:06:09 +0000 (17:06 +0000)]
New testcase that crashes -globalopt.  I found this through inspection, not
actually in the wild :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16877 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement GlobalOpt/deadglobal-2.llx, deletion of globals that are only
Chris Lattner [Sun, 10 Oct 2004 16:47:33 +0000 (16:47 +0000)]
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

19 years agoNew testcase we were not handling before.
Chris Lattner [Sun, 10 Oct 2004 16:46:48 +0000 (16:46 +0000)]
New testcase we were not handling before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16875 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAvoid calling use_size() which could (in theory) be expensive if the global
Chris Lattner [Sun, 10 Oct 2004 16:43:46 +0000 (16:43 +0000)]
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

19 years agobling bling!
Chris Lattner [Sun, 10 Oct 2004 16:26:13 +0000 (16:26 +0000)]
bling bling!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16873 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoA testcase that globalopt now handles
Chris Lattner [Sat, 9 Oct 2004 21:50:05 +0000 (21:50 +0000)]
A testcase that globalopt now handles

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16872 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoEliminate global pointers that are only stored a single value and null if
Chris Lattner [Sat, 9 Oct 2004 21:48:45 +0000 (21:48 +0000)]
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

19 years agoInstead of silently breaking, print notification of why this doesn't work.
Chris Lattner [Sat, 9 Oct 2004 21:13:51 +0000 (21:13 +0000)]
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

19 years agoFix grammaro
Chris Lattner [Sat, 9 Oct 2004 19:37:02 +0000 (19:37 +0000)]
Fix grammaro

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16869 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoUse DEBUG instead of DebugFlag directly, as DebugFlag does not respect
Chris Lattner [Sat, 9 Oct 2004 19:30:36 +0000 (19:30 +0000)]
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

19 years agoIt looks like we're not releasing 1.4 with llvm.org as the official domain
Chris Lattner [Sat, 9 Oct 2004 19:19:57 +0000 (19:19 +0000)]
It looks like we're not releasing 1.4 with llvm.org as the official domain

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16867 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoupdate according to tonight's info
Brian Gaeke [Sat, 9 Oct 2004 05:58:27 +0000 (05:58 +0000)]
update according to tonight's info

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16866 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement getModuleMatchQuality and getJITMatchQuality so that v8 will be the
Brian Gaeke [Sat, 9 Oct 2004 05:57:01 +0000 (05:57 +0000)]
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

19 years agoFix infinite loop due to iteration
Chris Lattner [Sat, 9 Oct 2004 03:32:52 +0000 (03:32 +0000)]
Fix infinite loop due to iteration

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16864 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement sub.ll:test17, -X/C -> X/-C
Chris Lattner [Sat, 9 Oct 2004 02:50:40 +0000 (02:50 +0000)]
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

19 years agoNew testcase
Chris Lattner [Sat, 9 Oct 2004 02:50:01 +0000 (02:50 +0000)]
New testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16862 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd a check to avoid an assertion on malformed input
Chris Lattner [Sat, 9 Oct 2004 02:18:58 +0000 (02:18 +0000)]
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

19 years agoThe person who was planning to add SSE support isn't anymore, so disable
Chris Lattner [Fri, 8 Oct 2004 22:41:46 +0000 (22:41 +0000)]
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

19 years agoFix a major regression from the bugfix for 2004-10-08-SelectSetCCFold.llx,
Chris Lattner [Fri, 8 Oct 2004 22:24:31 +0000 (22:24 +0000)]
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

19 years agoIf we found a dead global, we should at least delete it...
Chris Lattner [Fri, 8 Oct 2004 22:05:31 +0000 (22:05 +0000)]
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

19 years ago* Pull out the meat of runOnModule into another function for clarity.
Chris Lattner [Fri, 8 Oct 2004 20:59:28 +0000 (20:59 +0000)]
* 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

19 years agoNew testcase
Chris Lattner [Fri, 8 Oct 2004 20:57:46 +0000 (20:57 +0000)]
New testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16856 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoWe might as well delete the known-dead global sooner rather than later since
Chris Lattner [Fri, 8 Oct 2004 20:25:55 +0000 (20:25 +0000)]
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

19 years agoHyphenate target-(in)dependent for more tasty grammar goodness (tm)
Misha Brukman [Fri, 8 Oct 2004 19:43:31 +0000 (19:43 +0000)]
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

19 years agoTemporarily disable a buggy transformation until it can be fixed. This fixes
Chris Lattner [Fri, 8 Oct 2004 19:15:44 +0000 (19:15 +0000)]
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

19 years agoAdjust paths due to moving InstrSched to lib/Target/SparcV9
Misha Brukman [Fri, 8 Oct 2004 18:30:22 +0000 (18:30 +0000)]
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

19 years agoUse the SparcV9-marked instr scheduling library
Misha Brukman [Fri, 8 Oct 2004 18:14:56 +0000 (18:14 +0000)]
Use the SparcV9-marked instr scheduling library

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16851 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoInstrSched has been moved to lib/Target/SparcV9
Misha Brukman [Fri, 8 Oct 2004 18:12:53 +0000 (18:12 +0000)]
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

19 years agoInstrSched is SparcV9-specific and so has been moved to lib/Target/SparcV9/
Misha Brukman [Fri, 8 Oct 2004 18:12:14 +0000 (18:12 +0000)]
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

19 years agoSingle-space instead of double-spacing in the Makefile
Misha Brukman [Fri, 8 Oct 2004 18:11:14 +0000 (18:11 +0000)]
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

19 years agoBuild InstrSched as well, and all three subdirs can be built independently
Misha Brukman [Fri, 8 Oct 2004 18:10:48 +0000 (18:10 +0000)]
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

19 years ago* Adjust for the move to lib/Target/SparcV9/InstrSched
Misha Brukman [Fri, 8 Oct 2004 18:10:01 +0000 (18:10 +0000)]
* 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

19 years agoSingle-space instead of double-spacing in the Makefile
Misha Brukman [Fri, 8 Oct 2004 18:05:25 +0000 (18:05 +0000)]
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

19 years agoRemove unused variable.
Reid Spencer [Fri, 8 Oct 2004 18:01:31 +0000 (18:01 +0000)]
Remove unused variable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16844 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoMake it so that positional parameters can have spaces in them.
Reid Spencer [Fri, 8 Oct 2004 17:59:29 +0000 (17:59 +0000)]
Make it so that positional parameters can have spaces in them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16843 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement SRA for global variables. This allows the other global variable
Chris Lattner [Fri, 8 Oct 2004 17:32:09 +0000 (17:32 +0000)]
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

19 years agoNew testcase
Chris Lattner [Fri, 8 Oct 2004 17:29:47 +0000 (17:29 +0000)]
New testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16841 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix bug: 2004-10-08-SelectSetCCFold.llx. Normally this is hidden by the
Chris Lattner [Fri, 8 Oct 2004 16:34:13 +0000 (16:34 +0000)]
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

19 years agoNew testcase. The setcc is only used by a select, but not as a condition:
Chris Lattner [Fri, 8 Oct 2004 16:33:40 +0000 (16:33 +0000)]
New testcase.  The setcc is only used by a select, but not as a condition:
it cannot be folded in.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16839 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoProperly `quote' names, and don't forget to add the ending quote!
Misha Brukman [Fri, 8 Oct 2004 14:59:05 +0000 (14:59 +0000)]
Properly `quote' names, and don't forget to add the ending quote!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16838 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd the --with-automake option to AutoRegen.sh and provide the automake
Reid Spencer [Fri, 8 Oct 2004 05:33:35 +0000 (05:33 +0000)]
Add the --with-automake option to AutoRegen.sh and provide the automake
version of the configure script. This is an early commit of the automake
support so that automake support can be tested on multiple platforms. Many
additional Makefile.am need to be added to LLVM before this is of any use.
Please wait until automake support is announced on llvmdev list before
using the --with-automake option.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16837 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoInstcombine (X & FF00) + xx00 -> (X+xx00) & FF00, implementing and.ll:test27
Chris Lattner [Fri, 8 Oct 2004 05:07:56 +0000 (05:07 +0000)]
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

19 years agoNew testcase
Chris Lattner [Fri, 8 Oct 2004 05:03:25 +0000 (05:03 +0000)]
New testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16835 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoLittle patch to turn (shl (add X, 123), 4) -> (add (shl X, 4), 123 << 4)
Chris Lattner [Fri, 8 Oct 2004 03:46:20 +0000 (03:46 +0000)]
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

19 years agoNew testcase
Chris Lattner [Fri, 8 Oct 2004 03:41:59 +0000 (03:41 +0000)]
New testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16833 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement logical and with an immediate that consists of a contiguous block
Nate Begeman [Fri, 8 Oct 2004 02:49:24 +0000 (02:49 +0000)]
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

19 years agoFix usage description typo
Misha Brukman [Fri, 8 Oct 2004 01:11:15 +0000 (01:11 +0000)]
Fix usage description typo

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16831 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoMake comment header span the entire line
Misha Brukman [Fri, 8 Oct 2004 01:10:52 +0000 (01:10 +0000)]
Make comment header span the entire line

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16830 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoDescribe how to configure tests to work with f2c
Misha Brukman [Fri, 8 Oct 2004 00:55:43 +0000 (00:55 +0000)]
Describe how to configure tests to work with f2c

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16829 91177308-0d34-0410-b5e6-96231b3b80d8

19 years ago* Reformat to fit 80 cols
Misha Brukman [Fri, 8 Oct 2004 00:41:27 +0000 (00:41 +0000)]
* Reformat to fit 80 cols
* Add missing <li> tags

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16828 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoSeveral fixes and enhancements to the PPC32 backend.
Nate Begeman [Thu, 7 Oct 2004 22:30:03 +0000 (22:30 +0000)]
Several fixes and enhancements to the PPC32 backend.

1. Fix an illegal argument to getClassB when deciding whether or not to
   sign extend a byte load.

2. Initial addition of isLoad and isStore flags to the instruction .td file
   for eventual use in a scheduler.

3. Rewrite of how constants are handled in emitSimpleBinaryOperation so
   that we can emit the PowerPC shifted immediate instructions far more
   often.  This allows us to emit the following code:

int foo(int x) { return x | 0x00F0000; }

_foo:
.LBB_foo_0:     ; entry
        ; IMPLICIT_DEF
        oris r3, r3, 15
        blr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16826 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd ori reg, reg, 0 as a move instruction. This can be generated from
Nate Begeman [Thu, 7 Oct 2004 22:26:12 +0000 (22:26 +0000)]
Add ori reg, reg, 0 as a move instruction.  This can be generated from
loading a 32bit constant into a register whose low halfword is all zeroes.

We now omit the ori after the lis for the following C code:

int bar(int y) { return y * 0x00F0000; }

_bar:
.LBB_bar_0:     ; entry
        ; IMPLICIT_DEF
        lis r2, 15
        mullw r3, r3, r2
        blr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16825 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRemove unnecessary header include
Nate Begeman [Thu, 7 Oct 2004 22:24:32 +0000 (22:24 +0000)]
Remove unnecessary header include

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16824 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImprove comments, no functionality changes
Chris Lattner [Thu, 7 Oct 2004 21:30:30 +0000 (21:30 +0000)]
Improve comments, no functionality changes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16814 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix a nasty dangling pointer problem, due to a free'd pointer being left in
Chris Lattner [Thu, 7 Oct 2004 20:01:31 +0000 (20:01 +0000)]
Fix a nasty dangling pointer problem, due to a free'd pointer being left in
a map.  This caused problems if a later object happened to be allocated at
the free'd object's address.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16813 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoGet friendly with Type
Chris Lattner [Thu, 7 Oct 2004 19:21:43 +0000 (19:21 +0000)]
Get friendly with Type

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16812 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoUnfortunately the fix for the previous bug introduced the previous
Chris Lattner [Thu, 7 Oct 2004 19:20:48 +0000 (19:20 +0000)]
Unfortunately the fix for the previous bug introduced the previous
exponential behavior (bork!).  This patch processes stuff with an
explicit SCC finder, allowing the algorithm to be more clear,
efficient, and also (as a bonus) correct!  This gets us back to taking
0.6s to disassemble my horrible .bc file that previously took something
> 30 mins.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16811 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoChange signature of this method again
Chris Lattner [Thu, 7 Oct 2004 19:19:12 +0000 (19:19 +0000)]
Change signature of this method again

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16810 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoThese files now live in Transforms/GlobalOpt
Chris Lattner [Thu, 7 Oct 2004 19:16:43 +0000 (19:16 +0000)]
These files now live in Transforms/GlobalOpt

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16809 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoMove these files from Transforms/GlobalConstifier
Chris Lattner [Thu, 7 Oct 2004 19:16:26 +0000 (19:16 +0000)]
Move these files from Transforms/GlobalConstifier

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16808 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix a bug in my previous change. Unfortunately this reverts most of the
Chris Lattner [Thu, 7 Oct 2004 16:19:40 +0000 (16:19 +0000)]
Fix a bug in my previous change.  Unfortunately this reverts most of the
speedup, but has the advantage of not breaking a bunch of programs!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16806 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoMake these scripts work on SunOS too.
Reid Spencer [Thu, 7 Oct 2004 16:03:21 +0000 (16:03 +0000)]
Make these scripts work on SunOS too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16805 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix a bug in the safety analysis routine
Chris Lattner [Thu, 7 Oct 2004 06:01:25 +0000 (06:01 +0000)]
Fix a bug in the safety analysis routine

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16804 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoComment cleanups
Chris Lattner [Thu, 7 Oct 2004 06:00:24 +0000 (06:00 +0000)]
Comment cleanups

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16803 91177308-0d34-0410-b5e6-96231b3b80d8

19 years ago* Rename pass to globalopt, since we do more than just constify
Chris Lattner [Thu, 7 Oct 2004 04:16:33 +0000 (04:16 +0000)]
* Rename pass to globalopt, since we do more than just constify
* Instead of handling dead functions specially, just nuke them.
* Be more aggressive about cleaning up after constification, in
  particular, handle getelementptr instructions and constantexprs.
* Be a little bit more structured about how we process globals.

*** Delete globals that are only stored to, and never read.  These are
    clearly not useful, so they should go.  This implements deadglobal.llx

This last one triggers quite a few times.  In particular, 2208 in the
external tests, 1865 of which are in 252.eon.  This shrinks eon from
1995094 to 1732341 bytes of bytecode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16802 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRename pass
Chris Lattner [Thu, 7 Oct 2004 04:12:02 +0000 (04:12 +0000)]
Rename pass

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16801 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoThis pass is not needed, as there is only ever one global: the stack
Chris Lattner [Thu, 7 Oct 2004 04:10:36 +0000 (04:10 +0000)]
This pass is not needed, as there is only ever one global: the stack

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16800 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd new testcase, rename pass
Chris Lattner [Thu, 7 Oct 2004 04:07:08 +0000 (04:07 +0000)]
Add new testcase, rename pass

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16799 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoDon't add libz or libbz2 to the USEDLIBS lists, those are for LLVM libraries.
Chris Lattner [Thu, 7 Oct 2004 00:03:11 +0000 (00:03 +0000)]
Don't add libz or libbz2 to the USEDLIBS lists, those are for LLVM libraries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16798 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoDon't call memset if malloc returns a null pointer
Chris Lattner [Wed, 6 Oct 2004 23:08:03 +0000 (23:08 +0000)]
Don't call memset if malloc returns a null pointer

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16797 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement GlobalConstifier/trivialstore.llx, and also do some
Chris Lattner [Wed, 6 Oct 2004 20:57:02 +0000 (20:57 +0000)]
Implement GlobalConstifier/trivialstore.llx, and also do some
simplifications of the resultant program to avoid making later passes
do it all.

This allows us to constify globals that just have the same constant that
they are initialized stored into them.

Suprisingly this comes up ALL of the freaking time, dozens of times in
SPEC, 30 times in vortex alone.

For example, on 256.bzip2, it allows us to constify these two globals:

%smallMode = internal global ubyte 0             ; <ubyte*> [#uses=8]
%verbosity = internal global int 0               ; <int*> [#uses=49]

Which (with later optimizations) results in the bytecode file shrinking
from 82286 to 69686 bytes!  Lets hear it for IPO :)

For the record, it's nuking lots of "if (verbosity > 2) { do lots of stuff }"
code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16793 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoNew testcase
Chris Lattner [Wed, 6 Oct 2004 20:42:51 +0000 (20:42 +0000)]
New testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16791 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoDont' let null nodes sneak past cast instructions
Chris Lattner [Wed, 6 Oct 2004 19:29:13 +0000 (19:29 +0000)]
Dont' let null nodes sneak past cast instructions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16779 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoUndoxyfy internal method.
Misha Brukman [Wed, 6 Oct 2004 17:19:58 +0000 (17:19 +0000)]
Undoxyfy internal method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16774 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoDoxygen-ify comments
Misha Brukman [Wed, 6 Oct 2004 16:56:16 +0000 (16:56 +0000)]
Doxygen-ify comments

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16773 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoChange Type::isAbstract to have better comments, a more correct name
Chris Lattner [Wed, 6 Oct 2004 16:36:46 +0000 (16:36 +0000)]
Change Type::isAbstract to have better comments, a more correct name
(PromoteAbstractToConcrete), and to use a set to avoid recomputation.
In particular, this set eliminates the potentially exponential cases
from this little recursive algorithm.

On a particularly nasty testcase, llvm-dis on the .bc file went from 34
minutes (which is when I killed it, it still hadn't finished) to 0.57s.
Remember kids, exponential algorithms are bad.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16772 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRename method, change comment, add argument
Chris Lattner [Wed, 6 Oct 2004 16:34:23 +0000 (16:34 +0000)]
Rename method, change comment, add argument

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16771 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoCorrect some typeos
Chris Lattner [Wed, 6 Oct 2004 16:28:24 +0000 (16:28 +0000)]
Correct some typeos

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16770 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoInstcombine: -(X sdiv C) -> (X sdiv -C), tested by sub.ll:test16
Chris Lattner [Wed, 6 Oct 2004 15:08:25 +0000 (15:08 +0000)]
Instcombine: -(X sdiv C)  -> (X sdiv -C), tested by sub.ll:test16

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16769 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoNew testcase
Chris Lattner [Wed, 6 Oct 2004 15:07:56 +0000 (15:07 +0000)]
New testcase

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16768 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoRemove debugging code, fix encoding problem. This fixes the problems
Chris Lattner [Wed, 6 Oct 2004 14:31:50 +0000 (14:31 +0000)]
Remove debugging code, fix encoding problem.  This fixes the problems
the JIT had last night.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16766 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoTurning on fsel code gen now that we can do so would be good.
Nate Begeman [Wed, 6 Oct 2004 11:03:30 +0000 (11:03 +0000)]
Turning on fsel code gen now that we can do so would be good.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16765 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoImplement floating point select for lt, gt, le, ge using the powerpc fsel
Nate Begeman [Wed, 6 Oct 2004 09:53:04 +0000 (09:53 +0000)]
Implement floating point select for lt, gt, le, ge using the powerpc fsel
instruction.

Now, rather than emitting the following loop out of bisect:
.LBB_main_19: ; no_exit.0.i
rlwinm r3, r2, 3, 0, 28
lfdx f1, r3, r27
addis r3, r30, ha16(.CPI_main_1-"L00000$pb")
lfd f2, lo16(.CPI_main_1-"L00000$pb")(r3)
fsub f2, f2, f1
addis r3, r30, ha16(.CPI_main_1-"L00000$pb")
lfd f4, lo16(.CPI_main_1-"L00000$pb")(r3)
fcmpu cr0, f1, f4
bge .LBB_main_64 ; no_exit.0.i
.LBB_main_63: ; no_exit.0.i
b .LBB_main_65 ; no_exit.0.i
.LBB_main_64: ; no_exit.0.i
fmr f2, f1
.LBB_main_65: ; no_exit.0.i
addi r3, r2, 1
rlwinm r3, r3, 3, 0, 28
lfdx f1, r3, r27
addis r3, r30, ha16(.CPI_main_1-"L00000$pb")
lfd f4, lo16(.CPI_main_1-"L00000$pb")(r3)
fsub f4, f4, f1
addis r3, r30, ha16(.CPI_main_1-"L00000$pb")
lfd f5, lo16(.CPI_main_1-"L00000$pb")(r3)
fcmpu cr0, f1, f5
bge .LBB_main_67 ; no_exit.0.i
.LBB_main_66: ; no_exit.0.i
b .LBB_main_68 ; no_exit.0.i
.LBB_main_67: ; no_exit.0.i
fmr f4, f1
.LBB_main_68: ; no_exit.0.i
fadd f1, f2, f4
addis r3, r30, ha16(.CPI_main_2-"L00000$pb")
lfd f2, lo16(.CPI_main_2-"L00000$pb")(r3)
fmul f1, f1, f2
rlwinm r3, r2, 3, 0, 28
lfdx f2, r3, r28
fadd f4, f2, f1
fcmpu cr0, f4, f0
bgt .LBB_main_70 ; no_exit.0.i
.LBB_main_69: ; no_exit.0.i
b .LBB_main_71 ; no_exit.0.i
.LBB_main_70: ; no_exit.0.i
fmr f0, f4
.LBB_main_71: ; no_exit.0.i
fsub f1, f2, f1
addi r2, r2, -1
fcmpu cr0, f1, f3
blt .LBB_main_73 ; no_exit.0.i
.LBB_main_72: ; no_exit.0.i
b .LBB_main_74 ; no_exit.0.i
.LBB_main_73: ; no_exit.0.i
fmr f3, f1
.LBB_main_74: ; no_exit.0.i
cmpwi cr0, r2, -1
fmr f16, f0
fmr f17, f3
bgt .LBB_main_19 ; no_exit.0.i

We emit this instead:
.LBB_main_19: ; no_exit.0.i
rlwinm r3, r2, 3, 0, 28
lfdx f1, r3, r27
addis r3, r30, ha16(.CPI_main_1-"L00000$pb")
lfd f2, lo16(.CPI_main_1-"L00000$pb")(r3)
fsub f2, f2, f1
fsel f1, f1, f1, f2
addi r3, r2, 1
rlwinm r3, r3, 3, 0, 28
lfdx f2, r3, r27
addis r3, r30, ha16(.CPI_main_1-"L00000$pb")
lfd f4, lo16(.CPI_main_1-"L00000$pb")(r3)
fsub f4, f4, f2
fsel f2, f2, f2, f4
fadd f1, f1, f2
addis r3, r30, ha16(.CPI_main_2-"L00000$pb")
lfd f2, lo16(.CPI_main_2-"L00000$pb")(r3)
fmul f1, f1, f2
rlwinm r3, r2, 3, 0, 28
lfdx f2, r3, r28
fadd f4, f2, f1
fsub f5, f0, f4
fsel f0, f5, f0, f4
fsub f1, f2, f1
addi r2, r2, -1
fsub f2, f1, f3
fsel f3, f2, f3, f1
cmpwi cr0, r2, -1
fmr f16, f0
fmr f17, f3
bgt .LBB_main_19 ; no_exit.0.i

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16764 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoCodegen signed mod by 2 or -2 more efficiently. Instead of generating:
Chris Lattner [Wed, 6 Oct 2004 05:01:07 +0000 (05:01 +0000)]
Codegen signed mod by 2 or -2 more efficiently.  Instead of generating:

t:
        mov %EDX, DWORD PTR [%ESP + 4]
        mov %ECX, 2
        mov %EAX, %EDX
        sar %EDX, 31
        idiv %ECX
        mov %EAX, %EDX
        ret

Generate:
t:
        mov %ECX, DWORD PTR [%ESP + 4]
***     mov %EAX, %ECX
        cdq
        and %ECX, 1
        xor %ECX, %EDX
        sub %ECX, %EDX
***     mov %EAX, %ECX
        ret

Note that the two marked moves are redundant, and should be eliminated by the
register allocator, but aren't.

Compare this to GCC, which generates:

t:
        mov     %eax, DWORD PTR [%esp+4]
        mov     %edx, %eax
        shr     %edx, 31
        lea     %ecx, [%edx+%eax]
        and     %ecx, -2
        sub     %eax, %ecx
        ret

or ICC 8.0, which generates:

t:
        movl      4(%esp), %ecx                                 #3.5
        movl      $-2147483647, %eax                            #3.25
        imull     %ecx                                          #3.25
        movl      %ecx, %eax                                    #3.25
        sarl      $31, %eax                                     #3.25
        addl      %ecx, %edx                                    #3.25
        subl      %edx, %eax                                    #3.25
        addl      %eax, %eax                                    #3.25
        negl      %eax                                          #3.25
        subl      %eax, %ecx                                    #3.25
        movl      %ecx, %eax                                    #3.25
        ret                                                     #3.25

We would be in great shape if not for the moves.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16763 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoReally fix FreeBSD, which apparently doesn't tolerate the extern.
Chris Lattner [Wed, 6 Oct 2004 04:21:52 +0000 (04:21 +0000)]
Really fix FreeBSD, which apparently doesn't tolerate the extern.
Thanks to Jeff Cohen for pointing out my goof.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16762 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix a scary bug with signed division by a power of two. We used to generate:
Chris Lattner [Wed, 6 Oct 2004 04:19:43 +0000 (04:19 +0000)]
Fix a scary bug with signed division by a power of two.  We used to generate:

s:   ;; X / 4
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, %EAX
        sar %ECX, 1
        shr %ECX, 30
        mov %EDX, %EAX
        add %EDX, %ECX
        sar %EAX, 2
        ret

When we really meant:

s:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, %EAX
        sar %ECX, 1
        shr %ECX, 30
        add %EAX, %ECX
        sar %EAX, 2
        ret

Hey, this also reduces register pressure too :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16761 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoCodegen signed divides by 2 and -2 more efficiently. In particular
Chris Lattner [Wed, 6 Oct 2004 04:02:39 +0000 (04:02 +0000)]
Codegen signed divides by 2 and -2 more efficiently.  In particular
instead of:

s:   ;; X / 2
        movl 4(%esp), %eax
        movl %eax, %ecx
        shrl $31, %ecx
        movl %eax, %edx
        addl %ecx, %edx
        sarl $1, %eax
        ret

t:   ;; X / -2
        movl 4(%esp), %eax
        movl %eax, %ecx
        shrl $31, %ecx
        movl %eax, %edx
        addl %ecx, %edx
        sarl $1, %eax
        negl %eax
        ret

Emit:

s:
        movl 4(%esp), %eax
        cmpl $-2147483648, %eax
        sbbl $-1, %eax
        sarl $1, %eax
        ret

t:
        movl 4(%esp), %eax
        cmpl $-2147483648, %eax
        sbbl $-1, %eax
        sarl $1, %eax
        negl %eax
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16760 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd some new instructions. Fix the asm string for sbb32rr
Chris Lattner [Wed, 6 Oct 2004 04:01:02 +0000 (04:01 +0000)]
Add some new instructions.  Fix the asm string for sbb32rr

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16759 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoReduce code growth implied by the tail duplication pass by not duplicating
Chris Lattner [Wed, 6 Oct 2004 03:27:37 +0000 (03:27 +0000)]
Reduce code growth implied by the tail duplication pass by not duplicating
an instruction if it can be hoisted to a common dominator of the block.
This implements: test/Regression/Transforms/TailDup/MergeTest.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16758 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoWhen tail duplicating these functions, the add instruction should not be
Chris Lattner [Wed, 6 Oct 2004 03:26:38 +0000 (03:26 +0000)]
When tail duplicating these functions, the add instruction should not be
duplicated, even though the block it is in is duplicated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16757 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFreeBSD uses GCC. Patch contributed by Jeff Cohen!
Chris Lattner [Wed, 6 Oct 2004 03:15:44 +0000 (03:15 +0000)]
FreeBSD uses GCC.  Patch contributed by Jeff Cohen!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16756 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoFix the path to the fixinc'd headers. Patch contributed by Jeff Cohen!
Chris Lattner [Wed, 6 Oct 2004 03:13:47 +0000 (03:13 +0000)]
Fix the path to the fixinc'd headers.  Patch contributed by Jeff Cohen!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16755 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoMust include sys/stat.h before declaring a 'struct stat'
Brian Gaeke [Tue, 5 Oct 2004 18:46:59 +0000 (18:46 +0000)]
Must include sys/stat.h before declaring a 'struct stat'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16728 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoBuild BFtoLLVM example front-end by default
Brian Gaeke [Tue, 5 Oct 2004 18:05:53 +0000 (18:05 +0000)]
Build BFtoLLVM example front-end by default

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16719 91177308-0d34-0410-b5e6-96231b3b80d8

19 years agoAdd BFtoLLVM example front end
Brian Gaeke [Tue, 5 Oct 2004 18:05:25 +0000 (18:05 +0000)]
Add BFtoLLVM example front end

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16714 91177308-0d34-0410-b5e6-96231b3b80d8