oota-llvm.git
19 years agoAdd the StrNCmpOptimization which is similar to strcmp.
Reid Spencer [Tue, 3 May 2005 01:43:45 +0000 (01:43 +0000)]
Add the StrNCmpOptimization which is similar to strcmp.

Unfortunately, this optimization didn't trigger on any llvm-test tests.

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

19 years agoCorrect the title and the success criteria: strcmp -> strncmp
Reid Spencer [Tue, 3 May 2005 00:52:19 +0000 (00:52 +0000)]
Correct the title and the success criteria: strcmp -> strncmp

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

19 years agoAdd a new test case for the StrNCmpOptimization.
Reid Spencer [Tue, 3 May 2005 00:50:43 +0000 (00:50 +0000)]
Add a new test case for the StrNCmpOptimization.

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

19 years agoImplement the fprintf optimization which converts calls like this:
Reid Spencer [Mon, 2 May 2005 23:59:26 +0000 (23:59 +0000)]
Implement the fprintf optimization which converts calls like this:
  fprintf(F,"hello") -> fwrite("hello",strlen("hello"),1,F)
  fprintf(F,"%s","hello") -> fwrite("hello",strlen("hello"),1,F)
  fprintf(F,"%c",'x') -> fputc('c',F)

This optimization fires severals times in llvm-test:

313 MultiSource/Applications/Burg
302 MultiSource/Benchmarks/Prolangs-C/TimberWolfMC
189 MultiSource/Benchmarks/Prolangs-C/mybison
175 MultiSource/Benchmarks/Prolangs-C/football
130 MultiSource/Benchmarks/Prolangs-C/unix-tbl

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

19 years agoAdd a test case for testing the FPrintFOptimization.
Reid Spencer [Mon, 2 May 2005 23:07:14 +0000 (23:07 +0000)]
Add a test case for testing the FPrintFOptimization.

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

19 years agofold fp div by 0 to inf, the way gcc does. This is legal according to the FP spec
Andrew Lenharth [Mon, 2 May 2005 21:25:47 +0000 (21:25 +0000)]
fold fp div by 0 to inf, the way gcc does.  This is legal according to the FP spec

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

19 years agoRemove support for 1.0 style varargs
Andrew Lenharth [Mon, 2 May 2005 19:07:27 +0000 (19:07 +0000)]
Remove support for 1.0 style varargs

amusing of course, because we will have to go back to those semantics soon

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

19 years agoFixed a comment.
John Criswell [Mon, 2 May 2005 14:47:42 +0000 (14:47 +0000)]
Fixed a comment.

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

19 years agosupport multiplication by constant negative integers
Duraid Madina [Mon, 2 May 2005 07:27:14 +0000 (07:27 +0000)]
support multiplication by constant negative integers

this constmul code is still buggy though, so beware. mul by 7427 is currently
broken, for example. will fix it when I get a moment :)

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

19 years agoadd support for bools to SELECT, this fixes Prolangs-C/bison from the
Duraid Madina [Mon, 2 May 2005 06:41:13 +0000 (06:41 +0000)]
add support for bools to SELECT, this fixes Prolangs-C/bison from the
testsuite, however 09-vor is still dead (hopefully for other reasons!)

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

19 years agoMention that arguments to functions must be first class types.
Reid Spencer [Sun, 1 May 2005 22:22:57 +0000 (22:22 +0000)]
Mention that arguments to functions must be first class types.

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

19 years agoAdd accessor method,
Tanya Lattner [Sun, 1 May 2005 16:22:41 +0000 (16:22 +0000)]
Add accessor method,

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

19 years agoAdding ModuloSched SB.
Tanya Lattner [Sun, 1 May 2005 16:14:34 +0000 (16:14 +0000)]
Adding ModuloSched SB.

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

19 years agoImplement getelementptr.ll:test11
Chris Lattner [Sun, 1 May 2005 04:42:15 +0000 (04:42 +0000)]
Implement getelementptr.ll:test11

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

19 years agonew testcase
Chris Lattner [Sun, 1 May 2005 04:41:57 +0000 (04:41 +0000)]
new testcase

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

19 years agoCheck for volatile loads only once.
Chris Lattner [Sun, 1 May 2005 04:24:53 +0000 (04:24 +0000)]
Check for volatile loads only once.

Implement load.ll:test7

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

19 years agoadd a new testcase
Chris Lattner [Sun, 1 May 2005 04:24:15 +0000 (04:24 +0000)]
add a new testcase

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

19 years agoSMS for superblocks.
Tanya Lattner [Sun, 1 May 2005 01:27:47 +0000 (01:27 +0000)]
SMS for superblocks.

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

19 years agoAdded extra constructor for superblocks.
Tanya Lattner [Sun, 1 May 2005 01:25:53 +0000 (01:25 +0000)]
Added extra constructor for superblocks.

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

19 years agoFixed bug in searchPath function for finding nodes between two recurrences.
Tanya Lattner [Sat, 30 Apr 2005 23:07:59 +0000 (23:07 +0000)]
Fixed bug in searchPath function for finding nodes between two recurrences.

Changed dependence analyzer to only use dep distances of 2 or less.
This is experimental.

Changed MSchedGraph to be able to represent more then one BB (first steps).

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

19 years agoI was sure I had thought about this and there was a reason it should work.
Andrew Lenharth [Sat, 30 Apr 2005 14:19:13 +0000 (14:19 +0000)]
I was sure I had thought about this and there was a reason it should work.
But it is entirely possible I am just crazy.

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

19 years agoDo not use deprecated APIs
Alkis Evlogimenos [Sat, 30 Apr 2005 07:13:31 +0000 (07:13 +0000)]
Do not use deprecated APIs

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

19 years agoFix a comment that stated the wrong thing.
Reid Spencer [Sat, 30 Apr 2005 06:45:47 +0000 (06:45 +0000)]
Fix a comment that stated the wrong thing.

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

19 years agoEliminate some random whitespace
Chris Lattner [Sat, 30 Apr 2005 04:44:07 +0000 (04:44 +0000)]
Eliminate some random whitespace

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

19 years agoCodegen and legalize sin/cos/llvm.sqrt as FSIN/FCOS/FSQRT calls. This patch
Chris Lattner [Sat, 30 Apr 2005 04:43:14 +0000 (04:43 +0000)]
Codegen and legalize sin/cos/llvm.sqrt as FSIN/FCOS/FSQRT calls.  This patch
was contributed by Morten Ofstad, with some minor tweaks and bug fixes added
by me.

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

19 years agoadd sin/cos tests
Chris Lattner [Sat, 30 Apr 2005 04:41:27 +0000 (04:41 +0000)]
add sin/cos tests

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

19 years agoDoesn't support these nodes
Chris Lattner [Sat, 30 Apr 2005 04:26:56 +0000 (04:26 +0000)]
Doesn't support these nodes

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

19 years agoThis target doesn't support the FSIN/FCOS/FSQRT nodes yet
Chris Lattner [Sat, 30 Apr 2005 04:26:06 +0000 (04:26 +0000)]
This target doesn't support the FSIN/FCOS/FSQRT nodes yet

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

19 years agoAdd support for FSIN/FCOS when unsafe math ops are enabled. Patch contributed by
Chris Lattner [Sat, 30 Apr 2005 04:25:35 +0000 (04:25 +0000)]
Add support for FSIN/FCOS when unsafe math ops are enabled. Patch contributed by
Morten Ofstad!

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

19 years agoAdd support for llvm.sqrt and sin/cos if unsafe math optimizations are enabled.
Chris Lattner [Sat, 30 Apr 2005 04:12:40 +0000 (04:12 +0000)]
Add support for llvm.sqrt and sin/cos if unsafe math optimizations are enabled.

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

19 years agoExpose an option allowing unsafe math optimizations. Patch contributed by
Chris Lattner [Sat, 30 Apr 2005 04:09:52 +0000 (04:09 +0000)]
Expose an option allowing unsafe math optimizations.  Patch contributed by
Morten Ofstad!

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

19 years agoLower llvm.sqrt -> fsqrt/sqrt
Chris Lattner [Sat, 30 Apr 2005 04:07:50 +0000 (04:07 +0000)]
Lower llvm.sqrt -> fsqrt/sqrt

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

19 years agoAdd a test for llvm.sqrt
Chris Lattner [Sat, 30 Apr 2005 04:07:15 +0000 (04:07 +0000)]
Add a test for llvm.sqrt

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

19 years agoAdd llvm.sqrt intrinsic, patch contributed by Morten Ofstad
Chris Lattner [Sat, 30 Apr 2005 03:44:07 +0000 (03:44 +0000)]
Add llvm.sqrt intrinsic, patch contributed by Morten Ofstad

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

19 years ago* Don't depend on "guessing" what a FILE* is, just require that the actual
Reid Spencer [Sat, 30 Apr 2005 03:17:54 +0000 (03:17 +0000)]
* Don't depend on "guessing" what a FILE* is, just require that the actual
  type be obtained from a CallInst we're optimizing.
* Make it possible for getConstantStringLength to return the ConstantArray
  that it extracts in case the content is needed by an Optimization.
* Implement the strcmp optimization
* Implement the toascii optimization

This pass is now firing several to many times in the following MultiSource
tests:

Applications/Burg      -   7 (strcat,strcpy)
Applications/siod      -  13 (strcat,strcpy,strlen)
Applications/spiff     - 120 (exit,fputs,strcat,strcpy,strlen)
Applications/treecc    -  66 (exit,fputs,strcat,strcpy)
Applications/kimwitu++ -  34 (strcmp,strcpy,strlen)
Applications/SPASS     - 588 (exit,fputs,strcat,strcpy,strlen)

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

19 years ago* Fix signed/unsigned usage problem
Reid Spencer [Sat, 30 Apr 2005 03:06:36 +0000 (03:06 +0000)]
* Fix signed/unsigned usage problem
* Rearrange for readability.

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

19 years agoA new test case for the ToAsciiOptimizer.
Reid Spencer [Sat, 30 Apr 2005 01:00:52 +0000 (01:00 +0000)]
A new test case for the ToAsciiOptimizer.

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

19 years agoA new test case for the StrCmpOptimization in -simplify-libcalls.
Reid Spencer [Sat, 30 Apr 2005 00:52:04 +0000 (00:52 +0000)]
A new test case for the StrCmpOptimization in -simplify-libcalls.

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

19 years agoThis is StrCpy, NOT StrCat!
Reid Spencer [Fri, 29 Apr 2005 23:02:15 +0000 (23:02 +0000)]
This is StrCpy, NOT StrCat!

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

19 years agoGet the name of the pass right in the documentation.
Reid Spencer [Fri, 29 Apr 2005 23:01:21 +0000 (23:01 +0000)]
Get the name of the pass right in the documentation.

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

19 years agoFix the success criteria for the test to make call instructions with "pow"
Reid Spencer [Fri, 29 Apr 2005 10:11:23 +0000 (10:11 +0000)]
Fix the success criteria for the test to make call instructions with "pow"
not just any occurrence of "pow".

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

19 years agoActually make this pass test something related to fputs.
Reid Spencer [Fri, 29 Apr 2005 10:10:17 +0000 (10:10 +0000)]
Actually make this pass test something related to fputs.

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

19 years agoImplement the optimizations for "pow" and "fputs" library calls.
Reid Spencer [Fri, 29 Apr 2005 09:39:47 +0000 (09:39 +0000)]
Implement the optimizations for "pow" and "fputs" library calls.

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

19 years agoAdd a test case for the puts libcall optimization.
Reid Spencer [Fri, 29 Apr 2005 07:19:00 +0000 (07:19 +0000)]
Add a test case for the puts libcall optimization.

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

19 years agoAdd a testcase for optimizing the strcpy libcall.
Reid Spencer [Fri, 29 Apr 2005 06:01:28 +0000 (06:01 +0000)]
Add a testcase for optimizing the strcpy libcall.

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

19 years agoRemove optimizations that don't require both operands to be constant. These
Reid Spencer [Fri, 29 Apr 2005 05:55:35 +0000 (05:55 +0000)]
Remove optimizations that don't require both operands to be constant. These
are moved to simplify-libcalls pass.

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

19 years agoNew test case for testing pow(3) math library optimizations.
Reid Spencer [Fri, 29 Apr 2005 05:47:05 +0000 (05:47 +0000)]
New test case for testing pow(3) math library optimizations.

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

19 years agoConsistently use 'class' to silence VC++
Jeff Cohen [Fri, 29 Apr 2005 03:05:44 +0000 (03:05 +0000)]
Consistently use 'class' to silence VC++

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

19 years ago* Add constant folding for additional floating point library calls such as
Reid Spencer [Thu, 28 Apr 2005 23:01:59 +0000 (23:01 +0000)]
* Add constant folding for additional floating point library calls such as
  sinh, cosh, etc.
* Make the name comparisons for the fp libcalls a little more efficient by
  switching on the first character of the name before doing comparisons.

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

19 years agoAdd support for FSQRT node, patch contributed by Morten Ofstad
Chris Lattner [Thu, 28 Apr 2005 22:07:18 +0000 (22:07 +0000)]
Add support for FSQRT node, patch contributed by Morten Ofstad

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

19 years agoThese functions can set errno!
Chris Lattner [Thu, 28 Apr 2005 21:52:31 +0000 (21:52 +0000)]
These functions can set errno!

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

19 years agoAdd some new X86 instrs, patch contributed by Morten Ofstad
Chris Lattner [Thu, 28 Apr 2005 21:50:05 +0000 (21:50 +0000)]
Add some new X86 instrs, patch contributed by Morten Ofstad

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

19 years agoCodegen fabs/fabsf as FABS. Patch contributed by Morten Ofstad
Chris Lattner [Thu, 28 Apr 2005 21:48:42 +0000 (21:48 +0000)]
Codegen fabs/fabsf as FABS.  Patch contributed by Morten Ofstad

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

19 years agoLegalize FSQRT, FSIN, FCOS nodes, patch contributed by Morten Ofstad
Chris Lattner [Thu, 28 Apr 2005 21:44:33 +0000 (21:44 +0000)]
Legalize FSQRT, FSIN, FCOS nodes, patch contributed by Morten Ofstad

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

19 years agoAdd FSQRT, FSIN, FCOS nodes, patch contributed by Morten Ofstad
Chris Lattner [Thu, 28 Apr 2005 21:44:03 +0000 (21:44 +0000)]
Add FSQRT, FSIN, FCOS nodes, patch contributed by Morten Ofstad

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

19 years agoRemove from the TODO list those optimizations that are already handled by
Reid Spencer [Thu, 28 Apr 2005 18:05:16 +0000 (18:05 +0000)]
Remove from the TODO list those optimizations that are already handled by
constant folding implemented in lib/Transforms/Utils/Local.cpp.

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

19 years agoDocument additional libcall transformations that need to be written.
Reid Spencer [Thu, 28 Apr 2005 04:40:06 +0000 (04:40 +0000)]
Document additional libcall transformations that need to be written.

Help Wanted!

There's a lot of them to write.

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

19 years agoDoxygenate.
Reid Spencer [Wed, 27 Apr 2005 21:29:20 +0000 (21:29 +0000)]
Doxygenate.

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

19 years agoremove 'statement with no effect' warning
Chris Lattner [Wed, 27 Apr 2005 20:12:17 +0000 (20:12 +0000)]
remove 'statement with no effect' warning

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

19 years agoImplement Value* tracking for loads and stores in the selection DAG. This enables...
Andrew Lenharth [Wed, 27 Apr 2005 20:10:01 +0000 (20:10 +0000)]
Implement Value* tracking for loads and stores in the selection DAG.  This enables one to use alias analysis in the backends.

(TRUNK)Stores and (EXT|ZEXT|SEXT)Loads have an extra SDOperand which is a SrcValueSDNode which contains the Value*.  Note that if the operation is introduced by the backend, it will still have the operand, but the value* will be null.

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

19 years agoUnbreak the sparc backend.
Chris Lattner [Wed, 27 Apr 2005 18:57:15 +0000 (18:57 +0000)]
Unbreak the sparc backend.

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

19 years agoMore Cleanup:
Reid Spencer [Wed, 27 Apr 2005 17:46:54 +0000 (17:46 +0000)]
More Cleanup:
* Name the instructions by appending to name of original
* Factor common part out of a switch statement.

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

19 years agoimport fix and plot multiple lines at once
Andrew Lenharth [Wed, 27 Apr 2005 17:32:41 +0000 (17:32 +0000)]
import fix and plot multiple lines at once

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

19 years agoGenerate a gnuplot script for any program and any test (like llc or gcc)
Andrew Lenharth [Wed, 27 Apr 2005 16:41:50 +0000 (16:41 +0000)]
Generate a gnuplot script for any program and any test (like llc or gcc)

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

19 years agoSo you want to import nightly tester data into a data base? Have we got the perl...
Andrew Lenharth [Wed, 27 Apr 2005 16:03:01 +0000 (16:03 +0000)]
So you want to import nightly tester data into a data base?  Have we got the perl script for you

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

19 years agofix for parse, and a start at db import. Using CVS as scp :)
Andrew Lenharth [Wed, 27 Apr 2005 14:57:26 +0000 (14:57 +0000)]
fix for parse, and a start at db import.  Using CVS as scp :)

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

19 years agoclean up some warnings
Duraid Madina [Wed, 27 Apr 2005 11:57:39 +0000 (11:57 +0000)]
clean up some warnings

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

19 years agoThis is a cleanup commit:
Reid Spencer [Wed, 27 Apr 2005 07:54:40 +0000 (07:54 +0000)]
This is a cleanup commit:
* Correct stale documentation in a few places
* Re-order the file to better associate things and reduce line count
* Make the pass thread safe by caching the Function* objects needed by the
  optimizers in the pass object instead of globally.
* Provide the SimplifyLibCalls pass object to the optimizer classes so they
  can access cached Function* objects and TargetData info
* Make sure the pass resets its cache if the Module passed to runOnModule
  changes
* Rename CallOptimizer LibCallOptimization. All the classes are named
  *Optimization while the objects are *Optimizer.
* Don't cache Function* in the optimizer objects because they could be used
  by multiple PassManager's running in multiple threads
* Add an optimization for strcpy which is similar to strcat
* Add a "TODO" list at the end of the file for ideas on additional libcall
  optimizations that could be added (get ideas from other compilers).

Sorry for the huge diff. Its mostly reorganization of code. That won't
happen again as I believe the design and infrastructure for this pass is
now done or close to it.

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

19 years agodetect functions that never return, and turn the instruction following a
Chris Lattner [Wed, 27 Apr 2005 04:52:23 +0000 (04:52 +0000)]
detect functions that never return, and turn  the instruction following a
call to them into an 'unreachable' instruction.

This triggers a bunch of times, particularly on gcc:

gzip: 36
gcc: 601
eon: 12
bzip: 38

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

19 years agoTest the noreturn function optimization
Chris Lattner [Wed, 27 Apr 2005 04:51:01 +0000 (04:51 +0000)]
Test the noreturn function optimization

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

19 years agoAdd the simplify-libcalls pass.
Reid Spencer [Wed, 27 Apr 2005 02:22:47 +0000 (02:22 +0000)]
Add the simplify-libcalls pass.

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

19 years agoA first step towards being able to do more interesting things with the nightly tester...
Andrew Lenharth [Wed, 27 Apr 2005 02:13:20 +0000 (02:13 +0000)]
A first step towards being able to do more interesting things with the nightly tester data.  Moreinteresting things will come soon, so tune in

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

19 years agoPrefix the debug statistics so they group together.
Reid Spencer [Wed, 27 Apr 2005 00:20:23 +0000 (00:20 +0000)]
Prefix the debug statistics so they group together.

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

19 years agoIn debug builds, make a statistic for each kind of call optimization. This
Reid Spencer [Wed, 27 Apr 2005 00:05:45 +0000 (00:05 +0000)]
In debug builds, make a statistic for each kind of call optimization. This
helps track down what gets triggered in the pass so its easier to identify
good test cases.

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

19 years agoThis analysis doesn't take 'throwing' into consideration, it looks at
Chris Lattner [Tue, 26 Apr 2005 23:53:25 +0000 (23:53 +0000)]
This analysis doesn't take 'throwing' into consideration, it looks at
'unwinding'

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

19 years agoFix up the debug statement to actually use a newline .. radical concept.
Reid Spencer [Tue, 26 Apr 2005 23:07:08 +0000 (23:07 +0000)]
Fix up the debug statement to actually use a newline .. radical concept.

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

19 years agoUh, this isn't argpromotion.
Reid Spencer [Tue, 26 Apr 2005 23:05:17 +0000 (23:05 +0000)]
Uh, this isn't argpromotion.

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

19 years agoAdd some debugging output so we can tell which calls are getting triggered
Reid Spencer [Tue, 26 Apr 2005 23:02:16 +0000 (23:02 +0000)]
Add some debugging output so we can tell which calls are getting triggered

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

19 years agono parens
Chris Lattner [Tue, 26 Apr 2005 22:57:07 +0000 (22:57 +0000)]
no parens

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

19 years agoupdate some paths
Chris Lattner [Tue, 26 Apr 2005 22:56:16 +0000 (22:56 +0000)]
update some paths

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

19 years agoNo, seriously folks, memcpy really does return void.
Reid Spencer [Tue, 26 Apr 2005 22:49:48 +0000 (22:49 +0000)]
No, seriously folks, memcpy really does return void.

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

19 years agomemcpy returns void!!!!!
Reid Spencer [Tue, 26 Apr 2005 22:46:23 +0000 (22:46 +0000)]
memcpy returns void!!!!!

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

19 years agoConvert the remainder of the intrinsic function prototypes to "declare"
Reid Spencer [Tue, 26 Apr 2005 20:50:44 +0000 (20:50 +0000)]
Convert the remainder of the intrinsic function prototypes to "declare"
form from the "call" form.

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

19 years agoUse the declare syntax not the call syntax for intrinsic prototypes so
Reid Spencer [Tue, 26 Apr 2005 20:41:16 +0000 (20:41 +0000)]
Use the declare syntax not the call syntax for intrinsic prototypes so
the uninitiated reader is not confused.

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

19 years agodon't let Reid build void*'s :)
Chris Lattner [Tue, 26 Apr 2005 20:03:33 +0000 (20:03 +0000)]
don't let Reid build void*'s :)

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

19 years agoFix some bugs found by running on llvm-test:
Reid Spencer [Tue, 26 Apr 2005 19:55:57 +0000 (19:55 +0000)]
Fix some bugs found by running on llvm-test:
* MemCpyOptimization can only be optimized if the 3rd and 4th arguments are
  constants and we weren't checking for that.
* The result of llvm.memcpy (and llvm.memmove) is void* not sbyte*, put in
  a cast.

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

19 years agoChanges From Review Feedback:
Reid Spencer [Tue, 26 Apr 2005 19:13:17 +0000 (19:13 +0000)]
Changes From Review Feedback:
* Have the SimplifyLibCalls pass acquire the TargetData and pass it down to
  the optimization classes so they can use it to make better choices for
  the signatures of functions, etc.
* Rearrange the code a little so the utility functions are closer to their
  usage and keep the core of the pass near the top of the files.
* Adjust the StrLen pass to get/use the correct prototype depending on the
  TargetData::getIntPtrType() result. The result of strlen is size_t which
  could be either uint or ulong depending on the platform.
* Clean up some coding nits (cast vs. dyn_cast, remove redundant items from
  a switch, etc.)
* Implement the MemMoveOptimization as a twin of MemCpyOptimization (they
  only differ in name).

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

19 years agoAdd a test case for MemMove.ll
Reid Spencer [Tue, 26 Apr 2005 19:05:51 +0000 (19:05 +0000)]
Add a test case for MemMove.ll

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

19 years agoResult of strlen is size_t which is either uint or ulong, not int.
Reid Spencer [Tue, 26 Apr 2005 19:04:46 +0000 (19:04 +0000)]
Result of strlen is size_t which is either uint or ulong, not int.

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

19 years agoMake interval partition print correctly, patch contributed by
Chris Lattner [Tue, 26 Apr 2005 14:48:28 +0000 (14:48 +0000)]
Make interval partition print correctly, patch contributed by
Vladimir Prus!

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

19 years agoFix the compile failures from last night.
Chris Lattner [Tue, 26 Apr 2005 14:40:41 +0000 (14:40 +0000)]
Fix the compile failures from last night.

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

19 years agoconstmul bugfix: multiply by 27611 was broken
Duraid Madina [Tue, 26 Apr 2005 09:42:50 +0000 (09:42 +0000)]
constmul bugfix: multiply by 27611 was broken

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

19 years agoclean up the code! (oops) lots more cleaning left, however.
Duraid Madina [Tue, 26 Apr 2005 08:43:47 +0000 (08:43 +0000)]
clean up the code! (oops) lots more cleaning left, however.

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

19 years ago* Merge get_GVInitializer and getCharArrayLength into a single function
Reid Spencer [Tue, 26 Apr 2005 07:45:18 +0000 (07:45 +0000)]
* Merge get_GVInitializer and getCharArrayLength into a single function
  named getConstantStringLength. This is the common part of StrCpy and
  StrLen optimizations and probably several others, yet to be written. It
  performs all the validity checks for looking at constant arrays that are
  supposed to be null-terminated strings and then computes the actual
  length of the string.
* Implement the MemCpyOptimization class. This just turns memcpy of 1, 2, 4
  and 8 byte data blocks that are properly aligned on those boundaries into
  a load and a store. Much more could be done here but alignment
  restrictions and lack of knowledge of the target instruction set prevent
  use from doing significantly more. That will have to be delegated to the
  code generators as they lower llvm.memcpy calls.

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

19 years agoAdd a new test case for the llvm.memcpy simplification case.
Reid Spencer [Tue, 26 Apr 2005 07:40:40 +0000 (07:40 +0000)]
Add a new test case for the llvm.memcpy simplification case.

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

19 years ago* Add code to reduce multiplies by constant integers to shifts, adds and
Duraid Madina [Tue, 26 Apr 2005 07:23:02 +0000 (07:23 +0000)]
* Add code to reduce multiplies by constant integers to shifts, adds and
  subtracts. This is a very rough and nasty implementation of Lefevre's
  "pattern finding" algorithm. With a few small changes though, it should
  end up beating most other methods in common use, regardless of the size
  of the constant (currently, it's often one or two shifts worse)

  TODO: rewrite it so it's not hideously ugly (this is a translation from
        perl, which doesn't help ;)
        bypass most of it for multiplies by 2^n+1
(eventually) teach it that some combinations of shift+add are
cheaper than others (e.g. shladd on ia64, scaled adds on alpha)
get it to try multiple booth encodings in search of the cheapest
routine
make it work for negative constants

  This is hacked up as a DAG->DAG transform, so once I clean it up I hope
  it'll be pulled out of here and put somewhere else. The only thing backends
  should really have to worry about for now is where to draw the line
  between using this code vs. going ahead and doing an integer multiply
  anyway.

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

19 years ago* Implement StrLenOptimization
Reid Spencer [Tue, 26 Apr 2005 05:24:00 +0000 (05:24 +0000)]
* Implement StrLenOptimization
* Factor out commonalities between StrLenOptimization and StrCatOptimization
* Make sure that signatures return sbyte* not void*

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

19 years ago* Add a test case for StrLenOptimization
Reid Spencer [Tue, 26 Apr 2005 05:22:38 +0000 (05:22 +0000)]
* Add a test case for StrLenOptimization
* Rename ExitInMain and StrCat tests so they don't have the date the
  regression was entered since they are feature tests, not regressions.

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

19 years agoIncorporate feedback from Chris:
Reid Spencer [Tue, 26 Apr 2005 03:26:15 +0000 (03:26 +0000)]
Incorporate feedback from Chris:
* Change signatures of OptimizeCall and ValidateCalledFunction so they are
  non-const, allowing the optimization object to be modified. This is in
  support of caching things used across multiple calls.
* Provide two functions for constructing and caching function types
* Modify the StrCatOptimization to cache Function objects for strlen and
  llvm.memcpy so it doesn't regenerate them on each call site. Make sure
  these are invalidated each time we start the pass.
* Handle both a GEP Instruction and a GEP ConstantExpr
* Add additional checks to make sure we really are dealing with an arary of
  sbyte and that all the element initializers are ConstantInt or
  ConstantExpr that reduce to ConstantInt.
* Make sure the GlobalVariable is constant!
* Don't use ConstantArray::getString as it can fail and it doesn't give us
  the right thing. We must check for null bytes in the middle of the array.
* Use llvm.memcpy instead of memcpy so we can factor alignment into it.
* Don't use void* types in signatures, replace with sbyte* instead.

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

19 years agoAdd SimplyLibCalls.cpp to VC++ build
Jeff Cohen [Tue, 26 Apr 2005 02:57:49 +0000 (02:57 +0000)]
Add SimplyLibCalls.cpp to VC++ build

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