1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-25 22:12:57 +02:00
Commit Graph

1309 Commits

Author SHA1 Message Date
Chris Lattner
c92af54ed5 Fix a bug in yesterdays checkins which broke siod. siod is a great testcase! :)
llvm-svn: 12659
2004-04-05 16:02:41 +00:00
Chris Lattner
6c961339a3 Fix InstCombine/2004-04-04-InstCombineReplaceAllUsesWith.ll
llvm-svn: 12658
2004-04-05 02:10:19 +00:00
Chris Lattner
9236135e8f Support getelementptr instructions which use uint's to index into structure
types and can have arbitrary 32- and 64-bit integer types indexing into
sequential types.

llvm-svn: 12653
2004-04-05 01:30:19 +00:00
Chris Lattner
cf5bd8a9ab Rewrite the indvars pass to use the ScalarEvolution analysis.
This also implements some new features for the indvars pass, including
linear function test replacement, exit value substitution, and it works with
a much more general class of induction variables and loops.

llvm-svn: 12620
2004-04-02 20:24:31 +00:00
Chris Lattner
3f202e3a54 Fix the obvious bug in my previous checkin
llvm-svn: 12618
2004-04-02 18:15:10 +00:00
Chris Lattner
bca948c99d Implement Transforms/SimplifyCFG/return-merge.ll
This actually causes us to turn code like:

  return C ? A : B;

into a select instruction.

llvm-svn: 12617
2004-04-02 18:13:43 +00:00
Chris Lattner
973cb73b4f Fix PR310 and TailDup/2004-04-01-DemoteRegToStack.llx
llvm-svn: 12597
2004-04-01 20:28:45 +00:00
Chris Lattner
441ab4b903 Remove some assertions that are now bogus with the last patch I put in
llvm-svn: 12595
2004-04-01 19:21:46 +00:00
Chris Lattner
eda638b0be Fix PR306: Loop simplify incorrectly updates dominator information
Testcase: LoopSimplify/2004-04-01-IncorrectDomUpdate.ll

llvm-svn: 12592
2004-04-01 19:06:07 +00:00
Chris Lattner
6aaea5f86b Add warning
llvm-svn: 12573
2004-03-31 22:00:30 +00:00
Chris Lattner
1c0ddbfb7d Fix linking of constant expr casts due to type resolution changes. With
this and the other patches 253.perlbmk links again.

llvm-svn: 12565
2004-03-31 02:58:28 +00:00
Brian Gaeke
59c80cfd05 Start cleaning up this pass so that I can debug it.
llvm-svn: 12548
2004-03-30 19:53:46 +00:00
Chris Lattner
145aea5c4c Now that all the code generators support the select instruction, and the instcombine
pass can eliminate many nasty cases of them, start generating them in the optimizers

llvm-svn: 12545
2004-03-30 19:44:05 +00:00
Chris Lattner
b6612acb18 Implement select.ll:test[3-6]
llvm-svn: 12544
2004-03-30 19:37:13 +00:00
Chris Lattner
58a6a4d57a Add a simple select instruction lowering pass
llvm-svn: 12540
2004-03-30 18:41:10 +00:00
Chris Lattner
d191e5625c X % -1 == X % 1 == 0
llvm-svn: 12520
2004-03-26 16:11:24 +00:00
Chris Lattner
e15fb6ac61 Two changes:
#1 is to unconditionally strip constantpointerrefs out of
instruction operands where they are absolutely pointless and inhibit
optimization.  GRRR!

#2 is to implement InstCombine/getelementptr_const.ll

llvm-svn: 12519
2004-03-25 22:59:29 +00:00
Chris Lattner
078f97b50d Teach the optimizer to delete zero sized alloca's (but not mallocs!)
llvm-svn: 12507
2004-03-19 06:08:10 +00:00
Chris Lattner
0f0a253571 Fix bug: CodeExtractor/2004-03-17-MissedLiveIns.ll
With this fix we now successfully extract all 149 loops from 256.bzip2 without
crashing or miscompiling the program!

llvm-svn: 12493
2004-03-18 05:56:32 +00:00
Chris Lattner
521d687d11 Add statistics to the loop extractor. The loop extractor has successfully
extracted all 63 loops for Olden/bh without crashing and without
miscompiling the program!!!

llvm-svn: 12491
2004-03-18 05:46:10 +00:00
Chris Lattner
c835211d82 Fix problem with PHI nodes having multiple predecessors from different
exit nodes

llvm-svn: 12490
2004-03-18 05:43:18 +00:00
Chris Lattner
b1bc514730 Fix CodeExtractor/2004-03-17-UpdatePHIsOutsideRegion.ll
llvm-svn: 12489
2004-03-18 05:38:31 +00:00
Chris Lattner
69fdd9f14a Seriously simplify and correct the PHI node handling code.
llvm-svn: 12487
2004-03-18 05:28:49 +00:00
Chris Lattner
345cf6f177 Fix CodeExtractor/2004-03-17-OutputMismatch.ll
llvm-svn: 12486
2004-03-18 04:12:05 +00:00
Chris Lattner
0d233c03fc Fix several bugs in the extractor:
1. Names were not put on the new arguments created (ok, this just helps sanity :)
2. Fix outgoing pointer values
3. Do not insert stores for values that had not been computed
4. Fix some wierd problems with the outset calculation

This fixes CodeExtractor/2004-03-14-DominanceProblem.ll, making the extractor
work on at least one simple case!

llvm-svn: 12484
2004-03-18 03:49:40 +00:00
Chris Lattner
55114016ea The code extractor needs dominator info. Provide it
llvm-svn: 12483
2004-03-18 03:48:06 +00:00
Chris Lattner
7c0d39dcd6 Prune #includes, moving the module interface to the front. Note that this
exposed the fact that the header was not self-contained.  There is a reason
we do things :)

llvm-svn: 12481
2004-03-18 03:15:29 +00:00
Chris Lattner
849234af99 Fix compilation of mesa, which I broke earlier today
llvm-svn: 12465
2004-03-17 02:02:47 +00:00
Chris Lattner
eccc0e01b2 Be more accurate
llvm-svn: 12464
2004-03-17 01:59:27 +00:00
Chris Lattner
6fdcd7174b Fix bug in previous checkin
llvm-svn: 12458
2004-03-16 23:36:49 +00:00
Chris Lattner
59342a757e Okay, so there is no reasonable way for tail duplication to update SSA form,
as it is making effectively arbitrary modifications to the CFG and we don't
have a domset/domfrontier implementations that can handle the dynamic updates.
Instead of having a bunch of code that doesn't actually work in practice,
just demote any potentially tricky values to the stack (causing the problem
to go away entirely).  Later invocations of mem2reg will rebuild SSA for us.

This fixes all of the major performance regressions with tail duplication
from LLVM 1.1.  For example, this loop:

---
int popcount(int x) {
  int result = 0;
  while (x != 0) {
    result = result + (x & 0x1);
    x = x >> 1;
  }
  return result;
}
---
Used to be compiled into:

int %popcount(int %X) {
entry:
	br label %loopentry

loopentry:		; preds = %entry, %no_exit
	%x.0 = phi int [ %X, %entry ], [ %tmp.9, %no_exit ]		; <int> [#uses=3]
	%result.1.0 = phi int [ 0, %entry ], [ %tmp.6, %no_exit ]		; <int> [#uses=2]
	%tmp.1 = seteq int %x.0, 0		; <bool> [#uses=1]
	br bool %tmp.1, label %loopexit, label %no_exit

no_exit:		; preds = %loopentry
	%tmp.4 = and int %x.0, 1		; <int> [#uses=1]
	%tmp.6 = add int %tmp.4, %result.1.0		; <int> [#uses=1]
	%tmp.9 = shr int %x.0, ubyte 1		; <int> [#uses=1]
	br label %loopentry

loopexit:		; preds = %loopentry
	ret int %result.1.0
}

And is now compiled into:

int %popcount(int %X) {
entry:
        br label %no_exit

no_exit:                ; preds = %entry, %no_exit
        %x.0.0 = phi int [ %X, %entry ], [ %tmp.9, %no_exit ]          ; <int> [#uses=2]
        %result.1.0.0 = phi int [ 0, %entry ], [ %tmp.6, %no_exit ]             ; <int> [#uses=1]
        %tmp.4 = and int %x.0.0, 1              ; <int> [#uses=1]
        %tmp.6 = add int %tmp.4, %result.1.0.0          ; <int> [#uses=2]
        %tmp.9 = shr int %x.0.0, ubyte 1                ; <int> [#uses=2]
        %tmp.1 = seteq int %tmp.9, 0            ; <bool> [#uses=1]
        br bool %tmp.1, label %loopexit, label %no_exit

loopexit:               ; preds = %no_exit
        ret int %tmp.6
}

llvm-svn: 12457
2004-03-16 23:29:09 +00:00
Chris Lattner
e04883605a This code was both incredibly complex and incredibly broken. Fix it.
llvm-svn: 12456
2004-03-16 23:23:11 +00:00
Chris Lattner
c260cfab09 Punt if we see gigantic PHI nodes. This improves a huge interpreter loop
testcase from 32.5s in -raise to take .3s

llvm-svn: 12443
2004-03-16 19:52:53 +00:00
Chris Lattner
dc22f37eb5 Do not try to optimize PHI nodes with incredibly high degree. This reduces SCCP
time from 615s to 1.49s on a large testcase that has a gigantic switch statement
that all of the blocks in the function go to (an intepreter).

llvm-svn: 12442
2004-03-16 19:49:59 +00:00
Chris Lattner
2175b35b46 Do not copy gigantic switch instructions
llvm-svn: 12441
2004-03-16 19:45:22 +00:00
Chris Lattner
9ae2b6acd7 Fix a regression from this patch:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040308/013095.html

Basically, this patch only updated the immediate dominatees of the header node
to tell them that the preheader also dominated them.  In practice, ALL
dominatees of the header node are also dominated by the preheader.

This fixes: LoopSimplify/2004-03-15-IncorrectDomUpdate.
and PR293

llvm-svn: 12434
2004-03-16 06:00:15 +00:00
Chris Lattner
b9c53cdb65 Restore old inlining heuristic. As the comment indicates, this is a nasty
horrible hack.

llvm-svn: 12423
2004-03-15 06:38:14 +00:00
Chris Lattner
d8905ad834 Add counters for the number of calls elimianted
llvm-svn: 12420
2004-03-15 05:46:59 +00:00
Chris Lattner
8a82176edc Implement LICM of calls in simple cases. This is sufficient to move around
sin/cos/strlen calls and stuff.  This implements:
  LICM/call_sink_pure_function.ll
  LICM/call_sink_const_function.ll

llvm-svn: 12415
2004-03-15 04:11:30 +00:00
Chris Lattner
781ede7382 Mostly cosmetic improvements. Do fix the bug where a global value was considered an input.
llvm-svn: 12406
2004-03-15 01:26:44 +00:00
Chris Lattner
3933f4660f Assert that input blocks meet the invariants we expect
Simplify the input/output finder.  All elements of a basic block are
instructions.  Any used arguments are also inputs.  An instruction can only
be used by another instruction.

llvm-svn: 12405
2004-03-15 01:18:23 +00:00
Chris Lattner
49038b7708 Fix several bugs in the loop extractor. In particular, subloops were never
extracted, and a function that contained a single top-level loop never had
the loop extracted, regardless of how much non-loop code there was.

llvm-svn: 12403
2004-03-15 00:02:02 +00:00
Chris Lattner
cfe9af750b No correctness fixes here, just minor qoi fixes:
* Don't insert a branch to the switch instruction after the call, just
  make it a single block.
* Insert the new alloca instructions in the entry block of the original
  function instead of having them execute dynamically
* Don't make the default edge of the switch instruction go back to the switch.
  The loop extractor shouldn't create new loops!
* Give meaningful names to the alloca slots and the reload instructions
* Some minor code simplifications

llvm-svn: 12402
2004-03-14 23:43:24 +00:00
Chris Lattner
17c2c776c3 Simplify code a bit, and fix bug CodeExtractor/2004-03-14-NoSwitchSupport.ll
This also implements a two minor improvements:
  * Don't insert live-out stores IN the region, insert them on the code path
    that exits the region
  * If the region is exited to the same block from multiple paths, share the
    switch statement entry, live-out store code, and the basic block.

llvm-svn: 12401
2004-03-14 23:05:49 +00:00
Chris Lattner
f8d6c1a252 Simplify the code a bit by making the collection of basic blocks to extract
a member of the class.  While we're at it, turn the collection into a set
instead of a vector to improve efficiency and make queries simpler.

llvm-svn: 12400
2004-03-14 22:34:55 +00:00
Chris Lattner
95c238ef5b Split into two passes. Now there is the general loop extractor, usable on
the command line, and the single loop extractor, usable by bugpoint

llvm-svn: 12390
2004-03-14 20:01:36 +00:00
Chris Lattner
cf5d48e8af Passes don't print stuff!
llvm-svn: 12385
2004-03-14 04:17:53 +00:00
Chris Lattner
7e7c3332b8 Do not create empty basic blocks when the lowerswitch pass expects blocks to
be non-empty!  This fixes LowerSwitch/2004-03-13-SwitchIsDefaultCrash.ll

llvm-svn: 12384
2004-03-14 04:14:31 +00:00
Chris Lattner
e52c176a7c Minor random cleanups
llvm-svn: 12382
2004-03-14 04:01:47 +00:00
Chris Lattner
f3b0377169 FunctionPass's should not define their own 'run' method.
Require 'simplified' loops, not just raw natural loops.  This fixes
CodeExtractor/2004-03-13-LoopExtractorCrash.ll

llvm-svn: 12381
2004-03-14 04:01:06 +00:00