Commit Graph

389 Commits

Author SHA1 Message Date
Devang Patel
ef3682a4fb Simplify internalize pass. Add test case.
Patch by Matthijs Kooijman!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51114 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 20:01:01 +00:00
Dan Gohman
816cdf6bb2 Commit the header I accidentally left out of 51083.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51093 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 04:39:40 +00:00
Dan Gohman
9c78a39907 Whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51089 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 00:43:10 +00:00
Dan Gohman
6ddba2b933 Change class' public PassInfo variables to by initialized with the
address of the PassInfo directly instead of calling getPassInfo.
This eliminates a bunch of dynamic initializations of static data.

Also, fold RegisterPassBase into PassInfo, make a bunch of its
data members const, and rearrange some code to initialize data
members in constructors instead of using setter member functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51022 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 02:05:11 +00:00
Dan Gohman
84b7df43fb Remove uses of llvm/System/IncludeFile.h that are no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 01:32:53 +00:00
Chris Lattner
fd1cbbe9cf Delete the IPO simplify-libcalls and completely reimplement it as
a FunctionPass.  This makes it simpler, fixes dozens of bugs, adds
a couple of minor features, and shrinks is considerably: from
2214 to 1437 lines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50520 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 06:25:24 +00:00
Owen Anderson
0396cd33ca Rename DeadLoopElimination to LoopDeletion, part 2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50437 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 20:06:54 +00:00
Owen Anderson
0ff7708a5b Add dead loop elimination, which removes dead loops for which we can compute
the trip count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50382 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 00:38:34 +00:00
Chris Lattner
54b9c3ba2a Move SplitBlockPredecessors out of loopsimplify into BasicBlockUtils.h
as a global helper function.  At the same type, switch it from taking
a vector of predecessors to an arbitrary sequential input.  This allows
us to switch LoopSimplify to use a SmallVector for various temporary
vectors that it passed into SplitBlockPredecessors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50020 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 01:28:02 +00:00
Chris Lattner
8383a7b7a6 Add a new Jump Threading pass, which will handle cases
such as those in PR2235.  Right now the pass is not very
effective. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50000 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 20:35:01 +00:00
Chris Lattner
bcd203cf86 Allow argpromote to promote struct arguments with a specified number
of elements.  Patch by Matthijs Kooijman!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49962 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 19:50:01 +00:00
Owen Anderson
a723d1e48f Factor a bunch of functionality related to memcpy and memset transforms out of
GVN and into its own pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 08:23:16 +00:00
Evan Cheng
8d84d5b62c Increasing the inline limit from (overly conservative) 200 to 300. Given each BB costs 20 and each instruction costs 5, 200 means a 4 BB function + 24 instructions (actually less because caller's size also contributes to it).
Furthermore, double the limit when more than 10% of the callee instructions are vector instructions. Multimedia kernels tend to love inlining.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48725 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 06:37:48 +00:00
Andrew Lenharth
7623716e61 FunctionExtractorPass has been superceded by GVExtractorPass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48648 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 16:46:53 +00:00
Andrew Lenharth
d245a8ae47 add a pass that can extract all kinds of global values, not just functions. Update llvm-extract to use it and optionally extract a global variable if you want it too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48015 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-07 19:51:57 +00:00
Gabor Greif
29d8aa7877 fix typos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47994 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-06 10:36:00 +00:00
Devang Patel
ca891ecf91 Add pass to promote sret.
This pass transforms 

  %struct._Point = type { i32, i32, i32, i32, i32, i32 }
  define internal void @foo(%struct._Point* sret  %agg.result)

into

  %struct._Point = type { i32, i32, i32, i32, i32, i32 }
  define internal %struct._Point @foo()

This pass updates foo() clients appropriately to use
getresult instruction to extract return values.

This pass is not yet ready for prime time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47776 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-29 23:34:08 +00:00
Chris Lattner
6110224fa6 prune #includes, fit in 80 cols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47556 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-25 19:21:38 +00:00
Chris Lattner
75542bd56b remove the LowerSelect pass. The last client was the old Sparc backend, which is long dead by now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47323 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 07:49:17 +00:00
Chris Lattner
15f166c7b6 remove the lower packed pass. It can never work and even the parts that
could work don't work fully.  This fixes PR1705.  Oh yeah, we don't have
packed types anymore either ;-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47322 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 07:39:17 +00:00
Bill Wendling
beefd3d0f8 The CorrelatedExpressionElimination pass is known to be buggy. Remove it.
This fixes PR1769.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46408 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-27 06:11:41 +00:00
Chris Lattner
120d053e3b Allow clients to specify the inline threshold when creating
the inliner pass.  Patch by Robert Zeh.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45903 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-12 06:49:13 +00:00
Chris Lattner
3dab223dc9 don't include loopinfo.h from this file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45858 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11 06:30:04 +00:00
Gordon Henriksen
8fa8929177 With this patch, the LowerGC transformation becomes the
ShadowStackCollector, which additionally has reduced overhead with
no sacrifice in portability.

Considering a function @fun with 8 loop-local roots,
ShadowStackCollector introduces the following overhead
(x86):

; shadowstack prologue
        movl    L_llvm_gc_root_chain$non_lazy_ptr, %eax
        movl    (%eax), %ecx
        movl    $___gc_fun, 20(%esp)
        movl    $0, 24(%esp)
        movl    $0, 28(%esp)
        movl    $0, 32(%esp)
        movl    $0, 36(%esp)
        movl    $0, 40(%esp)
        movl    $0, 44(%esp)
        movl    $0, 48(%esp)
        movl    $0, 52(%esp)
        movl    %ecx, 16(%esp)
        leal    16(%esp), %ecx
        movl    %ecx, (%eax)

; shadowstack loop overhead
        (none)

; shadowstack epilogue
        movl    48(%esp), %edx
        movl    %edx, (%ecx)

; shadowstack metadata
        .align  3
___gc_fun:                              # __gc_fun
        .long   8
        .space  4

In comparison to LowerGC:

; lowergc prologue
        movl    L_llvm_gc_root_chain$non_lazy_ptr, %eax
        movl    (%eax), %ecx
        movl    %ecx, 48(%esp)
        movl    $8, 52(%esp)
        movl    $0, 60(%esp)
        movl    $0, 56(%esp)
        movl    $0, 68(%esp)
        movl    $0, 64(%esp)
        movl    $0, 76(%esp)
        movl    $0, 72(%esp)
        movl    $0, 84(%esp)
        movl    $0, 80(%esp)
        movl    $0, 92(%esp)
        movl    $0, 88(%esp)
        movl    $0, 100(%esp)
        movl    $0, 96(%esp)
        movl    $0, 108(%esp)
        movl    $0, 104(%esp)
        movl    $0, 116(%esp)
        movl    $0, 112(%esp)

; lowergc loop overhead
        leal    44(%esp), %eax
        movl    %eax, 56(%esp)
        leal    40(%esp), %eax
        movl    %eax, 64(%esp)
        leal    36(%esp), %eax
        movl    %eax, 72(%esp)
        leal    32(%esp), %eax
        movl    %eax, 80(%esp)
        leal    28(%esp), %eax
        movl    %eax, 88(%esp)
        leal    24(%esp), %eax
        movl    %eax, 96(%esp)
        leal    20(%esp), %eax
        movl    %eax, 104(%esp)
        leal    16(%esp), %eax
        movl    %eax, 112(%esp)

; lowergc epilogue
        movl    48(%esp), %edx
        movl    %edx, (%ecx)

; lowergc metadata
        (none)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45670 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 01:30:53 +00:00
Chris Lattner
e4b83877d5 back out accidental commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45660 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-06 19:19:32 +00:00
Chris Lattner
2e48a70b35 rename isStore -> mayStore to more accurately reflect what it captures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45656 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-06 08:36:04 +00:00
Owen Anderson
a997c498e0 Didn't mean to commit this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45607 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-05 00:43:37 +00:00
Owen Anderson
d94b6a16fe Move some more functionality from MRegisterInfo to TargetInstrInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45603 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-04 23:57:37 +00:00
Chris Lattner
7ed47a1335 Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.  Boy are my fingers tired. ;-)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45411 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 19:59:42 +00:00
Owen Anderson
019b92a70c Start the process of making MachineLoopInfo possible by templating Loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44097 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-14 02:33:58 +00:00
Anton Korobeynikov
18d083f0d1 Make this header public
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43938 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 12:16:58 +00:00
Gordon Henriksen
4e1be6d5ea Deleting redundant copy of block extractor pass. See also PR1775.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43694 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 01:54:05 +00:00
Anton Korobeynikov
a024e8ceda Reg2Mem cleanup and optimizations:
- enable phi instructions demotion to stack
 - create alloca instructions in the entry block


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43208 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-21 23:05:16 +00:00
Hartmut Kaiser
efd4a5144b Updated VC++ build system.
Silenced some VC warnings.

I'm getting linker errors, though: unresolved externals:

llvm::Split<class llvm::BasicBlock *,struct llvm::GraphTraits<class llvm::BasicBlock *> >(class llvm::DominatorTreeBase<class llvm::BasicBlock> &,class llvm::BasicBlock *)

and

llvm::Split<struct llvm::Inverse<class llvm::BasicBlock *>,struct llvm::GraphTraits<struct llvm::Inverse<class llvm::BasicBlock *> > >(class llvm::DominatorTreeBase<class llvm::BasicBlock> &,class llvm::BasicBlock *)

Where are these defined?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43073 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-17 14:56:40 +00:00
Owen Anderson
7e9edda51d Remove RLE from the headers, since the pass itself is gone now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41971 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14 22:54:46 +00:00
Devang Patel
4bc2a0b420 Add utility to clone loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40997 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 17:59:47 +00:00
Chris Lattner
942c55bcfe add #ifndef guards
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40990 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 15:53:08 +00:00
Devang Patel
a9e9286630 Fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40911 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-07 23:16:03 +00:00
Devang Patel
fee76bd9ba Begin loop index split pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40883 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-07 00:25:56 +00:00
Dan Gohman
c2bbfc18e9 More explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40673 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-01 15:32:29 +00:00
Owen Anderson
f6a05f949f Rename FastDSE to just DSE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40668 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-01 06:36:51 +00:00
Devang Patel
29381fb7cd Use SmallPtrSet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40560 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-27 18:34:27 +00:00
Devang Patel
6899b31422 Add BasicInliner interface.
This interface allows clients to inline bunch of functions with module
level call graph information.:wq



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40486 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-25 18:00:25 +00:00
Owen Anderson
1ad2cb7555 Add a GVN pass, using the value numbering code I developed for GVNPRE and the
load elimination code from RedundantLoadElimination.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40469 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24 17:55:58 +00:00
Owen Anderson
a7f98e2919 Rename a lot of things to change FastDLE to RedundantLoadElimination.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40457 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24 00:17:04 +00:00
Owen Anderson
48a19fb884 Fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40446 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-23 21:51:37 +00:00
Owen Anderson
ffe40aa97d Add FastDLE, the load-elimination counterpart of FastDSE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40445 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-23 21:48:08 +00:00
Devang Patel
b4559a2179 Make LCSSA a loop pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39844 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 23:57:11 +00:00
Tanya Lattner
08d14d2469 Adding ability to demote phi to stack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39744 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 18:41:34 +00:00
Owen Anderson
b77c457cc8 Add FastDSE, a new algorithm for doing dead store elimination. This algorithm is not as accurate
as the current DSE, but it only a linear scan over each block, rather than quadratic.  Eventually
(once it has been improved somewhat), this will replace the current DSE.

NOTE: This has not yet been extensively tested.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38517 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 00:46:18 +00:00