oota-llvm.git
19 years agoAdd a more difficult testcase which uses a call to a helper function to do
Chris Lattner [Tue, 27 Sep 2005 04:44:04 +0000 (04:44 +0000)]
Add a more difficult testcase which uses a call to a helper function to do
the initialization

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

19 years agoRefactor this code a bit, no functionality changes.
Chris Lattner [Tue, 27 Sep 2005 04:27:01 +0000 (04:27 +0000)]
Refactor this code a bit, no functionality changes.

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

19 years agoMove the post-lsr simplify cfg pass after lowereh, so it can clean up after
Chris Lattner [Tue, 27 Sep 2005 00:14:41 +0000 (00:14 +0000)]
Move the post-lsr simplify cfg pass after lowereh, so it can clean up after
eh lowering as well.

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

19 years agominor pattern shuffling
Chris Lattner [Mon, 26 Sep 2005 22:20:16 +0000 (22:20 +0000)]
minor pattern shuffling

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

19 years agomemoize the assert results
Chris Lattner [Mon, 26 Sep 2005 22:10:24 +0000 (22:10 +0000)]
memoize the assert results

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

19 years agoEmit the switch stmt cases in alphabetical order instead of pointer order,
Chris Lattner [Mon, 26 Sep 2005 21:59:35 +0000 (21:59 +0000)]
Emit the switch stmt cases in alphabetical order instead of pointer order,
which is not stable.

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

19 years agoAddition of a simple two pass scheduler. This version is currently hacked up
Jim Laskey [Mon, 26 Sep 2005 21:57:04 +0000 (21:57 +0000)]
Addition of a simple two pass scheduler.  This version is currently hacked up
for testing and will require target machine info to do a proper scheduling.
The simple scheduler can be turned on using -sched=simple (defaults
to -sched=none)

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

19 years agoimplement a fixme: only select values once, even if used multiple times.
Chris Lattner [Mon, 26 Sep 2005 21:53:26 +0000 (21:53 +0000)]
implement a fixme: only select values once, even if used multiple times.

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

19 years agoRemove some dead code. ctor evaluation subsumes empty ctor elim
Chris Lattner [Mon, 26 Sep 2005 20:38:20 +0000 (20:38 +0000)]
Remove some dead code.  ctor evaluation subsumes empty ctor elim

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

19 years agoAdd support for alloca, implementing ctor-list-opt.ll:CTOR6
Chris Lattner [Mon, 26 Sep 2005 17:07:09 +0000 (17:07 +0000)]
Add support for alloca, implementing ctor-list-opt.ll:CTOR6

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

19 years agoTestcase that uses an alloca
Chris Lattner [Mon, 26 Sep 2005 17:06:32 +0000 (17:06 +0000)]
Testcase that uses an alloca

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

19 years agoAdd a debug printout, fix a crash on kc++
Chris Lattner [Mon, 26 Sep 2005 07:34:35 +0000 (07:34 +0000)]
Add a debug printout, fix a crash on kc++

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

19 years agoImplement loads/stores through GEP's of globals. This implements
Chris Lattner [Mon, 26 Sep 2005 06:52:44 +0000 (06:52 +0000)]
Implement loads/stores through GEP's of globals.  This implements
ctor-list-opt.ll:CTOR5.

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

19 years agoadd another case, this one that uses getelementptr instructions
Chris Lattner [Mon, 26 Sep 2005 06:51:50 +0000 (06:51 +0000)]
add another case, this one that uses getelementptr instructions

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

19 years agoReplace TraverseGEPInitializer with ConstantFoldLoadThroughGEPConstantExpr
Chris Lattner [Mon, 26 Sep 2005 05:34:07 +0000 (05:34 +0000)]
Replace TraverseGEPInitializer with ConstantFoldLoadThroughGEPConstantExpr

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

19 years agoEliminate GetGEPGlobalInitializer in favor of the more powerful
Chris Lattner [Mon, 26 Sep 2005 05:28:52 +0000 (05:28 +0000)]
Eliminate GetGEPGlobalInitializer in favor of the more powerful
ConstantFoldLoadThroughGEPConstantExpr function in the utils lib.

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

19 years agoFactor the GetGEPGlobalInitializer out of this pass and into Transforms/Utils
Chris Lattner [Mon, 26 Sep 2005 05:28:06 +0000 (05:28 +0000)]
Factor the GetGEPGlobalInitializer out of this pass and into Transforms/Utils
as ConstantFoldLoadThroughGEPConstantExpr.

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

19 years agoMove the ConstantFoldLoadThroughGEPConstantExpr function out of the InstCombine
Chris Lattner [Mon, 26 Sep 2005 05:27:10 +0000 (05:27 +0000)]
Move the ConstantFoldLoadThroughGEPConstantExpr function out of the InstCombine
pass.

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

19 years agoadd a new function
Chris Lattner [Mon, 26 Sep 2005 05:26:32 +0000 (05:26 +0000)]
add a new function

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

19 years agoadd a comment
Chris Lattner [Mon, 26 Sep 2005 05:16:34 +0000 (05:16 +0000)]
add a comment

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

19 years agoAdd support for getelementptr, load, and correctly reject volatile stores.
Chris Lattner [Mon, 26 Sep 2005 05:15:37 +0000 (05:15 +0000)]
Add support for getelementptr, load, and correctly reject volatile stores.

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

19 years agoadd a test for load
Chris Lattner [Mon, 26 Sep 2005 05:14:48 +0000 (05:14 +0000)]
add a test for load

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

19 years agoAdd support for br/brcond/switch and phi
Chris Lattner [Mon, 26 Sep 2005 04:57:38 +0000 (04:57 +0000)]
Add support for br/brcond/switch and phi

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

19 years agoadd another testcase with simple control flow
Chris Lattner [Mon, 26 Sep 2005 04:57:10 +0000 (04:57 +0000)]
add another testcase with simple control flow

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

19 years agoAdd a simple interpreter to this code, allowing us to statically evaluate
Chris Lattner [Mon, 26 Sep 2005 04:44:35 +0000 (04:44 +0000)]
Add a simple interpreter to this code, allowing us to statically evaluate
global ctors that are simple enough.  This implements ctor-list-opt.ll:CTOR2.

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

19 years agomake this harder: put some code into it
Chris Lattner [Mon, 26 Sep 2005 04:43:01 +0000 (04:43 +0000)]
make this harder: put some code into it

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

19 years agofactor some code into a InstallGlobalCtors method, add comments. No functionality...
Chris Lattner [Mon, 26 Sep 2005 02:31:18 +0000 (02:31 +0000)]
factor some code into a InstallGlobalCtors method, add comments.  No functionality change.

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

19 years agoMake the global opt optimizer work on modules with a null terminator, by
Chris Lattner [Mon, 26 Sep 2005 02:19:27 +0000 (02:19 +0000)]
Make the global opt optimizer work on modules with a null terminator, by
accepting the null even with a non-65535 init prio

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

19 years agoFactor this code out into a few methods.
Chris Lattner [Mon, 26 Sep 2005 01:43:45 +0000 (01:43 +0000)]
Factor this code out into a few methods.
Implement the start of global ctor optimization.  It is currently smart
enough to remove the global ctor for cases like this:

struct foo {
  foo() {}
} x;

... saving a bit of startup time for the program.

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

19 years agonew testcase for static ctor list optimizations
Chris Lattner [Mon, 26 Sep 2005 01:42:03 +0000 (01:42 +0000)]
new testcase for static ctor list optimizations

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

19 years agoFix VC++ build errors.
Jeff Cohen [Sun, 25 Sep 2005 19:04:43 +0000 (19:04 +0000)]
Fix VC++ build errors.

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

19 years agoFix some logic I broke that caused a regression on
Chris Lattner [Sun, 25 Sep 2005 07:06:48 +0000 (07:06 +0000)]
Fix some logic I broke that caused a regression on
SimplifyLibCalls/2005-05-20-sprintf-crash.ll

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

19 years agoMove MaskedValueIsZero up.
Chris Lattner [Sat, 24 Sep 2005 23:43:33 +0000 (23:43 +0000)]
Move MaskedValueIsZero up.
Match a bunch of idioms for sign extensions, implementing InstCombine/signext.ll

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

19 years agoAll of these should turn into sign extends (e.g. extsh/extsb on PPC)
Chris Lattner [Sat, 24 Sep 2005 23:42:18 +0000 (23:42 +0000)]
All of these should turn into sign extends (e.g. extsh/extsb on PPC)

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

19 years agoAdd long-overdue helpers for getting constants with known upper bits
Chris Lattner [Sat, 24 Sep 2005 22:57:28 +0000 (22:57 +0000)]
Add long-overdue helpers for getting constants with known upper bits

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

19 years agoSimplify this code a bit by relying on recursive simplification. Support
Chris Lattner [Sat, 24 Sep 2005 22:17:06 +0000 (22:17 +0000)]
Simplify this code a bit by relying on recursive simplification.  Support
sprintf("%s", P)'s that have uses.

s/hasNUses(0)/use_empty()/

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

19 years agoEnhance this to check for a crash, add a case that crashes simplifylibcalls,
Chris Lattner [Sat, 24 Sep 2005 22:16:04 +0000 (22:16 +0000)]
Enhance this to check for a crash, add a case that crashes simplifylibcalls,
and add a case that has uses.

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

19 years agonew testcase that crashes the CFE
Chris Lattner [Sat, 24 Sep 2005 20:54:33 +0000 (20:54 +0000)]
new testcase that crashes the CFE

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

19 years agonew testcase for PR630
Chris Lattner [Sat, 24 Sep 2005 08:38:28 +0000 (08:38 +0000)]
new testcase for PR630

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

19 years agoAdd support for a marker byte that indicates that we shouldn't add the user
Chris Lattner [Sat, 24 Sep 2005 08:24:28 +0000 (08:24 +0000)]
Add support for a marker byte that indicates that we shouldn't add the user
prefix to a symbol name

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

19 years agochange proto slightly
Chris Lattner [Sat, 24 Sep 2005 08:23:53 +0000 (08:23 +0000)]
change proto slightly

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

19 years agomemoize translations
Chris Lattner [Sat, 24 Sep 2005 00:50:51 +0000 (00:50 +0000)]
memoize translations

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

19 years agoTeach the dag isel generator how to construct arbitrary immediates. The
Chris Lattner [Sat, 24 Sep 2005 00:41:58 +0000 (00:41 +0000)]
Teach the dag isel generator how to construct arbitrary immediates.  The
generated isel now tries li then lis, then lis+ori.

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

19 years agoTeach the DAG isel generator to emit code that creates nodes.
Chris Lattner [Sat, 24 Sep 2005 00:40:24 +0000 (00:40 +0000)]
Teach the DAG isel generator to emit code that creates nodes.

Fix a few corner cases parsing things like (i32 imm:$foo)

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

19 years agoEmit better code (no more copies for var references), and support DAG patterns
Chris Lattner [Fri, 23 Sep 2005 23:16:51 +0000 (23:16 +0000)]
Emit better code (no more copies for var references), and support DAG patterns
(e.g. things like rotates).

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

19 years agoFix a fixme by passing around SDOperand's instead of SDNode*'s
Chris Lattner [Fri, 23 Sep 2005 21:53:45 +0000 (21:53 +0000)]
Fix a fixme by passing around SDOperand's instead of SDNode*'s

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

19 years agoEmit code that matches the incoming DAG pattern and checks predicates.
Chris Lattner [Fri, 23 Sep 2005 21:33:23 +0000 (21:33 +0000)]
Emit code that matches the incoming DAG pattern and checks predicates.
This does not check that types match yet, but PPC only has one integer type
;-).

This also doesn't have the code to build the resultant dag.

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

19 years agoemit information about the order patterns are to be matched.
Chris Lattner [Fri, 23 Sep 2005 20:52:47 +0000 (20:52 +0000)]
emit information about the order patterns are to be matched.

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

19 years agostart filling in the switch stmt
Chris Lattner [Fri, 23 Sep 2005 19:36:15 +0000 (19:36 +0000)]
start filling in the switch stmt

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

19 years agoremove some debugging code
Chris Lattner [Fri, 23 Sep 2005 18:49:09 +0000 (18:49 +0000)]
remove some debugging code

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

19 years agoFold two consequtive branches that share a common destination between them.
Chris Lattner [Fri, 23 Sep 2005 18:47:20 +0000 (18:47 +0000)]
Fold two consequtive branches that share a common destination between them.
This implements SimplifyCFG/branch-fold.ll, and is useful on ?:/min/max heavy
code

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

19 years agonew testcase
Chris Lattner [Fri, 23 Sep 2005 18:43:57 +0000 (18:43 +0000)]
new testcase

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

19 years agosimplify some logic further
Chris Lattner [Fri, 23 Sep 2005 07:23:18 +0000 (07:23 +0000)]
simplify some logic further

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

19 years agopull a bunch of logic out of SimplifyCFG into a helper fn
Chris Lattner [Fri, 23 Sep 2005 06:39:30 +0000 (06:39 +0000)]
pull a bunch of logic out of SimplifyCFG into a helper fn

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

19 years agospeed up Archive::isBytecodeArchive in the case when the archive doesn't have
Chris Lattner [Fri, 23 Sep 2005 06:22:58 +0000 (06:22 +0000)]
speed up Archive::isBytecodeArchive in the case when the archive doesn't have
an llvm-ranlib symtab.  This speeds up gccld -native on an almost empty .o file
from 1.63s to 0.18s.

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

19 years agoSpeed up isBytecodeLPath from 20s to .01s in common cases. This makes -native
Chris Lattner [Fri, 23 Sep 2005 06:11:24 +0000 (06:11 +0000)]
Speed up isBytecodeLPath from 20s to .01s in common cases.  This makes -native
not completely painful to use.  Once we decide a directory has a bytecode
library, we know it this function returns true, no need to scan entire directories.

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

19 years ago1. Do not use .c_str() to keep a persistent handle on a temporary string.
Chris Lattner [Fri, 23 Sep 2005 06:05:46 +0000 (06:05 +0000)]
1. Do not use .c_str() to keep a persistent handle on a temporary string.
2. Concatenate -lfoo and -L/bar options into a single option instead of
   passing "-L /bar" (for example) which doesn't work on Darwin.
3. Send -v output to stderr instead of stdout

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

19 years agoTurn (X^C1) == C2 into X == C1^C2 iff X&~C1 = 0 (and move a function)
Chris Lattner [Fri, 23 Sep 2005 00:55:52 +0000 (00:55 +0000)]
Turn (X^C1) == C2 into X == C1^C2 iff X&~C1 = 0 (and move a function)

This happens all the time on PPC for bool values, e.g. eliminating a xori
in inverted-bool-compares.ll.

This should be added to the dag combiner as well.

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

19 years agonew testcase
Chris Lattner [Fri, 23 Sep 2005 00:53:06 +0000 (00:53 +0000)]
new testcase

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

19 years agoTestcase for PR629
Chris Lattner [Wed, 21 Sep 2005 06:53:56 +0000 (06:53 +0000)]
Testcase for PR629

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

19 years agoExpose the LiveInterval interfaces as public headers.
Chris Lattner [Wed, 21 Sep 2005 04:19:09 +0000 (04:19 +0000)]
Expose the LiveInterval interfaces as public headers.

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

19 years agomove the live interval headers out of lib/CodeGen/
Chris Lattner [Wed, 21 Sep 2005 04:18:25 +0000 (04:18 +0000)]
move the live interval headers out of lib/CodeGen/

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

19 years agoRecommend what I actually test
Chris Lattner [Wed, 21 Sep 2005 03:56:26 +0000 (03:56 +0000)]
Recommend what I actually test

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

19 years agoStart threading across blocks with code in them, so long as the code does
Chris Lattner [Tue, 20 Sep 2005 01:48:40 +0000 (01:48 +0000)]
Start threading across blocks with code in them, so long as the code does
not define a value that is used outside of it's block.  This catches many
more simplifications, e.g. 854 in 176.gcc, 137 in vpr, etc.

This implements branch-phi-thread.ll:test3.ll

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

19 years agomake this test harder: add a case where instructions are in the bb to be
Chris Lattner [Tue, 20 Sep 2005 01:43:41 +0000 (01:43 +0000)]
make this test harder: add a case where instructions are in the bb to be
threaded over

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

19 years agoImplement merging of blocks with the same condition if the block has multiple
Chris Lattner [Tue, 20 Sep 2005 00:43:16 +0000 (00:43 +0000)]
Implement merging of blocks with the same condition if the block has multiple
predecessors.  This implements branch-phi-thread.ll::test1

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

19 years agonew testcase
Chris Lattner [Tue, 20 Sep 2005 00:41:55 +0000 (00:41 +0000)]
new testcase

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

19 years agoReject a case we don't handle yet
Chris Lattner [Mon, 19 Sep 2005 23:57:04 +0000 (23:57 +0000)]
Reject a case we don't handle yet

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

19 years agoremove debugging code :-/
Chris Lattner [Mon, 19 Sep 2005 23:50:15 +0000 (23:50 +0000)]
remove debugging code :-/

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

19 years agoImplement SimplifyCFG/branch-phi-thread.ll, the most trivial case of threading
Chris Lattner [Mon, 19 Sep 2005 23:49:37 +0000 (23:49 +0000)]
Implement SimplifyCFG/branch-phi-thread.ll, the most trivial case of threading
control across branches with determined outcomes.  More generality to follow.
This triggers a couple thousand times in specint.

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

19 years agonew testcase.
Chris Lattner [Mon, 19 Sep 2005 23:48:04 +0000 (23:48 +0000)]
new testcase.

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

19 years agoStub out the rest of the DAG Combiner. Just need to fill in the
Nate Begeman [Mon, 19 Sep 2005 22:34:01 +0000 (22:34 +0000)]
Stub out the rest of the DAG Combiner.  Just need to fill in the
select_cc bits and then wrap it in a convenience function for  use with
regular select.

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

19 years agoTeach the local spiller to turn stack slot loads into register-register copies
Chris Lattner [Mon, 19 Sep 2005 06:56:21 +0000 (06:56 +0000)]
Teach the local spiller to turn stack slot loads into register-register copies
when possible, avoiding the load (and avoiding the copy if the value is already
in the right register).

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

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

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

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

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

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

19 years agoImplement the isLoadFromStackSlot interface
Chris Lattner [Mon, 19 Sep 2005 05:23:44 +0000 (05:23 +0000)]
Implement the isLoadFromStackSlot interface

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

19 years agoRefactor this code a bit and make it more general. This now compiles:
Chris Lattner [Sun, 18 Sep 2005 07:22:02 +0000 (07:22 +0000)]
Refactor this code a bit and make it more general.  This now compiles:

struct S { unsigned int i : 6, j : 11, k : 15; } b;
void plus2 (unsigned int x) { b.j += x; }

To:

_plus2:
        lis r2, ha16(L_b$non_lazy_ptr)
        lwz r2, lo16(L_b$non_lazy_ptr)(r2)
        lwz r4, 0(r2)
        slwi r3, r3, 6
        add r3, r4, r3
        rlwimi r3, r4, 0, 26, 14
        stw r3, 0(r2)
        blr

instead of:

_plus2:
        lis r2, ha16(L_b$non_lazy_ptr)
        lwz r2, lo16(L_b$non_lazy_ptr)(r2)
        lwz r4, 0(r2)
        rlwinm r5, r4, 26, 21, 31
        add r3, r5, r3
        rlwimi r4, r3, 6, 15, 25
        stw r4, 0(r2)
        blr

by eliminating an 'and'.

I'm pretty sure this is as small as we can go :)

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

19 years agoCompile
Chris Lattner [Sun, 18 Sep 2005 06:30:59 +0000 (06:30 +0000)]
Compile
struct S { unsigned int i : 6, j : 11, k : 15; } b;
void plus2 (unsigned int x) {
  b.j += x;
}

to:

plus2:
        mov %EAX, DWORD PTR [b]
        mov %ECX, %EAX
        and %ECX, 131008
        mov %EDX, DWORD PTR [%ESP + 4]
        shl %EDX, 6
        add %EDX, %ECX
        and %EDX, 131008
        and %EAX, -131009
        or %EDX, %EAX
        mov DWORD PTR [b], %EDX
        ret

instead of:

plus2:
        mov %EAX, DWORD PTR [b]
        mov %ECX, %EAX
        shr %ECX, 6
        and %ECX, 2047
        add %ECX, DWORD PTR [%ESP + 4]
        shl %ECX, 6
        and %ECX, 131008
        and %EAX, -131009
        or %ECX, %EAX
        mov DWORD PTR [b], %ECX
        ret

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

19 years agoGeneralize this transform, using MaskedValueIsZero, allowing us to compile:
Chris Lattner [Sun, 18 Sep 2005 06:02:59 +0000 (06:02 +0000)]
Generalize this transform, using MaskedValueIsZero, allowing us to compile:

struct S { unsigned int i : 6, j : 11, k : 15; } b;
void plus3 (unsigned int x) { b.k += x; }

To:

plus3:
        mov %EAX, DWORD PTR [%ESP + 4]
        shl %EAX, 17
        add DWORD PTR [b], %EAX
        ret

instead of:

plus3:
        mov %EAX, DWORD PTR [%ESP + 4]
        shl %EAX, 17
        mov %ECX, DWORD PTR [b]
        add %EAX, %ECX
        and %EAX, -131072
        and %ECX, 131071
        or %ECX, %EAX
        mov DWORD PTR [b], %ECX
        ret

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

19 years agofix typeo
Chris Lattner [Sun, 18 Sep 2005 05:25:20 +0000 (05:25 +0000)]
fix typeo

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

19 years agoRemove unintentionally committed code
Chris Lattner [Sun, 18 Sep 2005 05:12:51 +0000 (05:12 +0000)]
Remove unintentionally committed code

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

19 years agoimplement shift.ll:test25. This compiles:
Chris Lattner [Sun, 18 Sep 2005 05:12:10 +0000 (05:12 +0000)]
implement shift.ll:test25.  This compiles:

struct S { unsigned int i : 6, j : 11, k : 15; } b;
void plus3 (unsigned int x) {
  b.k += x;
}

to:

_plus3:
        lis r2, ha16(L_b$non_lazy_ptr)
        lwz r2, lo16(L_b$non_lazy_ptr)(r2)
        lwz r3, 0(r2)
        rlwinm r4, r3, 0, 0, 14
        add r4, r4, r3
        rlwimi r4, r3, 0, 15, 31
        stw r4, 0(r2)
        blr

instead of:

_plus3:
        lis r2, ha16(L_b$non_lazy_ptr)
        lwz r2, lo16(L_b$non_lazy_ptr)(r2)
        lwz r4, 0(r2)
        srwi r5, r4, 17
        add r3, r5, r3
        slwi r3, r3, 17
        rlwimi r3, r4, 0, 15, 31
        stw r3, 0(r2)
        blr

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

19 years agonew testcase
Chris Lattner [Sun, 18 Sep 2005 05:10:39 +0000 (05:10 +0000)]
new testcase

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

19 years agoImplement add.ll:test29. Codegening:
Chris Lattner [Sun, 18 Sep 2005 04:24:45 +0000 (04:24 +0000)]
Implement add.ll:test29.  Codegening:

struct S { unsigned int i : 6, j : 11, k : 15; } b;
void plus1 (unsigned int x) {
  b.i += x;
}

as:
_plus1:
        lis r2, ha16(L_b$non_lazy_ptr)
        lwz r2, lo16(L_b$non_lazy_ptr)(r2)
        lwz r4, 0(r2)
        add r3, r4, r3
        rlwimi r3, r4, 0, 0, 25
        stw r3, 0(r2)
        blr

instead of:

_plus1:
        lis r2, ha16(L_b$non_lazy_ptr)
        lwz r2, lo16(L_b$non_lazy_ptr)(r2)
        lwz r4, 0(r2)
        rlwinm r5, r4, 0, 26, 31
        add r3, r5, r3
        rlwimi r3, r4, 0, 0, 25
        stw r3, 0(r2)
        blr

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

19 years agonew testcase
Chris Lattner [Sun, 18 Sep 2005 04:22:59 +0000 (04:22 +0000)]
new testcase

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

19 years agoremove debug output
Chris Lattner [Sun, 18 Sep 2005 03:50:25 +0000 (03:50 +0000)]
remove debug output

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

19 years agoImplement or.ll:test21. This teaches instcombine to be able to turn this:
Chris Lattner [Sun, 18 Sep 2005 03:42:07 +0000 (03:42 +0000)]
Implement or.ll:test21.  This teaches instcombine to be able to turn this:

struct {
   unsigned int bit0:1;
   unsigned int ubyte:31;
} sdata;

void foo() {
  sdata.ubyte++;
}

into this:

foo:
        add DWORD PTR [sdata], 2
        ret

instead of this:

foo:
        mov %EAX, DWORD PTR [sdata]
        mov %ECX, %EAX
        add %ECX, 2
        and %ECX, -2
        and %EAX, 1
        or %EAX, %ECX
        mov DWORD PTR [sdata], %EAX
        ret

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

19 years agonew testcase
Chris Lattner [Sun, 18 Sep 2005 03:39:02 +0000 (03:39 +0000)]
new testcase

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

19 years agoImplement hook for ppc
Chris Lattner [Sat, 17 Sep 2005 01:03:26 +0000 (01:03 +0000)]
Implement hook for ppc

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

19 years agoadd a new callback
Chris Lattner [Sat, 17 Sep 2005 01:02:45 +0000 (01:02 +0000)]
add a new callback

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

19 years agoMore DAG combining. Still need the branch instructions, and select_cc
Nate Begeman [Fri, 16 Sep 2005 00:54:12 +0000 (00:54 +0000)]
More DAG combining.  Still need the branch instructions, and select_cc

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

19 years agoFix a minor bug, add comments
Chris Lattner [Fri, 16 Sep 2005 00:29:46 +0000 (00:29 +0000)]
Fix a minor bug, add comments

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

19 years agoteach the type inference code how to infer types for instructions and node
Chris Lattner [Thu, 15 Sep 2005 22:23:50 +0000 (22:23 +0000)]
teach the type inference code how to infer types for instructions and node
xforms.  Run type inference on result patterns, so we always have fully typed
results (and to catch errors in .td files).

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

19 years agoput instructions into a map instead of a vector for quick lookup
Chris Lattner [Thu, 15 Sep 2005 21:57:35 +0000 (21:57 +0000)]
put instructions into a map instead of a vector for quick lookup

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

19 years agowhen parsing instructions remember information about the types taken and
Chris Lattner [Thu, 15 Sep 2005 21:51:12 +0000 (21:51 +0000)]
when parsing instructions remember information about the types taken and
returned.

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

19 years agodisable this for now
Chris Lattner [Thu, 15 Sep 2005 21:44:00 +0000 (21:44 +0000)]
disable this for now

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

19 years agoStart parsing "Pattern" nodes
Chris Lattner [Thu, 15 Sep 2005 21:42:00 +0000 (21:42 +0000)]
Start parsing "Pattern" nodes

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

19 years agorename a couple of methods, add structure for pattern parsing
Chris Lattner [Thu, 15 Sep 2005 02:38:02 +0000 (02:38 +0000)]
rename a couple of methods, add structure for pattern parsing

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

19 years agoVerify that xform functions only occur in logical places
Chris Lattner [Wed, 14 Sep 2005 23:05:13 +0000 (23:05 +0000)]
Verify that xform functions only occur in logical places

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

19 years agoPromote xform fns to be explicit nodes in result patterns, and clean off
Chris Lattner [Wed, 14 Sep 2005 23:01:59 +0000 (23:01 +0000)]
Promote xform fns to be explicit nodes in result patterns, and clean off
predicates since they will have already matched at this point.

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

19 years agostart building the instruction dest pattern correctly. Change the xform
Chris Lattner [Wed, 14 Sep 2005 22:55:26 +0000 (22:55 +0000)]
start building the instruction dest pattern correctly.  Change the xform
functions to preserve the Record for the xform instead of making it into a
function name.

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

19 years agocatch unnamed inputs
Chris Lattner [Wed, 14 Sep 2005 22:06:36 +0000 (22:06 +0000)]
catch unnamed inputs

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