oota-llvm.git
13 years agoDisable r122754 on Windows: was causing all lit tests to fail.
Francois Pichet [Tue, 4 Jan 2011 10:23:42 +0000 (10:23 +0000)]
Disable r122754 on Windows: was causing all lit tests to fail.

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

13 years agoTeach loop-idiom to turn a loop containing a memset into a larger memset
Chris Lattner [Tue, 4 Jan 2011 07:46:33 +0000 (07:46 +0000)]
Teach loop-idiom to turn a loop containing a memset into a larger memset
when safe.

The testcase is basically this nested loop:
void foo(char *X) {
  for (int i = 0; i != 100; ++i)
    for (int j = 0; j != 100; ++j)
      X[j+i*100] = 0;
}

which gets turned into a single memset now.  clang -O3 doesn't optimize
this yet though due to a phase ordering issue I haven't analyzed yet.

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

13 years agorestructure this a bit. Initialize the WeakVH with "I", the
Chris Lattner [Tue, 4 Jan 2011 07:27:30 +0000 (07:27 +0000)]
restructure this a bit.  Initialize the WeakVH with "I", the
instruction *after* the store.  The store will always be deleted
if the transformation kicks in, so we'd do an N^2 scan of every
loop block.  Whoops.

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

13 years agoEliminate repeated allocation of a per-BB DenseMap for a 4.6% reduction of time
Cameron Zwarich [Tue, 4 Jan 2011 06:42:27 +0000 (06:42 +0000)]
Eliminate repeated allocation of a per-BB DenseMap for a 4.6% reduction of time
spent in StrongPHIElimination on 403.gcc.

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

13 years agoAvoid finding loop back edges when we are not splitting critical edges in
Cameron Zwarich [Tue, 4 Jan 2011 04:43:31 +0000 (04:43 +0000)]
Avoid finding loop back edges when we are not splitting critical edges in
CodeGenPrepare (which is the default behavior).

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

13 years agoDon't pattern match "/clang" so we don't mangle directory names. Some
David Greene [Tue, 4 Jan 2011 01:05:30 +0000 (01:05 +0000)]
Don't pattern match "/clang" so we don't mangle directory names.  Some
tests use absolute paths to clang.

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

13 years agoClean up a funky pass registration that got passed over when I got rid of static...
Owen Anderson [Tue, 4 Jan 2011 00:55:21 +0000 (00:55 +0000)]
Clean up a funky pass registration that got passed over when I got rid of static constructors.

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

13 years agoFix the ARM IIC_iCMPsi itinerary and add an important assert.
Andrew Trick [Tue, 4 Jan 2011 00:32:57 +0000 (00:32 +0000)]
Fix the ARM IIC_iCMPsi itinerary and add an important assert.

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

13 years agoAddress most of Duncan's review comments. Also, make LoopInstSimplify a simple
Cameron Zwarich [Tue, 4 Jan 2011 00:12:46 +0000 (00:12 +0000)]
Address most of Duncan's review comments. Also, make LoopInstSimplify a simple
FunctionPass. It probably doesn't have a reason to be a LoopPass, as it will
probably drop the simple fixed point and either use RPO iteration or Duncan's
approach in instsimplify of only revisiting instructions that have changed.

The next step is to preserve LoopSimplify. This looks like it won't be too hard,
although the pass manager doesn't actually seem to respect when non-loop passes
claim to preserve LCSSA or LoopSimplify. This will have to be fixed.

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

13 years agouse the very-handy getTruncateOrZeroExtend helper function, and
Chris Lattner [Tue, 4 Jan 2011 00:06:55 +0000 (00:06 +0000)]
use the very-handy getTruncateOrZeroExtend helper function, and
stop setting NSW: signed overflow is possible.  Thanks to Dan
for pointing these out.

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

13 years agoFormatting changes. No functionality change.
Bill Wendling [Mon, 3 Jan 2011 23:59:05 +0000 (23:59 +0000)]
Formatting changes. No functionality change.

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

13 years agoFix comment.
Owen Anderson [Mon, 3 Jan 2011 23:51:56 +0000 (23:51 +0000)]
Fix comment.

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

13 years agoUse the new addEscapingValue callback to update GlobalsModRef when GVN adds PHIs...
Owen Anderson [Mon, 3 Jan 2011 23:51:43 +0000 (23:51 +0000)]
Use the new addEscapingValue callback to update GlobalsModRef when GVN adds PHIs of GEPs. For the moment,
have GlobalsModRef handle this conservatively by simply removing the value from its maps.

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

13 years agoConvert MC tests to .s so codegen changes won't break them.
Evan Cheng [Mon, 3 Jan 2011 23:47:14 +0000 (23:47 +0000)]
Convert MC tests to .s so codegen changes won't break them.

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

13 years agoDuncan deftly points out that readnone functions aren't
Chris Lattner [Mon, 3 Jan 2011 23:38:13 +0000 (23:38 +0000)]
Duncan deftly points out that readnone functions aren't
invalidated by stores, so they can be handled as 'simple'
operations.

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

13 years agoUse pushq / popq instead of subq $8, %rsp / addq $8, %rsp to adjust stack in
Evan Cheng [Mon, 3 Jan 2011 22:53:22 +0000 (22:53 +0000)]
Use pushq / popq instead of subq $8, %rsp / addq $8, %rsp to adjust stack in
prologue and epilogue if the adjustment is 8. Similarly, use pushl / popl if
the adjustment is 4 in 32-bit mode.

In the epilogue, takes care to pop to a caller-saved register that's not live
at the exit (either return or tailcall instruction).
rdar://8771137

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

13 years agoDon't pattern match "clang-" as it may be part of a tool name with a
David Greene [Mon, 3 Jan 2011 21:55:08 +0000 (21:55 +0000)]
Don't pattern match "clang-" as it may be part of a tool name with a
triple suffix.

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

13 years agoFix more stack layout issues in the MBlaze backend.
Wesley Peck [Mon, 3 Jan 2011 21:40:26 +0000 (21:40 +0000)]
Fix more stack layout issues in the MBlaze backend.

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

13 years agoStub out a new updating interface to AliasAnalysis, allowing stateful analyses to...
Owen Anderson [Mon, 3 Jan 2011 21:38:41 +0000 (21:38 +0000)]
Stub out a new updating interface to AliasAnalysis, allowing stateful analyses to be informed when
a pointer value has potentially become escaping.  Implementations can choose to either fall back to
conservative responses for that value, or may recompute their analysis to accomodate the change.

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

13 years agoWe can count properly.
Owen Anderson [Mon, 3 Jan 2011 21:08:22 +0000 (21:08 +0000)]
We can count properly.

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

13 years agofix rdar://8813415 - a miscompilation of 164.gzip that loop-idiom
Chris Lattner [Mon, 3 Jan 2011 21:03:33 +0000 (21:03 +0000)]
fix rdar://8813415 - a miscompilation of 164.gzip that loop-idiom
exposed.  It turns out to be a latent bug in basicaa, scary.

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

13 years agofilecheckize
Chris Lattner [Mon, 3 Jan 2011 21:01:26 +0000 (21:01 +0000)]
filecheckize

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

13 years agoTableGen.cmake: sometimes the .td file is not in the current directory
Oscar Fuentes [Mon, 3 Jan 2011 20:01:32 +0000 (20:01 +0000)]
TableGen.cmake: sometimes the .td file is not in the current directory
(clang/include/clang/Basic/StmtNodes.td, for instance, is tablegenned
from clang/include/clang/AST/CMakeLists.txt) so it is not contained on
the list of all .td files on the current source directory which is
used as the DEPENDS of the custom command. We must add the .td file to
the DEPENDS list of the custom command. Otherwise some .inc files are
not regenerated when the corresponding .td file changes.

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

13 years agoSimplify GVN's value expression structure, allowing the elimination of a lot of
Owen Anderson [Mon, 3 Jan 2011 19:00:11 +0000 (19:00 +0000)]
Simplify GVN's value expression structure, allowing the elimination of a lot of
almost-but-not-quite-identical code.  No intended functionality change.

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

13 years agostength reduce my previous patch a bit. The only instructions
Chris Lattner [Mon, 3 Jan 2011 18:43:03 +0000 (18:43 +0000)]
stength reduce my previous patch a bit.  The only instructions
that are allowed to have metadata operands are intrinsic calls,
and the only ones that take metadata currently return void.
Just reject all void instructions, which should not be value
numbered anyway.  To future proof things, add an assert to the
getHashValue impl for calls to check that metadata operands
aren't present.

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

13 years agofix PR8895: metadata operands don't have a strong use of their
Chris Lattner [Mon, 3 Jan 2011 18:28:15 +0000 (18:28 +0000)]
fix PR8895: metadata operands don't have a strong use of their
nested values, so they can change and drop to null, which can
change the hash and cause havok.

It turns out that it isn't a good idea to value number stuff
with metadata operands anyway, so... don't.

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

13 years agoReapply 122341 to fix PR8199 now that clang changes are in.
David Greene [Mon, 3 Jan 2011 17:30:25 +0000 (17:30 +0000)]
Reapply 122341 to fix PR8199 now that clang changes are in.

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

13 years agoLLVMProcessSources: add .def files along with .h files to targets for
Oscar Fuentes [Mon, 3 Jan 2011 16:59:52 +0000 (16:59 +0000)]
LLVMProcessSources: add .def files along with .h files to targets for
the benefit of project-based generators (VS, XCode, etc).

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

13 years agoSpeed up instsimplify by about 10-15% by not bothering to retry
Duncan Sands [Mon, 3 Jan 2011 10:50:04 +0000 (10:50 +0000)]
Speed up instsimplify by about 10-15% by not bothering to retry
InstructionSimplify on instructions that didn't change since the
last time round the loop.

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

13 years agoUndo what looks like accidental removal of an instcombine pass in r122740.
Evan Cheng [Mon, 3 Jan 2011 07:53:18 +0000 (07:53 +0000)]
Undo what looks like accidental removal of an instcombine pass in r122740.

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

13 years agoSwitch a worklist in CodeGenPrepare to SmallVector and increase the inline
Cameron Zwarich [Mon, 3 Jan 2011 06:33:01 +0000 (06:33 +0000)]
Switch a worklist in CodeGenPrepare to SmallVector and increase the inline
capacity on the Visited SmallPtrSet. On 403.gcc, this is about a 4.5% speedup of
CodeGenPrepare time (which itself is 10% of time spent in the backend).

This is progress towards PR8889.

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

13 years agoTurn on earlycse by default. This seems to be a small performance
Chris Lattner [Mon, 3 Jan 2011 06:19:09 +0000 (06:19 +0000)]
Turn on earlycse by default.  This seems to be a small performance
improvement in the generated code, and speeds up 'opt -std-compile-opts'
compile time on 176.gcc from 24.84s to 23.2s (about 7%).

This also resolves a specific code quality issue in rdar://7352081 which
was generating poor code for:

int t(int a, int b) {
  if (a & b & 1)
    return a & b;
  return 3;
}

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

13 years agoFurther expand what a call graph pass may do.
Nick Lewycky [Mon, 3 Jan 2011 06:16:07 +0000 (06:16 +0000)]
Further expand what a call graph pass may do.

The rationale is that after analyzing a function in the SCC, we may want to
modify it in a way that requires us to update its uses (f.e. to replace the
call with a constant) or its users (f.e. to call it with fewer arguments).

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

13 years agoearlycse can do trivial with-a-block dead store
Chris Lattner [Mon, 3 Jan 2011 04:17:24 +0000 (04:17 +0000)]
earlycse can do trivial with-a-block dead store
elimination as well.  This deletes 60 stores in 176.gcc
that largely come from bitfield code.

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

13 years agoUse a RecyclingAllocator to allocate values for MachineCSE's ScopedHashTable for
Cameron Zwarich [Mon, 3 Jan 2011 04:07:46 +0000 (04:07 +0000)]
Use a RecyclingAllocator to allocate values for MachineCSE's ScopedHashTable for
a 28% speedup of MachineCSE time on 403.gcc.

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

13 years agoPermit CallGraphSCCPasses readonly access to the direct callers of the functions
Nick Lewycky [Mon, 3 Jan 2011 04:01:44 +0000 (04:01 +0000)]
Permit CallGraphSCCPasses readonly access to the direct callers of the functions
in their SCC as they already have with the direct callees.

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

13 years agoswitch the load table to use a recycling bump pointer allocator,
Chris Lattner [Mon, 3 Jan 2011 03:53:50 +0000 (03:53 +0000)]
switch the load table to use a recycling bump pointer allocator,
speeding earlycse up by 6%.

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

13 years agonow that loads are in their own table, we can implement
Chris Lattner [Mon, 3 Jan 2011 03:46:34 +0000 (03:46 +0000)]
now that loads are in their own table, we can implement
store->load forwarding.  This allows EarlyCSE to zap 600 more
loads from 176.gcc.

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

13 years agosplit loads and calls into separate tables. Loads are now just indexed
Chris Lattner [Mon, 3 Jan 2011 03:41:27 +0000 (03:41 +0000)]
split loads and calls into separate tables.  Loads are now just indexed
by their pointer instead of using MemoryValue to wrap it.

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

13 years agoadd a testcase for readonly call CSE
Chris Lattner [Mon, 3 Jan 2011 03:33:47 +0000 (03:33 +0000)]
add a testcase for readonly call CSE

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

13 years agovarious cleanups, no functionality change.
Chris Lattner [Mon, 3 Jan 2011 03:28:23 +0000 (03:28 +0000)]
various cleanups, no functionality change.

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

13 years agoAdd spliceFunction to the CallGraph interface. This allows users to efficiently
Nick Lewycky [Mon, 3 Jan 2011 03:19:35 +0000 (03:19 +0000)]
Add spliceFunction to the CallGraph interface. This allows users to efficiently
update a callGraph when performing the common operation of splicing the body to
a new function and updating all callers (such as via RAUW).

No users yet, though this is intended for DeadArgumentElimination as part of
PR8887.

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

13 years agoTeach EarlyCSE to do trivial CSE of loads and read-only calls.
Chris Lattner [Mon, 3 Jan 2011 03:18:43 +0000 (03:18 +0000)]
Teach EarlyCSE to do trivial CSE of loads and read-only calls.

On 176.gcc, this catches 13090 loads and calls, and increases the
number of simple instructions CSE'd from 29658 to 36208.

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

13 years agoadd a handy typedef.
Chris Lattner [Mon, 3 Jan 2011 03:16:20 +0000 (03:16 +0000)]
add a handy typedef.

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

13 years agorename InstValue to SimpleValue, add some comments.
Chris Lattner [Mon, 3 Jan 2011 02:20:48 +0000 (02:20 +0000)]
rename InstValue to SimpleValue, add some comments.

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

13 years agoCMake: Add missing source file.
Michael J. Spencer [Mon, 3 Jan 2011 02:13:05 +0000 (02:13 +0000)]
CMake: Add missing source file.

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

13 years agoAllocate nodes for the scoped hash table from a recyling bump pointer
Chris Lattner [Mon, 3 Jan 2011 01:42:46 +0000 (01:42 +0000)]
Allocate nodes for the scoped hash table from a recyling bump pointer
allocator.  This speeds up early cse by about 20%

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

13 years agoreally get this working with a custom allocator.
Chris Lattner [Mon, 3 Jan 2011 01:38:29 +0000 (01:38 +0000)]
really get this working with a custom allocator.

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

13 years agoEnhance ScopedHashTable to allow it to take an allocator argument.
Chris Lattner [Mon, 3 Jan 2011 01:29:37 +0000 (01:29 +0000)]
Enhance ScopedHashTable to allow it to take an allocator argument.

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

13 years agoreduce redundancy in the hashing code and other misc cleanups.
Chris Lattner [Mon, 3 Jan 2011 01:10:08 +0000 (01:10 +0000)]
reduce redundancy in the hashing code and other misc cleanups.

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

13 years agoAdd a new loop-instsimplify pass, with the intention of replacing the instance
Cameron Zwarich [Mon, 3 Jan 2011 00:25:16 +0000 (00:25 +0000)]
Add a new loop-instsimplify pass, with the intention of replacing the instance
of instcombine that is currently in the middle of the loop pass pipeline. This
commit only checks in the pass; it will hopefully be enabled by default later.

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

13 years agofix some pastos
Chris Lattner [Sun, 2 Jan 2011 23:29:58 +0000 (23:29 +0000)]
fix some pastos

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

13 years agoadd DEBUG and -stats output to earlycse.
Chris Lattner [Sun, 2 Jan 2011 23:19:45 +0000 (23:19 +0000)]
add DEBUG and -stats output to earlycse.
Teach it to CSE the rest of the non-side-effecting instructions.

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

13 years agoEnhance earlycse to do CSE of casts, instsimplify and die.
Chris Lattner [Sun, 2 Jan 2011 23:04:14 +0000 (23:04 +0000)]
Enhance earlycse to do CSE of casts, instsimplify and die.
Add a testcase.

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

13 years agosplit dom frontier handling stuff out to its own DominanceFrontier header,
Chris Lattner [Sun, 2 Jan 2011 22:09:33 +0000 (22:09 +0000)]
split dom frontier handling stuff out to its own DominanceFrontier header,
so that Dominators.h is *just* domtree.  Also prune #includes a bit.

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

13 years agosketch out a new early cse pass. No functionality yet.
Chris Lattner [Sun, 2 Jan 2011 21:47:05 +0000 (21:47 +0000)]
sketch out a new early cse pass.  No functionality yet.

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

13 years agofix a miscompilation of tramp3d-v4: when forming a memcpy, we have to make
Chris Lattner [Sun, 2 Jan 2011 21:14:18 +0000 (21:14 +0000)]
fix a miscompilation of tramp3d-v4: when forming a memcpy, we have to make
sure that the loop we're promoting into a memcpy doesn't mutate the input
of the memcpy.  Before we were just checking that the dest of the memcpy
wasn't mod/ref'd by the loop.

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

13 years agoIf a loop iterates exactly once (has backedge count = 0) then don't
Chris Lattner [Sun, 2 Jan 2011 20:24:21 +0000 (20:24 +0000)]
If a loop iterates exactly once (has backedge count = 0) then don't
mess with it.  We'd rather peel/unroll it than convert all of its
stores into memsets.

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

13 years agoTry to reuse the value when lowering memset.
Benjamin Kramer [Sun, 2 Jan 2011 19:57:05 +0000 (19:57 +0000)]
Try to reuse the value when lowering memset.

This allows us to compile:
  void test(char *s, int a) {
    __builtin_memset(s, a, 15);
  }
into 1 mul + 3 stores instead of 3 muls + 3 stores.

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

13 years agoLower the i8 extension in memset to a multiply instead of a potentially long series...
Benjamin Kramer [Sun, 2 Jan 2011 19:44:58 +0000 (19:44 +0000)]
Lower the i8 extension in memset to a multiply instead of a potentially long series of shifts and ors.

We could implement a DAGCombine to turn x * 0x0101 back into logic operations
on targets that doesn't support the multiply or it is slow (p4) if someone cares
enough.

Example code:
  void test(char *s, int a) {
      __builtin_memset(s, a, 4);
  }
before:
  _test:                                  ## @test
    movzbl  8(%esp), %eax
    movl  %eax, %ecx
    shll  $8, %ecx
    orl %eax, %ecx
    movl  %ecx, %eax
    shll  $16, %eax
    orl %ecx, %eax
    movl  4(%esp), %ecx
    movl  %eax, 4(%ecx)
    movl  %eax, (%ecx)
    ret
after:
  _test:                                  ## @test
    movzbl  8(%esp), %eax
    imull $16843009, %eax, %eax   ## imm = 0x1010101
    movl  4(%esp), %ecx
    movl  %eax, 4(%ecx)
    movl  %eax, (%ecx)
    ret

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

13 years agoA workaround for a bug in cmake 2.8.3 diagnosed on PR 8885.
Oscar Fuentes [Sun, 2 Jan 2011 19:32:31 +0000 (19:32 +0000)]
A workaround for a bug in cmake 2.8.3 diagnosed on PR 8885.

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

13 years agoAlso remove functions that use complex constant expressions in terms of
Nick Lewycky [Sun, 2 Jan 2011 19:16:44 +0000 (19:16 +0000)]
Also remove functions that use complex constant expressions in terms of
another function.

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

13 years agoenhance loop idiom recognition to scan *all* unconditionally executed
Chris Lattner [Sun, 2 Jan 2011 19:01:03 +0000 (19:01 +0000)]
enhance loop idiom recognition to scan *all* unconditionally executed
blocks in a loop, instead of just the header block.  This makes it more
aggressive, able to handle Duncan's Ada examples.

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

13 years agomake inSubLoop much more efficient.
Chris Lattner [Sun, 2 Jan 2011 18:53:08 +0000 (18:53 +0000)]
make inSubLoop much more efficient.

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

13 years agorip out isExitBlockDominatedByBlockInLoop, calling DomTree::dominates instead.
Chris Lattner [Sun, 2 Jan 2011 18:45:39 +0000 (18:45 +0000)]
rip out isExitBlockDominatedByBlockInLoop, calling DomTree::dominates instead.

isExitBlockDominatedByBlockInLoop is a relic of the days when domtree was
*just* a tree and didn't have DFS numbers.  Checking DFS numbers is faster
and easier than "limiting the search of the tree".

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

13 years agoadd a list of opportunities for future improvement.
Chris Lattner [Sun, 2 Jan 2011 18:32:09 +0000 (18:32 +0000)]
add a list of opportunities for future improvement.

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

13 years agoupdate a bunch of entries.
Chris Lattner [Sun, 2 Jan 2011 18:31:38 +0000 (18:31 +0000)]
update a bunch of entries.

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

13 years agoFix PR8702 by not having LoopSimplify claim to preserve LCSSA form. As described
Duncan Sands [Sun, 2 Jan 2011 13:38:21 +0000 (13:38 +0000)]
Fix PR8702 by not having LoopSimplify claim to preserve LCSSA form.  As described
in the PR, the pass could break LCSSA form when inserting preheaders.  It probably
would be easy enough to fix this, but since currently we always go into LCSSA form
after running this pass, doing so is not urgent.

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

13 years agoRemove an unused member function.
Cameron Zwarich [Sun, 2 Jan 2011 12:37:22 +0000 (12:37 +0000)]
Remove an unused member function.

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

13 years agoPropagate to parent scope changes made to CMAKE_CXX_FLAGS.
Oscar Fuentes [Sun, 2 Jan 2011 12:30:18 +0000 (12:30 +0000)]
Propagate to parent scope changes made to CMAKE_CXX_FLAGS.

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

13 years agoFix a typo in a variable name.
Cameron Zwarich [Sun, 2 Jan 2011 12:17:10 +0000 (12:17 +0000)]
Fix a typo in a variable name.

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

13 years agoMove a load into the only branch where it is used and eliminate a temporary.
Cameron Zwarich [Sun, 2 Jan 2011 10:50:14 +0000 (10:50 +0000)]
Move a load into the only branch where it is used and eliminate a temporary.

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

13 years agoAdd the explanatory comment from r122680's commit message to the code itself.
Cameron Zwarich [Sun, 2 Jan 2011 10:40:14 +0000 (10:40 +0000)]
Add the explanatory comment from r122680's commit message to the code itself.

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

13 years agoTidy up indentation.
Cameron Zwarich [Sun, 2 Jan 2011 10:10:02 +0000 (10:10 +0000)]
Tidy up indentation.

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

13 years agoFix a typo, which should also fix the failure on llvm-x86_64-linux-checks.
Cameron Zwarich [Sun, 2 Jan 2011 10:06:44 +0000 (10:06 +0000)]
Fix a typo, which should also fix the failure on llvm-x86_64-linux-checks.

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

13 years agoAllow loop-idiom to run on multiple BB loops, but still only scan the loop
Chris Lattner [Sun, 2 Jan 2011 07:58:36 +0000 (07:58 +0000)]
Allow loop-idiom to run on multiple BB loops, but still only scan the loop
header for now for memset/memcpy opportunities.  It turns out that loop-rotate
is successfully rotating loops, but *DOESN'T MERGE THE BLOCKS*, turning "for
loops" into 2 basic block loops that loop-idiom was ignoring.

With this fix, we form many *many* more memcpy and memsets than before, including
on the "history" loops in the viterbi benchmark, which look like this:

        for (j=0; j<MAX_history; ++j) {
          history_new[i][j+1] = history[2*i][j];
        }

Transforming these loops into memcpy's speeds up the viterbi benchmark from
11.98s to 3.55s on my machine.  Woo.

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

13 years agoRemove the #ifdef'd code for balancing the eval-link data structure. It doesn't
Cameron Zwarich [Sun, 2 Jan 2011 07:53:49 +0000 (07:53 +0000)]
Remove the #ifdef'd code for balancing the eval-link data structure. It doesn't
compile, and everyone's tests have shown it to be slower in practice, even for
quite large graphs.

I also hope to do an optimization that is only correct with the simpler data
structure, which would break this even further.

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

13 years agoremove debugging code.
Chris Lattner [Sun, 2 Jan 2011 07:37:13 +0000 (07:37 +0000)]
remove debugging code.

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

13 years agoadd some -stats output.
Chris Lattner [Sun, 2 Jan 2011 07:36:44 +0000 (07:36 +0000)]
add some -stats output.

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

13 years agoimprove loop rotation to use CodeMetrics to analyze the
Chris Lattner [Sun, 2 Jan 2011 07:35:53 +0000 (07:35 +0000)]
improve loop rotation to use CodeMetrics to analyze the
size of a loop header instead of its own code size estimator.
This allows it to handle bitcasts etc more precisely.

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

13 years agoSpeed up dominator computation some more by optimizing bucket processing. When
Cameron Zwarich [Sun, 2 Jan 2011 07:03:00 +0000 (07:03 +0000)]
Speed up dominator computation some more by optimizing bucket processing. When
naively implemented, the Lengauer-Tarjan algorithm requires a separate bucket
for each vertex. However, this is unnecessary, because each vertex is only
placed into a single bucket (that of its semidominator), and each vertex's
bucket is processed before it is added to any bucket itself.

Instead of using a bucket per vertex, we use a single array Buckets that has two
purposes. Before the vertex V with DFS number i is processed, Buckets[i] stores
the index of the first element in V's bucket. After V's bucket is processed,
Buckets[i] stores the index of the next element in the bucket to which V now
belongs, if any.

Reading from the buckets can also be optimized. Instead of processing the bucket
of V's parent at the end of processing V, we process the bucket of V itself at
the beginning of processing V. This means that the case of the root vertex can
be simplified somewhat. It also means that we don't need to look up the DFS
number of the semidominator of every node in the bucket we are processing,
since we know it is the current index being processed.

This is a 6.5% speedup running -domtree on test-suite + SPEC2000/2006, with
larger speedups of around 12% on the larger benchmarks like GCC.

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

13 years agoteach loop idiom recognition to form memcpy's from simple loops.
Chris Lattner [Sun, 2 Jan 2011 03:37:56 +0000 (03:37 +0000)]
teach loop idiom recognition to form memcpy's from simple loops.

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

13 years agoRemove functions from the FnSet when one of their callee's is being merged. This
Nick Lewycky [Sun, 2 Jan 2011 02:46:33 +0000 (02:46 +0000)]
Remove functions from the FnSet when one of their callee's is being merged. This
maintains the guarantee that the DenseSet expects two elements it contains to
not go from inequal to equal under its nose.

As a side-effect, this also lets us switch from iterating to a fixed-point to
actually maintaining a work queue of functions to look at again, and we don't
add thunks to our work queue so we don't need to detect and ignore them.

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

13 years agoa missed __builtin_object_size case.
Chris Lattner [Sat, 1 Jan 2011 22:57:31 +0000 (22:57 +0000)]
a missed __builtin_object_size case.

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

13 years agovarious updates.
Chris Lattner [Sat, 1 Jan 2011 22:52:11 +0000 (22:52 +0000)]
various updates.

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

13 years agofix a globalopt crash on two Adobe-C++ testcases that the recent
Chris Lattner [Sat, 1 Jan 2011 22:31:46 +0000 (22:31 +0000)]
fix a globalopt crash on two Adobe-C++ testcases that the recent
loop idiom pass exposed.

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

13 years agoFix darwin bots.
Rafael Espindola [Sat, 1 Jan 2011 21:58:41 +0000 (21:58 +0000)]
Fix darwin bots.

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

13 years agoRemove empty directories left behind by git-svn users.
Benjamin Kramer [Sat, 1 Jan 2011 21:53:18 +0000 (21:53 +0000)]
Remove empty directories left behind by git-svn users.

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

13 years agoAdd support for the 'H' modifier.
Rafael Espindola [Sat, 1 Jan 2011 20:58:46 +0000 (20:58 +0000)]
Add support for the 'H' modifier.

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

13 years agoUpdate the test
Anton Korobeynikov [Sat, 1 Jan 2011 20:57:26 +0000 (20:57 +0000)]
Update the test

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

13 years agoturn on memset idiom recognition by default. Though there are still lots of
Chris Lattner [Sat, 1 Jan 2011 20:39:18 +0000 (20:39 +0000)]
turn on memset idiom recognition by default.  Though there are still lots of
limitations, this kicks in dozens of times in the 4 specfp2000 benchmarks,
and hundreds of times in the int part.  It also kicks in hundreds of times
in multisource.

This kicks in right before loop deletion, which has the pleasant effect of
deleting loops that *just* do a memset.

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

13 years agoModel operand restrictions of mul-like instructions on ARMv5 via
Anton Korobeynikov [Sat, 1 Jan 2011 20:38:38 +0000 (20:38 +0000)]
Model operand restrictions of mul-like instructions on ARMv5 via
earlyclobber stuff. This should fix PRs 2313 and 8157.

Unfortunately, no testcase, since it'd be dependent on register
assignments.

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

13 years agoadd a validity check that was missed, fixing a crash on the
Chris Lattner [Sat, 1 Jan 2011 20:12:04 +0000 (20:12 +0000)]
add a validity check that was missed, fixing a crash on the
new testcase.

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

13 years agoRevert commit 122654 at the request of Chris, who reckons that instsimplify
Duncan Sands [Sat, 1 Jan 2011 20:08:02 +0000 (20:08 +0000)]
Revert commit 122654 at the request of Chris, who reckons that instsimplify
is the wrong hammer for this nail, and is probably right.

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

13 years agoimprove validity check to handle constant-trip-count loops more
Chris Lattner [Sat, 1 Jan 2011 19:54:22 +0000 (19:54 +0000)]
improve validity check to handle constant-trip-count loops more
aggressively.  In practice, this doesn't help anything though,
see the todo.

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

13 years agoimplement the "no aliasing accesses in loop" safety check. This pass
Chris Lattner [Sat, 1 Jan 2011 19:39:01 +0000 (19:39 +0000)]
implement the "no aliasing accesses in loop" safety check.  This pass
should be correct now.

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

13 years agoFix PR8878.
Rafael Espindola [Sat, 1 Jan 2011 19:05:35 +0000 (19:05 +0000)]
Fix PR8878.

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

13 years agoCorrect a bunch of mistakes which meant that the example pass didn't
Duncan Sands [Sat, 1 Jan 2011 17:37:07 +0000 (17:37 +0000)]
Correct a bunch of mistakes which meant that the example pass didn't
even compile, let alone work.

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

13 years agoI was unable to get the instructions to work if LLVM was built
Duncan Sands [Sat, 1 Jan 2011 17:28:49 +0000 (17:28 +0000)]
I was unable to get the instructions to work if LLVM was built
using a separate objects directory.

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

13 years agoClarify that the loadable module turns up in the top-level directory,
Duncan Sands [Sat, 1 Jan 2011 17:21:58 +0000 (17:21 +0000)]
Clarify that the loadable module turns up in the top-level directory,
not locally.

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