Dan Gohman
0ad7d9c24e
Fix loop unswitching's assumption that a code path which either
...
infinite loops or exits will eventually exit. This fixes PR5373.
llvm-svn: 112745
2010-09-01 21:46:45 +00:00
Chris Lattner
bc1a65ac6c
apparently unswitch had the same "Feature". Stop its
...
claims that it preserves domfrontier if it doesn't really.
llvm-svn: 112445
2010-08-29 17:23:19 +00:00
Owen Anderson
a7aed18624
Reapply r110396, with fixes to appease the Linux buildbot gods.
...
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Owen Anderson
bda59bd247
Revert r110396 to fix buildbots.
...
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson
755aceb5d0
Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
...
ID member as the sole unique type identifier. Clean up APIs related to this change.
llvm-svn: 110396
2010-08-05 23:42:04 +00:00
Owen Anderson
a57b97e7e7
Fix batch of converting RegisterPass<> to INTIALIZE_PASS().
...
llvm-svn: 109045
2010-07-21 22:09:45 +00:00
Devang Patel
0dc3c2d37e
Use ValueMap instead of DenseMap.
...
The ValueMapper used by various cloning utility maps MDNodes also.
llvm-svn: 106706
2010-06-24 00:33:28 +00:00
Kenneth Uildriks
9b21208bfb
Pulled CodeMetrics out of InlineCost.h and made it a bit more general, so it can be reused from PartialSpecializationCost
...
llvm-svn: 105725
2010-06-09 15:11:37 +00:00
Chris Lattner
66e809acc0
remove a bunch of ad-hoc code to simplify instructions from
...
loop unswitch, and use inst simplify instead. It is more
powerful and less duplication.
llvm-svn: 101874
2010-04-20 05:33:18 +00:00
Chris Lattner
5814d9d9da
RewriteLoopBodyWithConditionConstant can end up rewriting the
...
condition we're unswitching on. In this case, don't try to
simplify the second copy of the loop which may be dead or not,
but is probably a constant now. This fixes PR6879
llvm-svn: 101870
2010-04-20 05:09:16 +00:00
Chris Lattner
c832c1bf69
some code cleanups, use SwitchInst::findCaseValue, reduce indentation
...
llvm-svn: 100468
2010-04-05 21:18:32 +00:00
Evan Cheng
ba930449a9
Code clean up.
...
llvm-svn: 100467
2010-04-05 21:16:25 +00:00
Evan Cheng
ed66db3f9b
Code refactoring.
...
llvm-svn: 100262
2010-04-03 02:23:43 +00:00
Dan Gohman
2734ebd37f
Add a DominatorTree argument to isLCSSA so that it doesn't have to
...
compute a set of reachable blocks for itself each time it is called, which
is fairly frequently.
llvm-svn: 98179
2010-03-10 19:38:49 +00:00
Duncan Sands
19d0b47b1f
There are two ways of checking for a given type, for example isa<PointerType>(T)
...
and T->isPointerTy(). Convert most instances of the first form to the second form.
Requested by Chris.
llvm-svn: 96344
2010-02-16 11:11:14 +00:00
Duncan Sands
9dff9bec31
Uniformize the names of type predicates: rather than having isFloatTy and
...
isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris!
llvm-svn: 96223
2010-02-15 16:12:20 +00:00
Chris Lattner
302240d73e
fix a crash in loop unswitch on a loop invariant vector condition.
...
llvm-svn: 95055
2010-02-02 02:26:54 +00:00
Benjamin Kramer
a81a6dff0d
Convert a ton of simple integer type equality tests to the new predicate.
...
llvm-svn: 92760
2010-01-05 20:07:06 +00:00
David Greene
d9c355d590
Change errs() to dbgs().
...
llvm-svn: 92608
2010-01-05 01:27:04 +00:00
Dan Gohman
18fa5686f6
Add Loop contains utility methods for testing whether a loop
...
contains another loop, or an instruction. The loop form is
substantially more efficient on large loops than the typical
code it replaces.
llvm-svn: 91654
2009-12-18 01:24:09 +00:00
Dan Gohman
72c367fb52
Dereference loopHeader after checking for null rather than before.
...
llvm-svn: 90990
2009-12-09 22:55:01 +00:00
Edward O'Callaghan
2b8fed15e0
Reverting patch in revision 89758, initial attempt at fixing PR5373 has proven to be bogus.
...
llvm-svn: 89844
2009-11-25 05:38:41 +00:00
Edward O'Callaghan
5fd452d596
Fix for PR5373, Credit to Jakub Staszak.
...
llvm-svn: 89758
2009-11-24 11:51:52 +00:00
Chris Lattner
46b5c642b9
remove a bunch of extraneous LLVMContext arguments
...
from various APIs, addressing PR5325.
llvm-svn: 86231
2009-11-06 04:27:31 +00:00
Dan Gohman
a83ac2d9e7
Update various Loop optimization passes to cope with the possibility that
...
LoopSimplify form may not be available.
llvm-svn: 86175
2009-11-05 21:11:53 +00:00
Chris Lattner
7a8db3a41a
if CostMetrics says to never duplicate some code, don't unswitch a loop.
...
This prevents unswitching from duplicating indbr's.
llvm-svn: 85705
2009-11-01 03:42:55 +00:00
Dan Gohman
b6b8ec769c
Restore LoopUnswitch's block-oriented threshold. LoopUnswitch now checks both
...
the estimated code size and the number of blocks when deciding whether to
do a non-trivial unswitch. This protects it from some very undesirable
worst-case behavior on large numbers of loop-unswitchable conditions, such
as in the testcase in PR5259.
llvm-svn: 84661
2009-10-20 20:06:09 +00:00
Devang Patel
92f8619923
Use isVoidTy()
...
llvm-svn: 84118
2009-10-14 17:29:00 +00:00
Devang Patel
a677136900
Check void type before using RAUWd.
...
llvm-svn: 84049
2009-10-13 22:56:32 +00:00
Devang Patel
115741ba79
Do not check use_empty() before replaceAllUsesWith(). This gives ValueHandles a chance to get properly updated.
...
llvm-svn: 84033
2009-10-13 21:41:20 +00:00
Dan Gohman
2dc6f8de03
Use the new CodeMetrics class to compute code size instead of
...
manually counting instructions.
llvm-svn: 84016
2009-10-13 20:12:23 +00:00
Dan Gohman
71ca652475
Make LoopUnswitch's cost estimation count Instructions, rather than
...
BasicBlocks, so that it doesn't blindly procede in the presence of
large individual BasicBlocks. This addresses a class of code-size
expansion problems.
llvm-svn: 83992
2009-10-13 17:50:43 +00:00
Mike Stump
deaf572ca8
Reflow comment.
...
llvm-svn: 81361
2009-09-09 17:57:16 +00:00
Dan Gohman
c56af25c01
Fix an 80-column violation.
...
llvm-svn: 81354
2009-09-09 17:17:19 +00:00
Dan Gohman
3ddbc242fb
Re-apply r80926, with fixes: keep the domtree informed of new blocks
...
that get created during loop unswitching, and fix SplitBlockPredecessors'
LCSSA updating code to create new PHIs instead of trying to just move
existing ones.
Also, optimize Loop::verifyLoop, since it gets called a lot. Use
searches on a sorted list of blocks instead of calling the "contains"
function, as is done in other places in the Loop class, since "contains"
does a linear search. Also, don't call verifyLoop from LoopSimplify or
LCSSA, as the PassManager is already calling verifyLoop as part of
LoopInfo's verifyAnalysis.
llvm-svn: 81221
2009-09-08 15:45:00 +00:00
Evan Cheng
904199547b
Revert r80926. It causes loop unswitch assertion and slow down some JIT tests significantly.
...
llvm-svn: 81101
2009-09-06 02:26:10 +00:00
Dan Gohman
4c1bdcf5d7
Add a verifyAnalysis to LoopInfo, LoopSimplify, and LCSSA form that verify
...
that these passes are properly preserved.
Fix several transformation passes that claimed to preserve LoopSimplify
form but weren't.
llvm-svn: 80926
2009-09-03 16:31:42 +00:00
Chris Lattner
2dd09dbdf7
eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861
...
llvm-svn: 80766
2009-09-02 06:11:42 +00:00
Chris Lattner
b25de3ff60
eliminate the "Value" printing methods that print to a std::ostream.
...
This required converting a bunch of stuff off DOUT and other cleanups.
llvm-svn: 79819
2009-08-23 04:37:46 +00:00
Owen Anderson
55f1c09e31
Push LLVMContexts through the IntegerType APIs.
...
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Owen Anderson
23a204d91b
Move getTrue() and getFalse() to 2.5-like APIs.
...
llvm-svn: 77685
2009-07-31 17:39:07 +00:00
Owen Anderson
b292b8ce70
Move more code back to 2.5 APIs.
...
llvm-svn: 77635
2009-07-30 23:03:37 +00:00
Daniel Dunbar
0dd5e1ed39
More migration to raw_ostream, the water has dried up around the iostream hole.
...
- Some clients which used DOUT have moved to DEBUG. We are deprecating the
"magic" DOUT behavior which avoided calling printing functions when the
statement was disabled. In addition to being unnecessary magic, it had the
downside of leaving code in -Asserts builds, and of hiding potentially
unnecessary computations.
llvm-svn: 77019
2009-07-25 00:23:56 +00:00
Owen Anderson
edb4a70325
Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
...
llvm-svn: 77011
2009-07-24 23:12:02 +00:00
Owen Anderson
47db941fd3
Get rid of the Pass+Context magic.
...
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Owen Anderson
c37bc69e91
Rename getConstantInt{True|False} to get{True|False} at Chris' behest.
...
llvm-svn: 76598
2009-07-21 18:03:38 +00:00
Dan Gohman
c43e47938a
Make makeLoopInvariant report whether it made any changes or not,
...
and use this to simplify more code.
llvm-svn: 75722
2009-07-15 01:25:43 +00:00
Dan Gohman
4d6149f356
Update LoopSimplify and LoopUnswitch to use the new makeLoopInvariant
...
function.
llvm-svn: 75584
2009-07-14 01:37:59 +00:00
Owen Anderson
1e5f00e7a7
This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
...
llvm-svn: 75200
2009-07-09 23:48:35 +00:00
Owen Anderson
39f00cc1d4
Thread LLVMContext through the constant folding APIs, which touches a lot of files.
...
llvm-svn: 74844
2009-07-06 18:42:36 +00:00
Owen Anderson
80baed63b4
Second batch of passes using LLVMContext.
...
llvm-svn: 74753
2009-07-03 00:54:20 +00:00
Duncan Sands
1efabaaa2a
Allow readonly functions to unwind exceptions. Teach
...
the optimizers about this. For example, a readonly
function with no uses cannot be removed unless it is
also marked nounwind.
llvm-svn: 71071
2009-05-06 06:49:50 +00:00
Nick Lewycky
bfd4ad67c7
Remove strange extra semicolons.
...
llvm-svn: 67287
2009-03-19 05:51:39 +00:00
Devang Patel
43a1161379
If "optimize for size" attribute is set then block non-trivial loop unswitches but allow trivial loop unswitches.
...
llvm-svn: 63670
2009-02-03 22:04:27 +00:00
Duncan Sands
5a913d61e3
Rename getAnalysisToUpdate to getAnalysisIfAvailable.
...
llvm-svn: 63198
2009-01-28 13:14:17 +00:00
Devang Patel
1c469d36b0
Undo previous patch.
...
llvm-svn: 60701
2008-12-08 17:02:37 +00:00
Chris Lattner
2b07d3ccde
switch a couple more calls to use array_pod_sort.
...
llvm-svn: 60337
2008-12-01 06:52:57 +00:00
Devang Patel
fe57d109b6
Ignore conditions that are outside the loop.
...
llvm-svn: 58631
2008-11-03 19:38:07 +00:00
Daniel Dunbar
7f39e2d85a
Change create*Pass factory functions to return Pass* instead of
...
LoopPass*.
- Although less precise, this means they can be used in clients
without RTTI (who would otherwise need to include LoopPass.h, which
eventually includes things using dynamic_cast). This was the
simplest solution that presented itself, but I am happy to use a
better one if available.
llvm-svn: 58010
2008-10-22 23:32:42 +00:00
Dan Gohman
215742a966
Use 0 instead of false to return a null pointer.
...
llvm-svn: 57660
2008-10-17 00:56:52 +00:00
Devang Patel
9eb525d4f9
Implement function notes as function attributes.
...
llvm-svn: 56716
2008-09-26 23:51:19 +00:00
Devang Patel
4c758ea3e0
Large mechanical patch.
...
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g
This sets the stage
- to implement function notes as function attributes and
- to distinguish between function attributes and return value attributes.
This requires corresponding changes in llvm-gcc and clang.
llvm-svn: 56622
2008-09-25 21:00:45 +00:00
Devang Patel
e15607b7bb
Put FN_NOTE_AlwaysInline and others in FnAttr namespace.
...
llvm-svn: 56527
2008-09-24 00:06:15 +00:00
Devang Patel
e87abd26ba
Move FN_NOTE_AlwaysInline and other out of ParamAttrs namespace.
...
Do not check isDeclaration() in hasNote(). It is clients' responsibility.
llvm-svn: 56524
2008-09-23 23:52:03 +00:00
Devang Patel
82fed6702b
Use parameter attribute store (soon to be renamed) for
...
Function Notes also. Function notes are stored at index ~0.
llvm-svn: 56511
2008-09-23 22:35:17 +00:00
Devang Patel
329fe728b5
Add hasNote() to check note associated with a function.
...
llvm-svn: 56477
2008-09-22 22:32:29 +00:00
Devang Patel
40519f0370
A loop may be unswitched multiple times. Reconstruct dom info. at the end.
...
llvm-svn: 55806
2008-09-04 22:43:59 +00:00
Devang Patel
00ec74616b
Initialize loop data first.
...
llvm-svn: 55792
2008-09-04 20:36:36 +00:00
Devang Patel
d52071540c
Do not unswitch if the function notes say we're optimizing this function for size.
...
llvm-svn: 55786
2008-09-04 18:55:13 +00:00
Dan Gohman
a79db30d28
Tidy up several unbeseeming casts from pointer to intptr_t.
...
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Devang Patel
eb611ddeb2
Do not try to update dominator info while manipulating CFG. This code does not handle all cases and keeps invalid dom info around some cases, which misleads other passes down stream.
...
Right now, dom info is recaluclated in the end if the loop is switched.
llvm-svn: 53106
2008-07-03 17:37:52 +00:00
Bill Wendling
a96eabaab7
Remove unused function.
...
llvm-svn: 53090
2008-07-03 07:10:03 +00:00
Devang Patel
226edd1826
Remove extra FIXME
...
llvm-svn: 53087
2008-07-03 06:50:04 +00:00
Devang Patel
c4dcf82a16
Reconstruct dom info, if loop is unswitched.
...
llvm-svn: 53086
2008-07-03 06:48:21 +00:00
Devang Patel
e491bb8845
LoopUnswitch does not preserve dominator info in all cases.
...
llvm-svn: 53085
2008-07-03 05:55:03 +00:00
Devang Patel
7dcfff392a
Undo previous patch. It is not that simple to fix dom info here.
...
llvm-svn: 53062
2008-07-03 00:08:13 +00:00
Devang Patel
5adfcb5783
Preserve dom info while simplifing loop after the unswitch.
...
llvm-svn: 53052
2008-07-02 22:58:54 +00:00
Devang Patel
ed50fb5b61
reuse vectors.
...
llvm-svn: 53007
2008-07-02 01:44:29 +00:00
Devang Patel
57d94d6304
Fix comment.
...
llvm-svn: 53006
2008-07-02 01:31:19 +00:00
Devang Patel
e149d4ed4d
Preserve loop data so that it is not fetched everytime it is needed.
...
Keep track of currentLoop.
llvm-svn: 53005
2008-07-02 01:18:13 +00:00
Devang Patel
cd6b697945
Preserve dominance frontier while trivially unswitching loop.
...
llvm-svn: 52438
2008-06-18 02:16:38 +00:00
Devang Patel
7314d0ee3c
Update dom tree. Fix PR 2372.
...
llvm-svn: 51887
2008-06-02 22:52:56 +00:00
Dan Gohman
f96e1371e8
Tidy up BasicBlock::getFirstNonPHI, and change a bunch of places to
...
use it instead of duplicating its functionality.
llvm-svn: 51499
2008-05-23 21:05:58 +00:00
Dan Gohman
d78c400b5b
Clean up the use of static and anonymous namespaces. This turned up
...
several things that were neither in an anonymous namespace nor static
but not intended to be global.
llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Dan Gohman
6a2da37c0e
Make several variable declarations static.
...
llvm-svn: 50696
2008-05-06 01:53:16 +00:00
Nick Lewycky
4d43d3c72c
Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989
...
r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123.
llvm-svn: 50265
2008-04-25 16:53:59 +00:00
Chris Lattner
559c867ece
fit some more code in 80 cols.
...
llvm-svn: 50016
2008-04-21 00:25:49 +00:00
Gabor Greif
e9ecc68d8f
API changes for class Use size reduction, wave 1.
...
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.
llvm-svn: 49277
2008-04-06 20:25:17 +00:00
Nick Lewycky
11fc6f8765
Update the block cloner which fixes bugpoint on code using unwind_to (phew!)
...
and also update the cloning interface's major user, the loop optimizations.
llvm-svn: 48088
2008-03-09 05:24:34 +00:00
Chris Lattner
f3ebc3f3d2
Remove attribution from file headers, per discussion on llvmdev.
...
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
David Greene
c4a80fb574
Get rid of annoying spaces.
...
llvm-svn: 45100
2007-12-17 17:40:29 +00:00
Owen Anderson
b0dd27ee91
Make LoopInfoBase more generic, in preparation for having MachineLoopInfo. This involves a small interface change.
...
llvm-svn: 44348
2007-11-27 03:43:35 +00:00
Devang Patel
2af23f976b
Do not walk invalid iterator.
...
llvm-svn: 42812
2007-10-09 21:31:36 +00:00
Devang Patel
a69f987b66
Fix bug in updating dominance frontier after loop
...
unswitch when frontier includes basic blocks that
are not inside loop.
llvm-svn: 42654
2007-10-05 22:29:34 +00:00
Devang Patel
3574759d85
Fix 80 col violation.
...
llvm-svn: 42591
2007-10-03 21:17:43 +00:00
Devang Patel
e192e32577
Refactor code in a separate method.
...
llvm-svn: 42590
2007-10-03 21:16:08 +00:00
Devang Patel
83cc3f8f51
Update aux. info associated with an instruction before erasing instruction.
...
llvm-svn: 42180
2007-09-20 23:45:50 +00:00
Devang Patel
b5933bbbd5
Use SmallVector instead of std::vector.
...
llvm-svn: 41207
2007-08-21 00:31:24 +00:00
David Greene
816a190cdf
Fix GLIBCXX_DEBUG error triggered by incrementing erased iterator.
...
llvm-svn: 40897
2007-08-07 16:44:38 +00:00
Chris Lattner
2740694450
wrap some long lines. Major offenders that are left include
...
gvn, gvnpre, dse, and predsimplify. To see these, use:
make check-line-length
llvm-svn: 40738
2007-08-02 16:53:43 +00:00