1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
Commit Graph

912 Commits

Author SHA1 Message Date
Owen Anderson
4b407757d0 Move Split<...>() into DomTreeBase. This should make the #include's of DominatorInternals.h
in CodeExtractor and LoopSimplify unnecessary.

Hartmut, could you confirm that this fixes the issues you were seeing?

llvm-svn: 43115
2007-10-18 05:13:52 +00:00
Hartmut Kaiser
4cbb4f081b Fixed linker errors (unresolved externals: split<>(...)) when compiling with VC++. Please review.
llvm-svn: 43081
2007-10-17 18:37:09 +00:00
Devang Patel
f4411aa165 Fix comment.
llvm-svn: 42048
2007-09-17 20:07:40 +00:00
Chris Lattner
cc315726f7 Merge DenseMapKeyInfo & DenseMapValueInfo into DenseMapInfo
Add a new DenseMapInfo::isEqual method to allow clients to redefine
the equality predicate used when probing the hash table.

llvm-svn: 42042
2007-09-17 18:34:04 +00:00
Devang Patel
2cebc6f649 Insert cloned loop basic blocks before original loop header.
llvm-svn: 41713
2007-09-04 20:46:35 +00:00
David Greene
8cda5af2e7 Update GEP constructors to use an iterator interface to fix
GLIBCXX_DEBUG issues.

llvm-svn: 41697
2007-09-04 15:46:09 +00:00
Anton Korobeynikov
5b49f44609 Silence warning while compiling with gcc 4.2
llvm-svn: 41676
2007-09-02 22:11:14 +00:00
David Greene
5b85021be8 Update InvokeInst to work like CallInst
llvm-svn: 41506
2007-08-27 19:04:21 +00:00
Anton Korobeynikov
3dffac0c59 Don't promote volatile loads/stores. This is needed (for example) to handle setjmp/longjmp properly.
This fixes PR1520.

llvm-svn: 41461
2007-08-26 21:43:30 +00:00
Devang Patel
f06e667e9c Use SmallVector instead of std::vector.
llvm-svn: 41207
2007-08-21 00:31:24 +00:00
Devang Patel
fded73828f When one branch of condition is eliminated then head of the other
branch is not necessary immediate dominators of merge blcok in all cases.

llvm-svn: 41144
2007-08-17 21:59:16 +00:00
Devang Patel
1dd44d7501 Break infinite loop.
llvm-svn: 41091
2007-08-14 23:59:17 +00:00
Devang Patel
d1d0316041 If NewBB dominates DestBB then DestBB is not part of NewBB's dominance frontier.
llvm-svn: 41051
2007-08-13 21:59:17 +00:00
Devang Patel
d412a2a0ed Add utility to clone loops.
llvm-svn: 40997
2007-08-10 17:59:47 +00:00
Chris Lattner
bf64e878e6 remove some dead lines
llvm-svn: 40859
2007-08-06 06:21:06 +00:00
Chris Lattner
e562e9bdb0 rewrite the code used to construct pruned SSA form with the IDF method.
In the old way, we computed and inserted phi nodes for the whole IDF of 
the definitions of the alloca, then computed which ones were dead and
removed them.

In the new method, we first compute the region where the value is live,
and use that information to only insert phi nodes that are live.  This
eliminates the need to compute liveness later, and stops the algorithm
from inserting a bunch of phis which it then later removes.

This speeds up the testcase in PR1432 from 2.00s to 0.15s (14x) in a
release build and 6.84s->0.50s (14x) in a debug build.

llvm-svn: 40825
2007-08-04 22:50:14 +00:00
Chris Lattner
b7d4ef6ca6 Factor out a whole bunch of code into it's own method.
llvm-svn: 40824
2007-08-04 21:14:29 +00:00
Chris Lattner
d4a88d77d4 Use getNumPreds(BB) instead of computing them manually. This is a very small but
measurable speedup.

llvm-svn: 40823
2007-08-04 21:06:15 +00:00
Chris Lattner
6b9dca62dd Change the rename pass to be "tail recursive", only adding N-1 successors
to the worklist, and handling the last one with a 'tail call'.  This speeds
up PR1432 from 2.0578s to 2.0012s (2.8%)

llvm-svn: 40822
2007-08-04 20:40:27 +00:00
Chris Lattner
c1d2c2bdc8 cache computation of #preds for a BB. This speeds up
mem2reg from 2.0742->2.0522s on PR1432.

llvm-svn: 40821
2007-08-04 20:24:50 +00:00
Chris Lattner
8335a86536 reserve operand space for phi nodes when we insert them.
llvm-svn: 40820
2007-08-04 20:14:34 +00:00
Chris Lattner
32d9e4ba5c use continue to avoid nesting, no functionality change.
llvm-svn: 40819
2007-08-04 20:07:06 +00:00
Chris Lattner
a97ceae263 Promoting allocas with the 'single store' fastpath is
faster than with the 'local to a block' fastpath.  This speeds
up PR1432 from 2.1232 to 2.0686s (2.6%)

llvm-svn: 40818
2007-08-04 20:03:23 +00:00
Chris Lattner
479e3fa267 When PromoteLocallyUsedAllocas promoted allocas, it didn't remember
to increment NumLocalPromoted, and didn't actually delete the
dead alloca, leading to an extra iteration of mem2reg.

llvm-svn: 40817
2007-08-04 20:01:43 +00:00
Chris Lattner
bd506a8e12 std::map -> DenseMap
llvm-svn: 40816
2007-08-04 19:52:20 +00:00
Chris Lattner
9748fa5c6f fix a logic bug where we wouldn't promote single store allocas if the
stored value was a non-instruction value.  Doh.

This increase the # single store allocas from 8982 to 9026, and
speeds up mem2reg on the testcase in PR1432 from 2.17 to 2.13s.

llvm-svn: 40813
2007-08-04 02:45:02 +00:00
Chris Lattner
3f971fdbd5 When we do the single-store optimization, delete both the store
and the alloca so they don't get reprocessed.

This speeds up PR1432 from 2.20s to 2.17s.

llvm-svn: 40812
2007-08-04 02:38:38 +00:00
Chris Lattner
c38b2a2473 Three improvements:
1. Check for revisiting a block before checking domination, which is faster.
  2. If the stored value isn't an instruction, we don't have to check for domination.
  3. If we have a value used in the same block more than once, make sure to remove the
     block from the UsingBlocks vector.  Not doing so forces us to go through the slow
     path for the alloca.

The combination of these improvements increases the number of allocas on the fastpath
from 8935 to 8982 on PR1432.  This speeds it up from 2.90s to 2.20s (31%)

llvm-svn: 40811
2007-08-04 02:32:22 +00:00
Chris Lattner
fe6a3e2fb4 switch from using a std::set to using a SmallPtrSet. This speeds up the
testcase in PR1432 from 6.33s to 2.90s (2.22x)

llvm-svn: 40810
2007-08-04 02:21:22 +00:00
Chris Lattner
9b45ad1f5c In mem2reg, when handling the single-store case, make sure to remove
a using block from the list if we handle it.  Not doing this caused us
to not be able to promote (with the fast path) allocas which have uses (whoops).

This increases the # allocas hitting this fastpath from 4042 to 8935 on the
testcase in PR1432, speeding up mem2reg by 2.6x

llvm-svn: 40809
2007-08-04 02:15:24 +00:00
Chris Lattner
b5af2cf90d split rewriting of single-store allocas into its own
method.

llvm-svn: 40806
2007-08-04 01:47:41 +00:00
Chris Lattner
f8b22a3568 refactor some code to shrink PromoteMem2Reg::run a bit
llvm-svn: 40805
2007-08-04 01:41:18 +00:00
Chris Lattner
2d4d557c80 add a typedef, no other change.
llvm-svn: 40804
2007-08-04 01:19:38 +00:00
Chris Lattner
65181deba3 avoid an unneeded vector copy. This speeds up mem2reg on the testcase
in PR1432 by 6%

llvm-svn: 40803
2007-08-04 01:07:49 +00:00
Chris Lattner
34cf111957 make RenamePassWorkList a local var instead of an ivar.
llvm-svn: 40802
2007-08-04 01:04:40 +00:00
Dan Gohman
7dd04fb91c More explicit keywords.
llvm-svn: 40673
2007-08-01 15:32:29 +00:00
David Greene
f06a395bb9 New CallInst interface to address GLIBCXX_DEBUG errors caused by
indexing an empty std::vector.

Updates to all clients.

llvm-svn: 40660
2007-08-01 03:43:44 +00:00
Devang Patel
1b2732c880 LCSSA preserves dom info.
llvm-svn: 40604
2007-07-30 20:23:45 +00:00
Devang Patel
a03e82d7ee Use SmallPtrSet.
llvm-svn: 40560
2007-07-27 18:34:27 +00:00
Dan Gohman
298f3fd9b7 Move the GET_SIDE_EFFECT_INFO logic from isInstructionTriviallyDead
to Instruction::mayWriteToMemory, fixing a FIXME, and helping
various places that call mayWriteToMemory directly.

llvm-svn: 40533
2007-07-26 16:06:08 +00:00
Devang Patel
d7b401bafd Add BasicInliner interface.
This interface allows clients to inline bunch of functions with module
level call graph information.:wq

llvm-svn: 40486
2007-07-25 18:00:25 +00:00
Devang Patel
45675e56ad Verify loop info.
llvm-svn: 40062
2007-07-19 18:02:32 +00:00
Devang Patel
fe0ef94227 After a basic block is split into two parts,
second part dominates all the blocks dominated
by original basic block. And first part dominates
second part.

llvm-svn: 40035
2007-07-19 02:29:24 +00:00
Devang Patel
4020116257 Now this temp. fix is not required.
llvm-svn: 40034
2007-07-19 02:22:21 +00:00
Reid Spencer
9496d63260 Return Undef if the block has no dominator. This was required to allow
llvm-gcc build to succeed. Without this change it fails in libstdc++
compilation. This causes no regressions in dejagnu tests. However, 
someone who knows this code better might want to review it.

llvm-svn: 39924
2007-07-16 21:03:44 +00:00
Dan Gohman
0ba554c0c8 Fix comments about vectors to use the current wording.
llvm-svn: 39921
2007-07-16 14:29:03 +00:00
Devang Patel
9166ad7658 Make LCSSA a loop pass.
llvm-svn: 39844
2007-07-13 23:57:11 +00:00
Tanya Lattner
a715bbe152 Adding ability to demote phi to stack.
llvm-svn: 39744
2007-07-11 18:41:34 +00:00
Anton Korobeynikov
7971c2c9b7 During module cloning copy aliases too. This fixes PR1544
llvm-svn: 38505
2007-07-10 19:07:35 +00:00
Devang Patel
d9043c7501 Add SplitEdge and SplitBlock utility routines.
llvm-svn: 37952
2007-07-06 21:39:20 +00:00
David Greene
c176772093 Fix reference to iterator invalidated by an erase operation. Uncovered
by _GLIBCXX_DEBUG.

llvm-svn: 37796
2007-06-29 02:53:16 +00:00
Devang Patel
bfb1c7192e Move code to update dominator information after basic block is split
from LoopSimplify.cpp to Dominator.cpp

llvm-svn: 37689
2007-06-21 17:23:45 +00:00
Devang Patel
bc3887310b Add and use DominatorTreeBase::findNearestCommonDominator().
llvm-svn: 37545
2007-06-11 23:31:22 +00:00
Devang Patel
336e38d425 Simplify.
llvm-svn: 37542
2007-06-11 21:45:31 +00:00
Devang Patel
8fba00d86d simplify
llvm-svn: 37541
2007-06-11 21:25:31 +00:00
Devang Patel
35df53ab56 Simplify. Dominator Tree is required so always available.
llvm-svn: 37540
2007-06-11 21:18:00 +00:00
Devang Patel
cfb3a761ae Update LoopSimplify to require and preserve DominatorTree only.
Now LoopSimplify does not require nor preserve ETForest.

llvm-svn: 37512
2007-06-08 01:50:32 +00:00
Devang Patel
b5554f450a Do not preserve ETForest.
llvm-svn: 37506
2007-06-08 00:02:08 +00:00
Devang Patel
3daf3625ab Do not use ETForest as well as DomiantorTree. DominatorTree is sufficient.
llvm-svn: 37501
2007-06-07 22:17:16 +00:00
Devang Patel
a466c96f77 Use DominatorTree instead of ETForest.
This allows faster immediate domiantor walk.

llvm-svn: 37500
2007-06-07 21:57:03 +00:00
Devang Patel
babcd06827 Maintain ETNode as part of DomTreeNode.
This adds redundancy for now.

llvm-svn: 37492
2007-06-07 17:47:21 +00:00
Devang Patel
74785c1f3c s/DominatorTree::createNewNode/DominatorTree::addNewBlock/g
llvm-svn: 37415
2007-06-04 16:43:25 +00:00
Devang Patel
26d8a86df7 Add basic block level interface to change immediate dominator
and create new node.

llvm-svn: 37414
2007-06-04 16:22:33 +00:00
Devang Patel
2ef6caf14f s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g
llvm-svn: 37407
2007-06-04 00:32:22 +00:00
Devang Patel
d58b82f83a s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/g
llvm-svn: 37403
2007-06-03 06:26:14 +00:00
Dan Gohman
2c5d31ee81 Minor comment cleanups.
llvm-svn: 37321
2007-05-24 14:36:04 +00:00
Dan Gohman
167379e73a Fix typos.
llvm-svn: 36994
2007-05-11 21:10:54 +00:00
Nick Lewycky
c2306ff5b4 Fix typo in comment.
llvm-svn: 36873
2007-05-06 13:37:16 +00:00
Devang Patel
cd45427a87 Drop 'const'
llvm-svn: 36662
2007-05-03 01:11:54 +00:00
Devang Patel
8ee9065162 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.

llvm-svn: 36652
2007-05-02 21:39:20 +00:00
Devang Patel
38a66bc82e Do not use typeinfo to identify pass in pass manager.
llvm-svn: 36632
2007-05-01 21:15:47 +00:00
Devang Patel
e5765bd115 Mem2Reg does not need TargetData.
llvm-svn: 36444
2007-04-25 18:32:35 +00:00
Devang Patel
b6ef7bc5d9 Remove unused function argument.
llvm-svn: 36441
2007-04-25 17:15:20 +00:00
Owen Anderson
9813f7fa80 Fix a comment.
llvm-svn: 36299
2007-04-21 07:12:44 +00:00
Jeff Cohen
2afa206eb3 Comment out usage of write() for now.
llvm-svn: 36287
2007-04-20 22:40:10 +00:00
Devang Patel
3c304ecdc9 Avoid recursion.
llvm-svn: 36272
2007-04-20 20:04:37 +00:00
Owen Anderson
41b527b75f Move more passes to using ETForest instead of DominatorTree.
llvm-svn: 36271
2007-04-20 06:27:13 +00:00
Evan Cheng
91e0637ed3 Revert Owen's last check-in. This is breaking Mac OS X / PPC llvm-gcc bootstrap.
llvm-svn: 36258
2007-04-18 22:39:00 +00:00
Owen Anderson
d8bb3aca7b Use new ETForest accessor.
llvm-svn: 36248
2007-04-18 04:46:35 +00:00
Owen Anderson
909895b564 Use ETForest instead of DominatorTree.
llvm-svn: 36247
2007-04-18 04:39:32 +00:00
Chris Lattner
8e28e7654d remove use of BasicBlock::getNext
llvm-svn: 36205
2007-04-17 18:09:47 +00:00
Chris Lattner
7b6a5d7956 remove use of Instruction::getNext
llvm-svn: 36199
2007-04-17 17:47:54 +00:00
Anton Korobeynikov
f3e62a428a Removed tabs everywhere except autogenerated & external files. Add make
target for tabs checking.

llvm-svn: 36146
2007-04-16 18:10:23 +00:00
Chris Lattner
601aa5b489 Fix PR1335 and Transforms/Inline/2007-04-15-InlineEH.ll
llvm-svn: 36090
2007-04-15 21:38:06 +00:00
Owen Anderson
ea857029ea Remove ImmediateDominator analysis. The same information can be obtained from DomTree. A lot of code for
constructing ImmediateDominator is now folded into DomTree construction.

This is part of the ongoing work for PR217.

llvm-svn: 36063
2007-04-15 08:47:27 +00:00
Chris Lattner
7928216e38 avoid copying sets and vectors around.
llvm-svn: 36017
2007-04-14 22:10:17 +00:00
Lauro Ramos Venancio
a76c2806de Implement the "thread_local" keyword.
llvm-svn: 35950
2007-04-12 18:32:50 +00:00
Owen Anderson
5d0148ae7c Re-constify things that don't break the build. Last patch in this
series, I promise.

llvm-svn: 35848
2007-04-09 23:38:18 +00:00
Owen Anderson
94e3511ef6 Unconst-ify stuff that broke the build.
llvm-svn: 35843
2007-04-09 23:08:26 +00:00
Owen Anderson
3d132f812a Const-ify some parameters, and some cosmetic cleanups. No functionality
change.

llvm-svn: 35842
2007-04-09 22:54:50 +00:00
Owen Anderson
148566d2e3 Tabs -> Spaces
llvm-svn: 35841
2007-04-09 22:31:43 +00:00
Owen Anderson
6f5fe179cc Improve some _slow_ behavior introduced in my patches the last few days.
llvm-svn: 35839
2007-04-09 22:25:09 +00:00
Owen Anderson
f9a432a613 Cleanup some from my DomSet-removal changes. Add a new
isReachableFromEntry
test to ETForest to factor a common test out of code.

llvm-svn: 35786
2007-04-09 00:52:49 +00:00
Nick Lewycky
71592d1ef2 Remove DominatorSet usage from LoopSimplify. Patch from Owen Anderson.
llvm-svn: 35757
2007-04-08 01:04:30 +00:00
Owen Anderson
7cf9d12f2e Add DomSet back, and revert the changes to LoopSimplify. Apparently the
ETForest updating mechanisms don't work as I thought they did.  These changes
will be reapplied once the issue is worked out.

llvm-svn: 35741
2007-04-07 18:23:27 +00:00
Owen Anderson
177b1a6aea Completely purge DomSet from LoopSimplify. This is part of the
continuing work on PR1171.

llvm-svn: 35730
2007-04-07 06:56:47 +00:00
Owen Anderson
e2add101a4 BreakCriticalEdges does still preserve DominatorTree.
llvm-svn: 35729
2007-04-07 05:57:09 +00:00
Owen Anderson
eb184ee17b Expunge DomSet from BreakCriticalEdges. This is part of the continuing
work for PR 1171.

llvm-svn: 35728
2007-04-07 05:49:29 +00:00
Owen Anderson
41bf50021d Expunge DomSet from CodeExtractor. This is part of the continuing work
on PR1171.

llvm-svn: 35726
2007-04-07 05:31:27 +00:00
Owen Anderson
54c7efee4d Expunge a bunch of uses of DomSet from LoopSimplify. Many more remain.
This is the beginning of work for PR1171.

llvm-svn: 35720
2007-04-07 04:37:14 +00:00
Chris Lattner
d59b6b3d90 reduce use of std::set
llvm-svn: 35576
2007-04-02 01:44:59 +00:00
Devang Patel
c2708c8ccb Reduce malloc/free traffic.
llvm-svn: 35370
2007-03-26 23:19:29 +00:00
Dan Gohman
d0a0ea9916 Change uses of Function::front to Function::getEntryBlock for readability.
llvm-svn: 35265
2007-03-22 16:38:57 +00:00
Devang Patel
18146cf2a2 LoopSimplify::FindPHIToPartitionLoops()
Use ETForest instead of DominatorSet.

llvm-svn: 35221
2007-03-20 20:18:12 +00:00
Jeff Cohen
91930bc4d4 Unbreak VC++ build. Do not use identifiers starting with _ as they are reserved and
can collide with system defined names.  Windows defines _BB, for example.

llvm-svn: 35066
2007-03-12 17:56:27 +00:00
Anton Korobeynikov
0c2d312725 Use range tests in LowerSwitch, where possible
llvm-svn: 35057
2007-03-10 16:46:28 +00:00
Devang Patel
20b8163ad3 Remove dead comments.
llvm-svn: 35053
2007-03-09 23:41:03 +00:00
Devang Patel
8a26f4caa0 Avoid recursion. Use iterative algorithm for RenamePass().
llvm-svn: 35052
2007-03-09 23:39:14 +00:00
Reid Spencer
884f32fd12 Make sure debug code is not evaluated in non-debug case.
llvm-svn: 34856
2007-03-02 23:15:21 +00:00
Reid Spencer
69858df100 1. Sort switch cases using APInt safe comparison.
2. Make sure debug output of APInt values is safe for all bit widths.

llvm-svn: 34855
2007-03-02 23:05:28 +00:00
Reid Spencer
bf4956bcc4 Use APInt safe isOne() method on ConstantInt instead of getZExtValue()==1
llvm-svn: 34854
2007-03-02 23:03:17 +00:00
Reid Spencer
0f63188d6a Make sorting of ConstantInt be APInt clean through use of ult function.
llvm-svn: 34853
2007-03-02 23:01:14 +00:00
Chris Lattner
4fbb8286bf switch the inliner from being recursive to being iterative.
llvm-svn: 34832
2007-03-02 03:11:20 +00:00
Chris Lattner
6334a918d8 fix an obscure and tricky bug the inliner can hit sometimes.
llvm-svn: 34531
2007-02-23 19:54:30 +00:00
Jim Laskey
8ddfb7141b Revert changes for a simplier solution.
llvm-svn: 34495
2007-02-22 16:21:18 +00:00
Jim Laskey
2bbd4312c0 Itanium ABI exception handing support.
llvm-svn: 34480
2007-02-21 22:49:50 +00:00
Dan Gohman
e24135a647 Fix typos in comments.
llvm-svn: 34456
2007-02-20 20:52:03 +00:00
Chris Lattner
b83d08ddc2 eliminate use of deprecated apis
llvm-svn: 34417
2007-02-19 07:34:47 +00:00
Reid Spencer
55e4e98a2a For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.

llvm-svn: 34293
2007-02-15 02:26:10 +00:00
Chris Lattner
ce2cc6e404 Eliminate use of ctors that take vectors.
llvm-svn: 34219
2007-02-13 02:10:56 +00:00
Chris Lattner
b73ffa20af stop using methods that take vectors.
llvm-svn: 34205
2007-02-12 22:56:41 +00:00
Chris Lattner
bbd6f81f3d simplify code by using Value::takeName
llvm-svn: 34177
2007-02-11 01:37:51 +00:00
Chris Lattner
474d7b219d redesign the primary datastructure used by mem2reg to eliminate an
std::map of std::vector's (ouch!).  This speeds up mem2reg by 10% on 176.gcc.

llvm-svn: 33974
2007-02-07 01:15:04 +00:00
Chris Lattner
5fee493a8c With the last change, we no longer need both directions of mapping from
BBNumbers.  Instead of using a bi-directional mapping, just use a single
densemap.  This speeds up mem2reg on 176.gcc by 8%, from  1.3489 to
1.2485s.

llvm-svn: 33940
2007-02-05 23:37:20 +00:00
Reid Spencer
8749d297f5 Apply the VISIBILITY_HIDDEN field to the remaining anonymous classes in
the Transforms library. This reduces debug library size by 132 KB, debug
binary size by 376 KB, and reduces link time for llvm tools slightly.

llvm-svn: 33939
2007-02-05 23:32:05 +00:00
Chris Lattner
7703e811eb Simplify use of DFBlocks, this makes no noticable performance difference,
but paves the way to eliminate BBNumbers.

llvm-svn: 33938
2007-02-05 23:31:26 +00:00
Chris Lattner
c7487c93da Switch InsertedPHINodes back to SmallPtrSet now that the SmallPtrSet::erase
bug is fixed.

llvm-svn: 33932
2007-02-05 23:11:37 +00:00
Chris Lattner
0ae77ee391 switch a SmallPtrSet back to an std::set for now, this caused problems.
llvm-svn: 33930
2007-02-05 22:28:52 +00:00
Chris Lattner
9a99e6ee24 switch an std::set over to a SmallPtrSet, speeding up mem2reg 6% on 176.gcc.
llvm-svn: 33929
2007-02-05 22:15:21 +00:00
Chris Lattner
19e7a5695d switch an std::set over to SmallPtrSet, speeding up mem2reg 3.4% on 176.gcc.
llvm-svn: 33928
2007-02-05 22:13:11 +00:00
Chris Lattner
5d5bf2ed87 eliminate some malloc traffic, this speeds up mem2reg by 3.4%.
llvm-svn: 33927
2007-02-05 21:58:48 +00:00
Reid Spencer
6af21b3029 For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does
not support types planes. This means that all symbol names in LLVM must now
be unique. The patch addresses the necessary changes to deal with this and
removes code no longer needed as a result. This completes the bulk of the
changes for this PR. Some cleanup patches will follow.

llvm-svn: 33918
2007-02-05 20:47:22 +00:00
Reid Spencer
21f40213a8 For PR1177:
Revert last patch which caused iteration invalidation.

llvm-svn: 33901
2007-02-05 05:23:32 +00:00
Owen Anderson
0fbb2d629f Use DenseMap for pointer->pointer maps.
llvm-svn: 33897
2007-02-05 02:39:47 +00:00
Reid Spencer
310b497b59 For PR1163:
Make the Module's dependent library use a std::vector instead of SetVector
adjust #includes in .cpp files because SetVector.h is no longer included.

llvm-svn: 33855
2007-02-04 00:40:42 +00:00
Chris Lattner
71fe09f397 Switch inliner over to use DenseMap instead of std::map for ValueMap. This
speeds up the inliner 16%.

llvm-svn: 33801
2007-02-03 00:08:31 +00:00
Chris Lattner
618f24b0ed Fix bugs in the inliner having to do with single-entry phi nodes and valuemap
updating.  These were exposed by Devang's recent passmgr changes (with
non-default passorderings) because now the inliner can be interleved with
the LCSSA pass.

llvm-svn: 33760
2007-02-01 18:48:38 +00:00
Chris Lattner
237fa61eb7 eliminate temporary vectors
llvm-svn: 33713
2007-01-31 20:07:32 +00:00
Chris Lattner
7db51ec161 Adjust #includes to match movement of constant folding code from transformutils to libanalysis.
llvm-svn: 33680
2007-01-30 23:46:24 +00:00
Chris Lattner
1765c2eed8 move a bunch of constant folding code f rom Transforms/Utils/Local.cpp into
libanalysis/ConstantFolding.cpp.

llvm-svn: 33679
2007-01-30 23:45:45 +00:00
Chris Lattner
4c01d0055a remove now-dead code.
llvm-svn: 33678
2007-01-30 23:29:47 +00:00
Chris Lattner
23628987e2 The inliner/cloner can now optionally take TargetData info, which can be
used by constant folding.

llvm-svn: 33676
2007-01-30 23:22:39 +00:00
Chris Lattner
659afcca15 Change constant folding APIs to take an optional TargetData, and change
ConstantFoldInstOperands/ConstantFoldCall to take a pointer to an array
of operands + size, instead of an std::vector.

In some cases, switch to using a SmallVector instead of a vector.
This allows us to get rid of some special case gross code that was there
to avoid the cost of constructing a vector.

llvm-svn: 33670
2007-01-30 23:13:49 +00:00
Reid Spencer
19af04a142 For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.

llvm-svn: 33663
2007-01-30 20:08:39 +00:00
Reid Spencer
cec82ab067 For PR761:
The Module::setEndianness and Module::setPointerSize methods have been
removed. Instead you can get/set the DataLayout. Adjust thise accordingly.

llvm-svn: 33530
2007-01-26 08:11:39 +00:00
Devang Patel
a9eae6951d Inherit BasicBlockPass directly from Pass.
llvm-svn: 33511
2007-01-25 23:23:25 +00:00
Reid Spencer
14b42c0040 For PR1043:
This is the final patch for this PR. It implements some minor cleanup
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask -> IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120.

Patch by Sheng Zhou.

llvm-svn: 33370
2007-01-19 21:13:56 +00:00
Chris Lattner
c5e1611848 rename Type::isIntegral to Type::isInteger, eliminating the old Type::isInteger.
rename Type::getIntegralTypeMask to Type::getIntegerTypeMask.

This makes naming much more consistent.  For example, there are now no longer any
instances of IntegerType that are not considered isInteger! :)

llvm-svn: 33225
2007-01-15 02:27:26 +00:00
Chris Lattner
8fbcb083aa Eliminate calls to isInteger, generalizing code and tightening checks as needed.
llvm-svn: 33218
2007-01-15 01:55:30 +00:00
Chris Lattner
e7c5d04b53 Fix Analysis/Dominators/2006-10-02-BreakCritEdges.ll
llvm-svn: 33210
2007-01-15 00:15:09 +00:00
Chris Lattner
9801f36d97 Fix PR1110 and Analysis/Dominators/2007-01-14-BreakCritEdges.ll by being
more careful about unreachable code when updating dominator info.

llvm-svn: 33204
2007-01-14 18:33:35 +00:00
Reid Spencer
3d986f6487 Implement review feedback for the ConstantBool->ConstantInt merge. Chris
recommended that getBoolValue be replaced with getZExtValue and that
get(bool) be replaced by get(const Type*, uint64_t). This implements
those changes.

llvm-svn: 33110
2007-01-12 04:24:46 +00:00
Reid Spencer
f3265181e2 Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
llvm-svn: 33076
2007-01-11 18:21:29 +00:00
Zhou Sheng
23d24526b2 For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.

llvm-svn: 33073
2007-01-11 12:24:14 +00:00
Chris Lattner
aa5051ae7f Change the interface to Module::getOrInsertFunction to be easier to use,to resolve PR1088, and to help PR411.
This simplifies many clients also

llvm-svn: 32989
2007-01-07 08:12:01 +00:00
Chris Lattner
a2f5c06174 prepare for adjustment to getOrInsertFunction method
llvm-svn: 32985
2007-01-07 07:54:34 +00:00
Reid Spencer
cdaf88ff9d For PR411:
Take an incremental step towards type plane elimination. This change
separates types from values in the symbol tables by finally making use
of the TypeSymbolTable class. This yields more natural interfaces for
dealing with types and unclutters the SymbolTable class.

llvm-svn: 32956
2007-01-06 07:24:44 +00:00
Reid Spencer
0fb7fa82d4 For PR950:
This patch replaces signed integer types with signless ones:
1. [US]Byte -> Int8
2. [U]Short -> Int16
3. [U]Int   -> Int32
4. [U]Long  -> Int64.
5. Removal of isSigned, isUnsigned, getSignedVersion, getUnsignedVersion
   and other methods related to signedness. In a few places this warranted
   identifying the signedness information from other sources.

llvm-svn: 32785
2006-12-31 05:48:39 +00:00
Reid Spencer
4428c3483b For PR950:
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and
been replaced with ICmpInst and FCmpInst.

llvm-svn: 32751
2006-12-23 06:05:41 +00:00
Chris Lattner
4d19c9634d switch more statistics over to STATISTIC, eliminating static ctors. Also,
delete some dead ones.

llvm-svn: 32694
2006-12-19 22:17:40 +00:00
Bill Wendling
7f6a73eb5c Added an automatic cast to "std::ostream*" etc. from OStream. We then can
rework the hacks that had us passing OStream in. We pass in std::ostream*
instead, check for null, and then dispatch to the correct print() method.

llvm-svn: 32636
2006-12-17 05:15:13 +00:00
Reid Spencer
50702907eb Replace CastInst::createInferredCast calls with more accurate cast
creation calls.

llvm-svn: 32521
2006-12-13 00:50:17 +00:00
Reid Spencer
3d1b0dfba6 Fix the casting for the computation of the Malloc size.
llvm-svn: 32477
2006-12-12 09:17:08 +00:00
Reid Spencer
562b83c7df Change inferred getCast into specific getCast. Passes all tests.
llvm-svn: 32469
2006-12-12 05:05:00 +00:00
Bill Wendling
a3246c4272 Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.

llvm-svn: 32298
2006-12-07 01:30:32 +00:00
Chris Lattner
a531ce882e Detemplatize the Statistic class. The only type it is instantiated with
is 'unsigned'.

llvm-svn: 32279
2006-12-06 17:46:33 +00:00
Reid Spencer
992d9788b3 For PR950:
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.

llvm-svn: 31931
2006-11-27 01:05:10 +00:00
Bill Wendling
999f49061f Remove #include <iostream> and use llvm_* streams instead.
llvm-svn: 31925
2006-11-26 10:17:54 +00:00
Chris Lattner
cdb67482da Do not convert massive blocks on phi nodes into select statements. Instead
only do these transformations if there are a small number of phi's.
This speeds up Ptrdist/ks from 2.35s to 2.19s on my mac pro.

llvm-svn: 31853
2006-11-18 19:19:36 +00:00
Jim Laskey
28fec74f1b Remove redundant <cmath>.
llvm-svn: 31561
2006-11-08 19:16:44 +00:00
Reid Spencer
da1f5b882a For PR950:
This patch converts the old SHR instruction into two instructions,
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.

llvm-svn: 31542
2006-11-08 06:47:33 +00:00
Jeff Cohen
e1003da1a2 Unbreak VC++ build.
llvm-svn: 31464
2006-11-05 19:31:28 +00:00
Reid Spencer
4bafa71dc1 For PR786:
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.

llvm-svn: 31380
2006-11-02 20:25:50 +00:00
Chris Lattner
3b7a9fa472 generalize the fix for PR977 to also fix
Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll

llvm-svn: 31317
2006-10-31 18:56:48 +00:00
Chris Lattner
79daf6ae80 Fix PR977 and Transforms/LCSSA/2006-10-31-UnreachableBlock.ll
llvm-svn: 31315
2006-10-31 17:52:18 +00:00
Chris Lattner
cc8731fef4 Fix SimplifyCFG/2006-10-29-InvokeCrash.ll, a crash compiling QT.
llvm-svn: 31284
2006-10-29 21:21:20 +00:00
Chris Lattner
65f872288d add option to isCriticalEdge
llvm-svn: 31258
2006-10-28 06:58:17 +00:00
Chris Lattner
85bc826ca6 Expose a smarter way to break critical edges.
llvm-svn: 31256
2006-10-28 06:44:56 +00:00
Reid Spencer
d414793dbc For PR950:
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.

llvm-svn: 31063
2006-10-20 07:07:24 +00:00
Chris Lattner
d9aa90ded4 Fix SimplifyCFG/2006-10-19-UncondDiv.ll by disabling a bad xform.
llvm-svn: 31061
2006-10-20 00:42:07 +00:00
Chris Lattner
c8225bc92a This case isn't implemented yet. It seems unlikely to be needed, but if it
ever is, we want to get an assert instead of silent bad codegen.

llvm-svn: 30716
2006-10-04 04:58:58 +00:00
Chris Lattner
bfbe137f4c Fix PR932 and Analysis/Dominators/2006-10-02-BreakCritEdges.ll:
The critical edge block dominates the dest block if the destblock dominates
all edges other than the one incoming from the critical edge.

llvm-svn: 30696
2006-10-03 07:02:02 +00:00
Chris Lattner
d9c79b9349 simplify code
llvm-svn: 30656
2006-09-28 22:58:25 +00:00
Chris Lattner
c0f674b9fd Be far more careful when splitting a loop header, either to form a preheader
or when splitting loops with a common header into multiple loops.  In particular
the old code would always insert the preheader before the old loop header.  This
is disasterous in cases where the loop hasn't been rotated.  For example, it can
produce code like:

        .. outside the loop...
        jmp LBB1_2      #bb13.outer
LBB1_1: #bb1
        movsd 8(%esp,%esi,8), %xmm1
        mulsd (%edi), %xmm1
        addsd %xmm0, %xmm1
        addl $24, %edi
        incl %esi
        jmp LBB1_3      #bb13
LBB1_2: #bb13.outer
        leal (%edx,%eax,8), %edi
        pxor %xmm1, %xmm1
        xorl %esi, %esi
LBB1_3: #bb13
        movapd %xmm1, %xmm0
        cmpl $4, %esi
        jl LBB1_1       #bb1

Note that the loop body is actually LBB1_1 + LBB1_3, which means that the
loop now contains an uncond branch WITHIN it to jump around the inserted
loop header (LBB1_2).  Doh.

This patch changes the preheader insertion code to insert it in the right
spot, producing this code:

        ... outside the loop, fall into the header ...
LBB1_1: #bb13.outer
        leal (%edx,%eax,8), %esi
        pxor %xmm0, %xmm0
        xorl %edi, %edi
        jmp LBB1_3      #bb13
LBB1_2: #bb1
        movsd 8(%esp,%edi,8), %xmm0
        mulsd (%esi), %xmm0
        addsd %xmm1, %xmm0
        addl $24, %esi
        incl %edi
LBB1_3: #bb13
        movapd %xmm0, %xmm1
        cmpl $4, %edi
        jl LBB1_2       #bb1

Totally crazy, no branch in the loop! :)

llvm-svn: 30587
2006-09-23 08:19:21 +00:00
Chris Lattner
56c1c10ca1 Teach UpdateDomInfoForRevectoredPreds to handle revectored preds that are not
reachable, making it general purpose enough for use by InsertPreheaderForLoop.
Eliminate custom dominfo updating code in InsertPreheaderForLoop, using
UpdateDomInfoForRevectoredPreds instead.

llvm-svn: 30586
2006-09-23 07:40:52 +00:00
Chris Lattner
60207ce1f7 Second half of the fix for Transforms/Inline/inline_cleanup.ll
This folds unconditional branches that are often produced by code
specialization.

llvm-svn: 30307
2006-09-13 21:27:00 +00:00
Chris Lattner
e55d70cedc Implement the first half of Transforms/Inline/inline_cleanup.ll
llvm-svn: 30303
2006-09-13 19:23:57 +00:00
Chris Lattner
f17002a907 Fix Duraid's changes to work when TLI is null. This fixes the failing
lowerinvoke regtests.

llvm-svn: 30115
2006-09-05 17:48:07 +00:00
Duraid Madina
51396ffd3e add setJumpBufSize() and setJumpBufAlignment() to target-lowering.
Call these from your backend to enjoy setjmp/longjmp goodness, see
lib/Target/IA64/IA64ISelLowering.cpp for an example

llvm-svn: 30095
2006-09-04 06:21:35 +00:00
Chris Lattner
a39dcb5377 eliminate RegisterOpt. It does the same thing as RegisterPass.
llvm-svn: 29925
2006-08-27 22:42:52 +00:00
Chris Lattner
33bd5dcfb7 s|llvm/Support/Visibility.h|llvm/Support/Compiler.h|
llvm-svn: 29911
2006-08-27 12:54:02 +00:00
Chris Lattner
a75d3b6d0d Don't attempt to split subloops out of a loop with a huge number of backedges.
Not only will this take huge amounts of compile time, the resultant loop nests
won't be useful for optimization.  This reduces loopsimplify time on
Transforms/LoopSimplify/2006-08-11-LoopSimplifyLongTime.ll from ~32s to ~0.4s
with a debug build of llvm on a 2.7Ghz G5.

llvm-svn: 29647
2006-08-12 05:25:00 +00:00
Chris Lattner
0885025198 Reimplement the loopsimplify code which deletes edges from unreachable
blocks that target loop blocks.

Before, the code was run once per loop, and depended on the number of
predecessors each block in the loop had.  Unfortunately, scanning preds can
be really slow when huge numbers of phis exist or when phis with huge numbers
of inputs exist.

Now, the code is run once per function and scans successors instead of preds,
which is far faster.  In addition, the new code is simpler and is goto free,
woo.

This change speeds up a nasty testcase Duraid provided me from taking hours to
taking ~72s with a debug build.  The functionality this implements is already
tested in the testsuite as Transforms/CodeExtractor/2004-03-13-LoopExtractorCrash.ll.

llvm-svn: 29644
2006-08-12 04:51:20 +00:00
Chris Lattner
b7442c1f8b Fix PR867 (and maybe 868) and testcsae:
Transforms/SimplifyCFG/2006-08-03-Crash.ll

llvm-svn: 29515
2006-08-03 21:40:24 +00:00
Chris Lattner
1768e89248 Add special check to avoid isLoop call. Simple, but doesn't seem to speed
up lcssa much in practice.

llvm-svn: 29465
2006-08-02 00:16:47 +00:00
Chris Lattner
a07bbb37e4 Replace the SSA update code in LCSSA with a bottom-up approach instead of a top
down approach, inspired by discussions with Tanya.

This approach is significantly faster, because it does not need dominator
frontiers and it does not insert extraneous unused PHI nodes.  For example, on
252.eon, in a release-asserts build, this speeds up LCSSA (which is the slowest
pass in gccas) from 9.14s to 0.74s on my G5.  This code is also slightly smaller
and significantly simpler than the old code.

Amusingly, in a normal Release build (which includes the
"assert(L->isLCSSAForm());" assertion), asserting that the result of LCSSA
is in LCSSA form is actually slower than the LCSSA transformation pass
itself on 252.eon.  I will see if Loop::isLCSSAForm can be sped up next.

llvm-svn: 29463
2006-08-02 00:06:09 +00:00
Chris Lattner
92a0b69813 Add some advice
llvm-svn: 29324
2006-07-27 04:24:14 +00:00
Chris Lattner
e1054a6cfe silence warnings in a release build
llvm-svn: 29189
2006-07-18 21:48:57 +00:00
Chris Lattner
3a664f7dc0 eliminate some ugly code, using ConstantExpr::getWithOperands instead.
llvm-svn: 29149
2006-07-14 22:21:31 +00:00
Chris Lattner
b77e687f6f Handle instructions in the map, but that map to a null pointer.
This unbreaks smg2000.

llvm-svn: 29127
2006-07-12 21:37:11 +00:00
Chris Lattner
0d4c198ecd In addition to deleting calls, the inliner can constant fold them as well.
Handle this case, which doesn't require a new callgraph edge.  This fixes
a crash compiling MallocBench/gs.

llvm-svn: 29121
2006-07-12 18:37:18 +00:00
Chris Lattner
e5e2e8d917 Change the callgraph representation to store the callsite along with the
target CG node.  This allows the inliner to properly update the callgraph
when using the pruning inliner.  The pruning inliner may not copy over all
call sites from a callee to a caller, so the edges corresponding to those
call sites should not be copied over either.

This fixes PR827 and Transforms/Inline/2006-07-12-InlinePruneCGUpdate.ll

llvm-svn: 29120
2006-07-12 18:29:36 +00:00
Owen Anderson
7c03596d93 Fix typo in the comment.
llvm-svn: 29078
2006-07-09 21:35:40 +00:00
Owen Anderson
5812f5d7a8 Add a fix for an issue where LCSSA would fail to insert undef's in some corner
cases.  Ideally, this issue will go away in the future as LCSSA gets smarter
about which Phi nodes it inserts.

llvm-svn: 29076
2006-07-09 08:14:06 +00:00
Chris Lattner
496bd3fbf6 Use hidden visibility to make symbols in an anonymous namespace get
dropped.  This shrinks libllvmgcc.dylib another 67K

llvm-svn: 28975
2006-06-28 23:17:24 +00:00
Chris Lattner
1b42069db1 Use the PotDoms map to memoize 'dominating value' lookup. With this patch,
LCSSA is still the slowest pass when gccas'ing 252.eon, but now it only takes
39s instead of 289s. :)

llvm-svn: 28776
2006-06-14 01:13:57 +00:00
Owen Anderson
c50df7da72 Fix another instance where PHI nodes need special treatment.
llvm-svn: 28774
2006-06-13 20:50:09 +00:00
Owen Anderson
f43ab30bc0 Fix a bug that was causing major slowdowns in povray. This was due to LCSSA
not handling PHI nodes correctly when determining if a value was live-out.

This patch reduces the number of detected live-out variables in the testcase
from 6565 to 485.

llvm-svn: 28771
2006-06-13 19:37:18 +00:00
Chris Lattner
649af38df3 Fix an infinite loop on Transforms/SimplifyCFG/2006-06-12-InfLoop.ll
llvm-svn: 28758
2006-06-12 20:18:01 +00:00
Owen Anderson
a947d699dd Fix for 2006-06-26-MultipleExitsSingleBlock.
If a single exit block has multiple predecessors within the loop, it will
appear in the exit blocks list more than once.  LCSSA needs to take that into
account so that it doesn't double process that exit block.

llvm-svn: 28750
2006-06-12 07:10:16 +00:00
Owen Anderson
15b85dbfa5 Re-commit the safe parts of my 6/9 patch. Still working on fixing the unsafe parts.
llvm-svn: 28748
2006-06-11 19:22:28 +00:00
Evan Cheng
d99c8e2e5f Back out Owen's 6/9 changes. They broke MultiSource/Benchmarks/Prolangs-C/bison (and perhaps others).
llvm-svn: 28747
2006-06-11 09:32:57 +00:00
Owen Anderson
6c2f7512a6 Make Loop able to verify that it is in LCSSA-form, and have the LCSSA pass assert
on this.

llvm-svn: 28738
2006-06-09 18:33:30 +00:00
Owen Anderson
0d9583aa41 Update some comments, and expose LCSSAID in preparation for having other passes
require LCSSA.

llvm-svn: 28734
2006-06-08 20:02:53 +00:00
Owen Anderson
04f6f0775a Fix some formatting, and use inLoop() when appropriate.
llvm-svn: 28694
2006-06-06 04:36:36 +00:00
Owen Anderson
dc8495f4ad Stop a memory leak, and update some comments.
llvm-svn: 28693
2006-06-06 04:28:30 +00:00
Owen Anderson
4343713be4 Some more clean-up, and squash an IDF-Phi related bug.
llvm-svn: 28680
2006-06-04 00:55:19 +00:00
Owen Anderson
1a72d98dd2 Various clean-ups suggested by Chris.
llvm-svn: 28678
2006-06-04 00:02:23 +00:00
Owen Anderson
b83c3beb44 Fix a bug in Phi-noded insertion. Also, update some comments to reflect what's
actually going on.

llvm-svn: 28677
2006-06-03 23:22:50 +00:00
Chris Lattner
0f5ef733cc Force anything that #includes llvm/Transforms/Utils/UnifyFunctionExitNodes.h
to link in the implementation.  Thanks to Anton Korobeynikov for figuring out
what was going on here.

llvm-svn: 28660
2006-06-02 18:40:06 +00:00
Chris Lattner
3300df2fb9 Remove dead #include
llvm-svn: 28642
2006-06-01 20:02:28 +00:00
Chris Lattner
93c46b83b6 Make the "pruning cloner" smarter. As it propagates constants through the
code (while cloning) it often gets the branch/switch instructions.  Since it
knows that edges of the CFG are dead, it need not clone (or even look) at
the obviously dead blocks.  This should speed up the inliner substantially on
code where there are lots of inlinable calls to functions with constant
arguments.  On C++ code in particular, this kicks in.

llvm-svn: 28641
2006-06-01 19:19:23 +00:00
Owen Anderson
1b0cd45469 Remove a FIXME that was fixed with my last patch.
llvm-svn: 28619
2006-06-01 06:07:40 +00:00
Owen Anderson
facd63d07c More cleanups. Also, add a special case for updating PHI nodes, and
reimplement getValueDominatingFunction to walk the DominanceTree rather than
just searching blindly.

llvm-svn: 28618
2006-06-01 06:05:47 +00:00
Owen Anderson
aae280d83c Extract a huge loop into a helper method. Fix a few iterator-invalidation bugs.
llvm-svn: 28599
2006-05-31 20:55:06 +00:00
Owen Anderson
d46a77c3c8 Add Use replacement. Assuming there is nothing horribly wrong with this, LCSSA
is now theoretically feature-complete.  It has not, however, been thoroughly
test, and is still considered experimental.

llvm-svn: 28529
2006-05-29 01:00:00 +00:00
Owen Anderson
a857559867 Major think-o. Iterate over all live out-of-loop values, and perform the
other calculations on each individually, rather than trying to delay it and do
them all at the end.

llvm-svn: 28527
2006-05-28 19:33:28 +00:00
Owen Anderson
703f6baab0 Make LCSSA insert proper Phi nodes throughout the rest of the CFG by computing
the iterated Dominance Frontier of the loop-closure Phi's.  This is the
second phase of the LCSSA pass.  The third phase (coming soon) will be to
update all uses of loop variables to use the loop-closure Phi's instead.

llvm-svn: 28524
2006-05-27 18:47:11 +00:00
Chris Lattner
0189e09b89 Fix some regression from the inliner patch I committed last night. This fixes
ldecod, lencod, and SPASS.

llvm-svn: 28523
2006-05-27 17:28:13 +00:00
Chris Lattner
04d52ee9a2 Switch the inliner over to using CloneAndPruneFunctionInto. This effectively
makes it so that it constant folds instructions on the fly.  This is good
for several reasons:

0. Many instructions are constant foldable after inlining, particularly if
   inlining a call with constant arguments.
1. Without this, the inliner has to allocate memory for all of the instructions
   that can be constant folded, then a subsequent pass has to delete them.  This
   gets the job done without this extra work.
2. This makes the inliner *pass* a bit more aggressive: in particular, it
   partially solves a phase order issue where the inliner would inline lots
   of code that folds away to nothing, but think that the resultant function
   is big because of this code that will be gone.  Now the code never exists.

This is the first part of a 2-step process.  The second part will be smart
enough to see when this implicit constant folding propagates a constant into
a branch or switch instruction, making CFG edges dead.

This implements Transforms/Inline/inline_constprop.ll

llvm-svn: 28521
2006-05-27 01:28:04 +00:00
Chris Lattner
12c9d54f79 Implement a new method, CloneAndPruneFunctionInto, as documented.
llvm-svn: 28519
2006-05-27 01:22:24 +00:00
Chris Lattner
1835cfb302 Refactor some code to expose an interface to constant fold and instruction given it's opcode, typeand operands.
llvm-svn: 28517
2006-05-27 01:18:04 +00:00
Owen Anderson
1843c1ee17 A few small clean-ups, and the addition of an LCSSA statistic.
llvm-svn: 28512
2006-05-27 00:31:37 +00:00
Owen Anderson
d706fc78b2 Fix a copy-and-paste-o that would break some compilers.
llvm-svn: 28507
2006-05-26 21:19:17 +00:00
Owen Anderson
2414055ac6 Clean up and refactor LCSSA a bunch. It should also run faster now, though
there's still a lot of work to be done on it.

llvm-svn: 28506
2006-05-26 21:11:53 +00:00
Owen Anderson
93098cfc4c Skeletal LCSSA pass. This is currently non-functional. Expect functionality
and documentation updates soo.

llvm-svn: 28495
2006-05-26 13:58:26 +00:00
Chris Lattner
d3eff919d8 Revert a patch that is unsafe, due to out of range array accesses in inner
array scopes possibly accessing valid memory in outer subscripts.

llvm-svn: 28478
2006-05-25 21:25:12 +00:00
Chris Lattner
0b38bc2a99 Patch for a new instcombine xform, patch contributed by Nick Lewycky!
This implements Transforms/InstCombine/2006-05-10-InvalidIndexUndef.ll

llvm-svn: 28450
2006-05-24 17:34:30 +00:00
Reid Spencer
8d035f492c Fix a doxygen problem and break lines at 80 columns
llvm-svn: 28395
2006-05-19 19:09:46 +00:00
Chris Lattner
9a0d02f8f7 Add a CloneModule call that exposes the mapping of values from the old module
to the new module.  Patch provided by Nick Lewycky!

llvm-svn: 28349
2006-05-17 18:05:35 +00:00
Chris Lattner
5aa7f78065 remove some dead code identified by coverity
llvm-svn: 28289
2006-05-14 18:45:44 +00:00
Chris Lattner
4ad747c469 remove dead variables
llvm-svn: 28286
2006-05-14 18:33:57 +00:00
Chris Lattner
f49a22d601 Patch to make some xforms preserve each other. Patch contributed by
Domagoj Babic!

llvm-svn: 28181
2006-05-09 04:13:41 +00:00
Chris Lattner
be67e21327 Fix some nondeterminstic behavior in the mem2reg pass that (in addition to
nondeterminism being bad) could cause some trivial missed optimizations (dead
phi nodes being left around for later passes to clean up).

With this, llvm-gcc4 now bootstraps and correctly compares.  I don't know
why I never tried to do it before... :)

llvm-svn: 27984
2006-04-27 01:14:43 +00:00
Chris Lattner
a0a718c0cc Add supprot for shufflevector
llvm-svn: 27513
2006-04-08 01:19:12 +00:00
Chris Lattner
32b65613d9 Fix inlining of insert/extract element constantexprs
llvm-svn: 27478
2006-04-07 04:41:03 +00:00
Chris Lattner
e314cf19ba Adjust to change in Intrinsics.gen interface.
llvm-svn: 27344
2006-04-02 03:35:01 +00:00
Chris Lattner
704770bfe7 add valuemapper support for inline asm
llvm-svn: 27332
2006-04-01 23:17:11 +00:00
Chris Lattner
dc5d97a341 teach the inliner to work with packed constants
llvm-svn: 27161
2006-03-27 05:50:18 +00:00
Chris Lattner
a7d7a291d0 use autogenerated side-effect information
llvm-svn: 26673
2006-03-09 22:38:10 +00:00