1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

2612 Commits

Author SHA1 Message Date
Duncan Sands
6f1a8215c0 The flag "--dot-cfg-only" is at the moment equivalent to the flag "--dot-cfg".
It prints the content of all bbs, instead of printing empty bbs to make the
CFG more readable.  Fix this.  Patch by Tobias Grosser.

llvm-svn: 82315
2009-09-19 11:25:44 +00:00
Victor Hernandez
66d4042178 Enhance analysis passes so that they apply the same analysis to malloc calls as to MallocInst.
Reviewed by Eli Friedman.

llvm-svn: 82281
2009-09-18 21:34:51 +00:00
Victor Hernandez
065bc44d01 Update malloc call creation code (AllocType is now the element type of the malloc, not the resulting type).
In getMallocArraySize(), fix bug in the case that array size is the product of 2 constants.

Extend isArrayMalloc() and getMallocArraySize() to handle case where malloc is used as char array.

Ensure that ArraySize in LowerAllocations::runOnBasicBlock() is correct type.

Extend Instruction::isSafeToSpeculativelyExecute() to handle malloc calls.

Add verification for malloc calls.

Reviewed by Dan Gohman.

llvm-svn: 82257
2009-09-18 19:20:02 +00:00
Nick Lewycky
9143d2c7a2 Add newlines.
llvm-svn: 82206
2009-09-18 07:36:47 +00:00
Dan Gohman
723717853b Teach ScalarEvolution how to reason about no-wrap flags on loops
where the induction variable has a non-unit stride, such as {0,+,2}, and
there are expressions such as {1,+,2} inside the loop formed with
or or add nsw operators.

llvm-svn: 82151
2009-09-17 18:05:20 +00:00
Devang Patel
371df479d4 Provide a way to extract location info from DILocation.
llvm-svn: 82064
2009-09-16 18:20:05 +00:00
Andreas Neustifter
15e9f61d26 Reapplied r81355 with the problems fixed.
(See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090907/086737.html and
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090907/086746.html)

llvm-svn: 82039
2009-09-16 11:35:50 +00:00
Chris Lattner
6302039748 simplify some code
llvm-svn: 81961
2009-09-16 00:08:07 +00:00
Dan Gohman
78b99e3761 Teach ValueTracking how to look through GlobalAliases. GlobalAliases are
not folded in the constant folder because the constant folder doesn't
simplify ConstantExpr operands.

llvm-svn: 81864
2009-09-15 16:14:44 +00:00
Chris Lattner
d219c7b6ee add a new CallGraphNode::replaceCallEdge method and use it from
argpromote to avoid invalidating an iterator.  This fixes PR4977.
All clang tests now pass with expensive checking (on my system 
at least).

llvm-svn: 81843
2009-09-15 05:40:35 +00:00
Chris Lattner
50438771c0 make -debug-pass=Executions show information about what call graph nodes
are in the SCC for each execution of a CGSCC pass.

llvm-svn: 81838
2009-09-15 05:03:04 +00:00
Andreas Neustifter
13935bc5be Bugfix. Sorry.
llvm-svn: 81517
2009-09-11 08:43:15 +00:00
Andreas Neustifter
9d49ec27fa Make ProfileEstimator even more robust on general CFGs.
llvm-svn: 81516
2009-09-11 08:39:33 +00:00
Dan Gohman
aa66e3d968 Teach lib/VMCore/ConstantFold.cpp how to set the inbounds keyword and
how to fold notionally-out-of-bounds array getelementptr indices instead
of just doing these in lib/Analysis/ConstantFolding.cpp, because it can
be done in a fairly general way without TargetData, and because not all
constants are visited by lib/Analysis/ConstantFolding.cpp. This enables
more constant folding.

Also, set the "inbounds" flag when the getelementptr indices are
one-past-the-end.

llvm-svn: 81483
2009-09-11 00:04:14 +00:00
Dan Gohman
97819c7fe8 Give these files top-level comments that describe the current code.
llvm-svn: 81473
2009-09-10 23:07:18 +00:00
Dale Johannesen
fa355ddba3 Fix uppercaseo.
llvm-svn: 81463
2009-09-10 22:01:32 +00:00
Victor Hernandez
bcdf5ed5ae Fit code within 80 columns
llvm-svn: 81459
2009-09-10 20:18:57 +00:00
Andreas Neustifter
7a526c9491 Make ProfileEstimator more robust on general CFGs.
llvm-svn: 81450
2009-09-10 16:30:38 +00:00
Benjamin Kramer
200a6693fb Add some braces to make newer GCCs happy and update CMakeLists.
llvm-svn: 81443
2009-09-10 11:31:39 +00:00
Andreas Neustifter
4d8afb529c Cleaned up code by factoring out common portions of edge loading into function.
llvm-svn: 81438
2009-09-10 07:12:35 +00:00
Evan Cheng
78182244f1 Add malloc call utility functions. Patch by Victor Hernandez.
llvm-svn: 81426
2009-09-10 04:36:43 +00:00
Andreas Neustifter
2a16f0658b Reverted r81358.
llvm-svn: 81364
2009-09-09 18:19:35 +00:00
Benjamin Kramer
66572030a8 Fix build, add missing simicolon.
llvm-svn: 81362
2009-09-09 18:03:46 +00:00
Andreas Neustifter
8b995d7f88 Add the first functions for updating ProfileInfo.
llvm-svn: 81359
2009-09-09 17:52:57 +00:00
Andreas Neustifter
e97b505f2d Cleaned up code by factoring out common portions of edge loading into funcion.
llvm-svn: 81358
2009-09-09 17:51:39 +00:00
Chris Lattner
cfd0d3e363 revert r81335, which breaks the build.
llvm-svn: 81347
2009-09-09 16:00:57 +00:00
Andreas Neustifter
14bc5768e0 Fixed wrong storage option for ProfileVerifierDisableAssertions.
Fixed non working -profile-verifier-noassert option.
Fixed missing newline in debugEntry().
Cleaned up assert messages. (assert(0 && Message) is still shown, but the message is printed before.)
When verifiying loaded profiles the ProfileVerifier got confused when block was a setjmp target, this is checked now.
When verifiying loaded profiles the ProfileVerifier got confused when block eventually reaching an exit(), this is checked now.

llvm-svn: 81338
2009-09-09 13:01:03 +00:00
Andreas Neustifter
ea41c1b35e Updated ProfileInfo to have clean seperation between different sentinels.
llvm-svn: 81335
2009-09-09 12:48:26 +00:00
Dan Gohman
cdaa08e706 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
Chris Lattner
37dbbde91b fix ComputeMaskedBits handling of zext/sext/trunc to work with vectors.
This fixes PR4905

llvm-svn: 81174
2009-09-08 00:13:52 +00:00
Chris Lattner
1247f36e13 add some comments to describe the invariants.
llvm-svn: 81173
2009-09-08 00:06:16 +00:00
Duncan Sands
357614a0ca Do not try to override non-virtual methods, especially
when the new method gives the same result as the original
(as far as I can see).  This will hopefully pacify icc.

llvm-svn: 81131
2009-09-06 20:02:00 +00:00
Duncan Sands
0d5fa5f018 Mark more constants unsigned, as warned about by icc (#68).
Patch by Erick Tryzelaar.

llvm-svn: 81116
2009-09-06 12:56:52 +00:00
Evan Cheng
a191202da5 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
Andreas Neustifter
bba38af145 Prevent warnings on compilers for which its not clear that assert won't return.
llvm-svn: 81044
2009-09-04 21:22:04 +00:00
Andreas Neustifter
a956e23520 Cleaned up ProfileVerifierPass.
(See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090831/086219.html)

llvm-svn: 81007
2009-09-04 17:15:10 +00:00
Daniel Dunbar
e1e99bbb67 Revert "--- Reverse-merging r80908 into '.':", I already "fixed" this.
llvm-svn: 80970
2009-09-03 23:40:10 +00:00
Dan Gohman
b9b2864a49 Revert 80959. It isn't sufficient to solve the full problem. And it
introduced regressions in the Ocaml bindings tests.

llvm-svn: 80969
2009-09-03 23:34:49 +00:00
Bill Wendling
faf3fd8b85 --- Reverse-merging r80908 into '.':
D    test/Analysis/Profiling

--- Reverse-merging r80907 into '.':
U    lib/Analysis/ProfileInfoLoaderPass.cpp

Attempt to remove failure in the self-hosting build bot.

llvm-svn: 80966
2009-09-03 23:13:46 +00:00
Dan Gohman
e5ec3c1a26 Remove the API for creating ConstantExprs with the nsw, nuw, inbounds,
and exact flags. Because ConstantExprs are uniqued, creating an
expression with this flag causes all expressions with the same operands
to have the same flag, which may not be safe. Add, sub, mul, and sdiv
ConstantExprs are usually folded anyway, so the main interesting flag
here is inbounds, and the constant folder already knows how to set the
inbounds flag automatically in most cases, so there isn't an urgent need
for the API support.

This can be reconsidered in the future, but for now just removing these
API bits eliminates a source of potential trouble with little downside.

llvm-svn: 80959
2009-09-03 22:17:40 +00:00
Dan Gohman
0cfbcef167 Smallvectorize switchExitBlocks.
llvm-svn: 80942
2009-09-03 20:36:13 +00:00
Dan Gohman
7296225414 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
Dan Gohman
382f174be1 Move getUniqueExitBlocks from LoopBase to Loop, since they depend on
LoopSimplify form, which is currently only available on Loops (and
not MachineLoops). Also, move the code out of the header file.

llvm-svn: 80923
2009-09-03 16:10:48 +00:00
Dan Gohman
addca8bad6 Don't try to verify a LoopPass analysis if the loop has been deleted.
llvm-svn: 80919
2009-09-03 15:09:24 +00:00
Dan Gohman
d32bdb4c58 Remove references to expression "handles", which are no longer used.
llvm-svn: 80918
2009-09-03 15:00:26 +00:00
Andreas Neustifter
9fd76dee00 Fix build warning.
llvm-svn: 80912
2009-09-03 09:11:10 +00:00
Andreas Neustifter
0b3bf54823 Code Cleanup.
(See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090831/086139.html)

llvm-svn: 80909
2009-09-03 08:41:05 +00:00
Daniel Dunbar
51ec7bb5aa Remove undefined behavior when loading optimal edge profile info.
llvm-svn: 80907
2009-09-03 07:37:42 +00:00
Gabor Greif
4604e0739b back out my recent commit (r80858), it seems to break self-hosting buildbot's stage 2 configure
llvm-svn: 80871
2009-09-03 02:02:59 +00:00
Gabor Greif
68c4f27e59 re-commit r66920 (which has been backed out in r66953) I may have more luck this time. I'll back out if needed...
llvm-svn: 80858
2009-09-03 00:18:58 +00:00
Torok Edwin
31cf28eefd Fix DbgStopPointInst->getFileName/getDirectory, broken by the MDNodification in
r80406, and readd a -print-dbginfo test.

llvm-svn: 80778
2009-09-02 11:13:56 +00:00
Chris Lattner
1f08c79edc fix PR4848 an infinite loop when indexing down through a recursive gep
and we get the original pointer type.  This doesn't mean that we're
at the first pointer being indexed.  Correct the predicate.

llvm-svn: 80762
2009-09-02 05:35:45 +00:00
Chris Lattner
140720ab83 revert my patch, duncan points out what is wrong with my logic. Add
a comment so that I don't change this in the future :)

llvm-svn: 80760
2009-09-02 04:39:04 +00:00
Chris Lattner
e1637fa3f6 one more try at making this simpler, hopefully it won't break everything :)
llvm-svn: 80759
2009-09-02 04:34:06 +00:00
Duncan Sands
b970a46d06 Complicate Chris's simplification, avoiding complaints
about singular iterators when building with expensive
checks turned on.

llvm-svn: 80757
2009-09-02 03:48:41 +00:00
Daniel Dunbar
ed881c3427 Fix build warning.
llvm-svn: 80730
2009-09-01 22:07:12 +00:00
Chris Lattner
7db43e1b57 debug intrinsics do not go in the callgraph, this fixes a couple
clang regtest failures.

llvm-svn: 80724
2009-09-01 21:37:50 +00:00
Chris Lattner
dd05e763cc Fix a regression I introduced in r80708, found by llvm-test.
llvm-svn: 80718
2009-09-01 20:33:43 +00:00
Andreas Neustifter
92a4f4d8d3 OptimalEdgeProfiling: Reading in Profiles.
This enables LLVM to read the OptimalEdgeProfiles.

llvm-svn: 80715
2009-09-01 19:08:51 +00:00
Andreas Neustifter
4ee437055b Small fix in ProfileEstimator that eliminates duplicated code.
llvm-svn: 80711
2009-09-01 19:01:59 +00:00
Chris Lattner
ccbb87c998 remove CallGraphNode::replaceCallSite, it is redundant with other APIs.
llvm-svn: 80708
2009-09-01 18:52:39 +00:00
Chris Lattner
23bedf2b9b doxygenate RefreshCallGraph, add a new 'verification mode', and run it after
CGSCC passes make change to ensure they are updating the callgraph correctly
(when assertions are enabled).

llvm-svn: 80698
2009-09-01 18:32:03 +00:00
Chris Lattner
341df26dd9 simpler solution to iterator invalidation "problem" found
by expensive checking.

llvm-svn: 80695
2009-09-01 18:13:40 +00:00
Duncan Sands
7f018fd2d3 Do not manipulate invalid iterators. This fixes the
llvm-gcc build when expensive checking is turned on.

llvm-svn: 80671
2009-09-01 15:13:02 +00:00
Benjamin Kramer
87ccd64185 Update CMakeLists.
llvm-svn: 80669
2009-09-01 10:24:10 +00:00
Andreas Neustifter
dc55b65b4c Preparation for Optimal Edge Profiling:
Optimal edge profiling is only possible when blocks with no predecessors get an
virtual edge (BB,0) that counts the execution frequencies of this
function-exiting blocks.
This patch makes the necessary changes before actually enabling optimal edge profiling.

llvm-svn: 80667
2009-09-01 10:06:05 +00:00
Andreas Neustifter
d2c2f12f1e Preparation for Optimal Edge Profiling:
This adds a pass to verify the current profile against the flow conditions.
This is very helpful when later on trying to perserve the profiling information
during all passes.

llvm-svn: 80666
2009-09-01 08:48:42 +00:00
Chris Lattner
53698d7fd7 Change CallGraphNode to maintain it's Function as an AssertingVH
for sanity.  This didn't turn up any bugs.

Change CallGraphNode to maintain its "callsite" information in the 
call edges list as a WeakVH instead of as an instruction*.  This fixes
a broad class of dangling pointer bugs, and makes CallGraph have a number
of useful invariants again.  This fixes the class of problem indicated
by PR4029 and PR3601.

llvm-svn: 80663
2009-09-01 06:31:31 +00:00
Devang Patel
9d22015258 Introduce DILocation.
llvm-svn: 80648
2009-09-01 01:14:15 +00:00
Devang Patel
fb8892d0e1 Subprogram is a scope. Derive DISubprogram from DIScope.
llvm-svn: 80637
2009-08-31 22:47:13 +00:00
Devang Patel
4a89fae1fe Rename DIBlock as DILexicalBlock.
llvm-svn: 80633
2009-08-31 22:00:15 +00:00
Dan Gohman
8e6871aa01 Don't use an iterator which is potentially invalidated.
llvm-svn: 80632
2009-08-31 21:58:28 +00:00
Devang Patel
a123ee96f4 Derive DICompileUnit from DIScope.
llvm-svn: 80627
2009-08-31 21:34:44 +00:00
Dan Gohman
297360e2b1 Extend the ValuesAtScope cache to cover all expressions, not just
SCEVUnknowns, as the non-SCEVUnknown cases in the getSCEVAtScope code
can also end up repeatedly climing through the same expression trees,
which can be unusably slow when the trees are very tall.

Also, add a quick check for SCEV pointer equality to the main
SCEV comparison routine, as the full comparison code can be expensive
in the case of large expression trees.

These fix compile-time problems in some pathlogical cases.

llvm-svn: 80623
2009-08-31 21:15:23 +00:00
Devang Patel
b31cfda0f8 Introduce DIScope.
llvm-svn: 80620
2009-08-31 20:44:45 +00:00
Devang Patel
444d9aee97 Oops. Fix inverted logic in assertion check.
llvm-svn: 80618
2009-08-31 20:27:49 +00:00
Devang Patel
29f14e754f Simplify isDerivedType() and other predicate interface.
llvm-svn: 80602
2009-08-31 18:49:10 +00:00
Chris Lattner
91cb0c1aa7 cleanups pointed out by duncan
llvm-svn: 80595
2009-08-31 17:08:30 +00:00
Chris Lattner
acdb45e484 Step #1 to giving Callgraph some sane invariants. The problems with callgraph
stem from the fact that we have two types of passes that need to update it:

1. callgraphscc and module passes that are explicitly aware of it
2. Functionpasses (and loop passes etc) that are interlaced with CGSCC passes
   by the CGSCC Passmgr.

In the case of #1, we can reasonably expect the passes to update the call
graph just like any analysis.  However, functionpasses are not and generally
should not be CG aware.  This has caused us no end of problems, so this takes
a new approach.  Logically, the CGSCC Pass manager can rescan every function 
after it runs a function pass over it to see if the functionpass made any 
updates to the IR that affect the callgraph.  This allows it to catch new calls
introduced by the functionpass.

In practice, doing this would be slow.  This implementation keeps track of
whether or not the current scc is dirtied by a function pass, and, if so, 
delays updating the callgraph until it is actually needed again.  This was
we avoid extraneous rescans, but we still have good invariants when the
callgraph is needed.

Step #2 of the "give Callgraph some sane invariants" is to change CallGraphNode
to use a CallBackVH for the callsite entry of the CallGraphNode.  This way
we can immediately remove entries from the callgraph when a FunctionPass is
active instead of having dangling pointers.  The current pass tries to tolerate
these dangling pointers, but it is just an evil hack.

This is related to PR3601/4835/4029.  This also reverts r80541, a hack working
around the sad lack of invariants.

llvm-svn: 80566
2009-08-31 07:23:46 +00:00
Chris Lattner
36e941a542 cleanups, factor some code out to a helper function
llvm-svn: 80542
2009-08-31 06:01:21 +00:00
Chris Lattner
368df2bb6f fix a crash building SPASS by tolerating a callsite that doesn't exist
in the callgraph, see the big comment at the top of the testcase.

llvm-svn: 80541
2009-08-31 05:46:59 +00:00
Chris Lattner
5eec095b87 Fix PR4834, a tricky case where the inliner would resolve an
indirect function pointer, inline it, then go to delete the body.
The problem is that the callgraph had other references to the function,
though the inliner had no way to know it, so we got a dangling pointer
and an invalid iterator out of the deal.

The fix to this is pretty simple: stop the inliner from deleting the
function by knowing that there are references to it.  Do this by making
CallGraphNodes contain a refcount.  This requires moving deletion of 
available_externally functions to the module-level cleanup sweep where
it belongs.

llvm-svn: 80533
2009-08-31 03:15:49 +00:00
Chris Lattner
c1501183f3 use an accessor instead of poking internals of a node.
llvm-svn: 80532
2009-08-31 02:24:20 +00:00
Chris Lattner
085c521fe2 Fix some nasty callgraph dangling pointer problems in
argpromotion and structretpromote.  Basically, when replacing
a function, they used the 'changeFunction' api which changes
the entry in the function map (and steals/reuses the callgraph
node).

This has some interesting effects: first, the problem is that it doesn't
update the "callee" edges in any callees of the function in the call graph.
Second, this covers for a major problem in all the CGSCC pass stuff, which 
is that it is completely broken when functions are deleted if they *don't*
reuse a CGN.  (there is a cute little fixme about this though :).

This patch changes the protocol that CGSCC passes must obey: now the CGSCC 
pass manager copies the SCC and preincrements its iterator to avoid passes
invalidating it.  This allows CGSCC passes to mutate the current SCC.  However
multiple passes may be run on that SCC, so if passes do this, they are now
required to *update* the SCC to be current when they return.

Other less interesting parts of this patch are that it makes passes update
the CG more directly, eliminates changeFunction, and requires clients of
replaceCallSite to specify the new callee CGN if they are changing it.

llvm-svn: 80527
2009-08-31 00:19:58 +00:00
Chris Lattner
ab05dcb602 add a dump() method on callgraph.
llvm-svn: 80524
2009-08-30 22:24:32 +00:00
Chris Lattner
df2191a33d default count-aa to -print-all. The whole reason to use count-aa is
to see what queries are being made by a transformation, we might as well
default to printing them.

llvm-svn: 80474
2009-08-30 04:25:40 +00:00
Dan Gohman
c9dbe1610e Add some comments.
llvm-svn: 80452
2009-08-29 23:36:57 +00:00
Devang Patel
fbaeda732e Reapply 79977.
Use MDNodes to encode debug info in llvm IR.

llvm-svn: 80406
2009-08-28 23:24:31 +00:00
Chris Lattner
04c6dc8fa5 Mark Andersen's as experimental.
llvm-svn: 80328
2009-08-28 00:45:47 +00:00
Dan Gohman
335b36bf14 Use stripPointerCasts instead of doing the same manually.
llvm-svn: 80267
2009-08-27 18:02:03 +00:00
Dan Gohman
a318ec22f2 Global Aliases are not identifiable objects.
llvm-svn: 80263
2009-08-27 17:52:56 +00:00
Dan Gohman
d3d03c966f Handle TargetData with const.
llvm-svn: 80262
2009-08-27 17:51:25 +00:00
Douglas Gregor
617131b3a4 Unbreak CMake build
llvm-svn: 80109
2009-08-26 16:33:57 +00:00
Dan Gohman
bd9174cad0 Move ProfileInfo::Edge's operator<< out of line. Among other benefits,
this eliminates the ATTRIBUTE_USED, which wasn't being used in a manner
acceptable to some GCC versions, according to the buildbots.

llvm-svn: 80103
2009-08-26 15:56:38 +00:00
Andreas Neustifter
219665e07c Implemented comments from Daniel Dunbar.
(See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090817/084958.html)

llvm-svn: 80100
2009-08-26 15:13:44 +00:00
Dan Gohman
cfb6234d13 Create a ScalarEvolution-based AliasAnalysis implementation.
This is a simple AliasAnalysis implementation which works by making
ScalarEvolution queries. ScalarEvolution has a more complete understanding
of arithmetic than BasicAA's collection of ad-hoc checks, so it handles
some cases that BasicAA misses, for example p[i] and p[i+1] within the
same iteration of a loop.

This is currently experimental. It may be that the main use for this pass
will be to help find cases where BasicAA can be profitably extended, or
to help in the development of the overall AliasAnalysis infrastructure,
however it's also possible that it could grow up to become a directly
useful pass.

llvm-svn: 80098
2009-08-26 14:53:06 +00:00
Dan Gohman
80f768698e Fix a missing newline, now that Value's operator<< doesn't add one of its own.
llvm-svn: 80096
2009-08-26 14:34:12 +00:00
Dan Gohman
8095221102 Use SetVector instead of std::set so that alias relations are tested and
printed in a deterministic order.

llvm-svn: 80095
2009-08-26 14:32:17 +00:00
Andreas Neustifter
1bf2c0e46f Moved isDeclaration() check further down to allow for function counts for
declarations if necessary.

llvm-svn: 80084
2009-08-26 13:33:09 +00:00
Devang Patel
10c075a316 Revert 79977. It causes llvm-gcc bootstrap failures on some platforms.
llvm-svn: 80073
2009-08-26 05:01:18 +00:00
Dan Gohman
4010353fac Don't assume that two identical instructions that read from memory
will always return the same value. This isn't currently necessary,
since this code doesn't currently ever get called under circumstances
where it would matter, but it may some day.

llvm-svn: 80017
2009-08-25 17:56:57 +00:00
Dan Gohman
fdaeb17036 Teach ScalarEvolution about GlobalAliases.
llvm-svn: 80014
2009-08-25 17:49:57 +00:00
Dan Gohman
53f0d68f87 Make LLVM command-line tools overwrite their output files without -f.
This is conventional command-line tool behavior. -f now just means
"enable binary output on terminals".

Add a -f option to llvm-extract and llvm-link, for consistency.

Remove F_Force from raw_fd_ostream and enable overwriting and
truncating by default. Introduce an F_Excl flag to permit users to
enable a failure when the file already exists. This flag is
currently unused.

Update Makefiles and documentation accordingly.

llvm-svn: 79990
2009-08-25 15:34:52 +00:00
Andreas Neustifter
61a98072a0 Read profile files as binary as proposed in
http://lists.cs.uiuc.edu/pipermail/llvmdev/2009-August/025020.html.

llvm-svn: 79983
2009-08-25 12:53:27 +00:00
Devang Patel
7d42bfab6c Update DebugInfo interface to use metadata, instead of special named llvm.dbg.... global variables, to encode debugging information in llvm IR. This is mostly a mechanical change that tests metadata support very well.
This change speeds up llvm-gcc by more then 6% at "-O0 -g" (measured by compiling InstructionCombining.cpp!)

llvm-svn: 79977
2009-08-25 05:24:07 +00:00
Andreas Neustifter
ab3d85ae46 This patch cleans up the ProfileInfo by
*) introducing new data type and export function of edge info for whole function (preparation for next patch).
*) renaming variables to make clear distinction between data and containers that contain this data.
*) updated comments and whitespaces.
*) made ProfileInfo::MissingValue a double (as it should be...).

(Discussed at http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090817/084955.html.)

llvm-svn: 79940
2009-08-24 21:37:48 +00:00
Chris Lattner
02d305910e remove a few dead insertion methods.
llvm-svn: 79882
2009-08-24 02:39:26 +00:00
Daniel Dunbar
40ba5f6f58 Fix -Asserts warnings.
llvm-svn: 79849
2009-08-23 10:29:55 +00:00
Chris Lattner
e9861c1cb8 remove uses of llvm/Support/Streams.h.
llvm-svn: 79838
2009-08-23 07:33:14 +00:00
Chris Lattner
f536c93134 convert LoopInfo.h and GraphWriter.h to use raw_ostream
llvm-svn: 79836
2009-08-23 07:19:13 +00:00
Chris Lattner
89d3d59e83 remove a few DOUTs here and there.
llvm-svn: 79832
2009-08-23 06:35:02 +00:00
Chris Lattner
1c0452caeb Change Pass::print to take a raw ostream instead of std::ostream,
update all code that this affects.

llvm-svn: 79830
2009-08-23 06:03:38 +00:00
Chris Lattner
ea2bfd7a9f eliminate the std::ostream form of WriteAsOperand and update clients.
This also updates dominator related stuff.

llvm-svn: 79825
2009-08-23 05:17:37 +00:00
Chris Lattner
01dae858b6 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
Dan Gohman
aac0378610 Don't assume that the operand of an inttoptr is an pointer-sized integer.
llvm-svn: 79651
2009-08-21 18:27:26 +00:00
Dan Gohman
d240c19451 Change getelementptr folding to use APInt instead of uint64_t for
offset computations. This fixes a truncation bug on targets that
don't have 64-bit pointers.

llvm-svn: 79639
2009-08-21 16:52:54 +00:00
Richard Pennington
2d2ff4d30e bug 4530: Make debug information static to it is preservered during bitcode linking.
llvm-svn: 79616
2009-08-21 11:10:31 +00:00
Dan Gohman
6ec8176e22 Rename hasNoUnsignedOverflow and hasNoSignedOverflow to hasNoUnsignedWrap
and hasNoSignedWrap, for consistency with the nuw and nsw properties.

llvm-svn: 79539
2009-08-20 17:11:38 +00:00
Dan Gohman
d9766dcb85 Various comment and whitespace cleanups.
llvm-svn: 79533
2009-08-20 16:42:55 +00:00
Dan Gohman
cc511acf87 Fix a bug in the over-index constant folding. When over-indexing an
array member of a struct, it's possible to land in an arbitrary position
inside that struct, such that attempting to find further getelementptr
indices will fail. In such cases, folding cannot be done.

llvm-svn: 79485
2009-08-19 22:46:59 +00:00
Dan Gohman
ba656de4a4 Use hasDefinitiveInitializer() instead of testing the same thing
by hand, and fix a few places that were using hasInitializer() that
appear to depend on the initializer value.

llvm-svn: 79441
2009-08-19 18:20:44 +00:00
Dan Gohman
bc59c24278 Canonicalize indices in a constantexpr GEP. If Indices exceed the
static extents of the static array type, it causes GlobalOpt and
other passes to be more conservative. This canonicalization also
allows the constant folder to add "inbounds" to GEPs.

llvm-svn: 79440
2009-08-19 18:18:36 +00:00
Andreas Neustifter
7cffe838a8 Broke line before break.
llvm-svn: 79404
2009-08-19 05:44:39 +00:00
Dan Gohman
807652ac3a Fix SimplifyLibcalls and ValueTracking to check mayBeOverridden
before performing optimizations based on constant string values.

llvm-svn: 79384
2009-08-19 00:11:12 +00:00
Dan Gohman
b0cf049a1e Generalize ScalarEvolution to be able to analyze GEPs when
TargetData is not present. It still uses TargetData when available.
This generalization also fixed some limitations in the TargetData
case; the attached testcase covers this.

llvm-svn: 79344
2009-08-18 16:46:41 +00:00
Devang Patel
b3c1574994 Oops. find all llvm.dbg.global_variables.
llvm-svn: 79274
2009-08-17 20:36:20 +00:00
Dan Gohman
7c8c5606ce Fix more missing newlines.
llvm-svn: 79244
2009-08-17 15:29:31 +00:00
Owen Anderson
dc11fe967d Actually privatize a IntegerTypes, and fix a few bugs exposed by this.
llvm-svn: 78955
2009-08-13 23:27:32 +00:00
Owen Anderson
9df206d02d Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Dan Gohman
fdfa3dc188 Fix a missing newline (now that Value*'s operator<< doesn't append one).
llvm-svn: 78814
2009-08-12 16:48:27 +00:00
Dan Gohman
cf73a006f0 Use isa instead of dyn_cast when the result is only converted to bool.
llvm-svn: 78685
2009-08-11 17:20:16 +00:00
Dan Gohman
24939b2c4f Tidy #includes.
llvm-svn: 78677
2009-08-11 16:02:12 +00:00
Dan Gohman
08e747855c Don't assume that external global variables are aligned at their preferred
alignment. Only the minimum alignment guaranteed by the ABI may be assumed.

llvm-svn: 78668
2009-08-11 15:50:03 +00:00
Devang Patel
86894d4e56 Keep track of DIType.
llvm-svn: 78602
2009-08-10 22:09:58 +00:00
Daniel Dunbar
9d9f5741a8 Some ProfileInfo cleanups.
- Part of optimal static profiling patch sequence by Andreas Neustifter.

llvm-svn: 78485
2009-08-08 18:59:03 +00:00
Daniel Dunbar
6eb6029bc2 Add a basic static ProfileInfo provider (ProfileEstimatorPass).
- Part of optimal static profiling patch sequence by Andreas Neustifter.

llvm-svn: 78484
2009-08-08 18:44:18 +00:00
Daniel Dunbar
87825212a4 More ProfileInfo improvements.
- Part of optimal static profiling patch sequence by Andreas Neustifter.

 - Store edge, block, and function information separately for each functions
   (instead of in one giant map).

 - Return frequencies as double instead of int, and use a sentinel value for
   missing information.

llvm-svn: 78477
2009-08-08 17:43:09 +00:00
Andreas Bolka
5356a5f16b Fix copy-pasto.
llvm-svn: 78426
2009-08-07 22:55:26 +00:00
Andreas Bolka
7ded8b7bdf SIV/MIV classification for LDA.
LoopDependenceAnalysis::getLoops is currently O(N*M) for a loop-nest of
depth N and a compound SCEV of M atomic SCEVs. As both N and M will
typically be very small, this should not be a problem. If it turns out
to be one, rewriting getLoops as SCEVVisitor will reduce complexity to
O(M).

llvm-svn: 78394
2009-08-07 18:23:41 +00:00
Daniel Dunbar
6782bf5556 Remove unused function.
llvm-svn: 78366
2009-08-07 03:52:07 +00:00
Dan Gohman
1c41d60c4a Fix a bunch of namespace pollution.
llvm-svn: 78363
2009-08-07 01:32:21 +00:00
Devang Patel
86c0c7abf1 Remove dead code.
llvm-svn: 78335
2009-08-06 20:57:44 +00:00
Andreas Bolka
eb5ba4eddf Simplify the ZIV tester to the max.
As suggested by Nick Lewycky.

llvm-svn: 78277
2009-08-06 03:10:33 +00:00
Owen Anderson
3d0e1b855d Privatize the StructType table, which unfortunately involves routing contexts through a number of APIs.
llvm-svn: 78258
2009-08-05 23:16:16 +00:00
Daniel Dunbar
49dc5e993d Make block and function count available via ProfileInfo.
- Part of optimal static profiling patch sequence by Andreas Neustifter.

llvm-svn: 78247
2009-08-05 21:51:16 +00:00
Daniel Dunbar
eabd825693 Remove unnecessary ProfileInfoLoader methods.
- Part of optimal static profiling patch sequence by Andreas Neustifter.

llvm-svn: 78199
2009-08-05 15:55:56 +00:00
Andreas Bolka
4d59f26912 ZIV tester for LDA.
llvm-svn: 78157
2009-08-05 04:26:05 +00:00
Andreas Bolka
fcea3a23a0 Restrict LDA to GEPs with the same pointer offset.
We can not simply apply ZIV testing to the pointer offsets, as this
would incorrectly return independence for e.g. (GEP x,0,i; GEP x,1,-i).

llvm-svn: 78155
2009-08-05 04:13:41 +00:00
Andreas Bolka
6fc741e683 Restrict LDA to affine subscripts.
llvm-svn: 77932
2009-08-03 01:03:48 +00:00
Dan Gohman
40e39492e8 LibCallAliasAnalysis doesn't use TargetData.
llvm-svn: 77729
2009-07-31 20:56:29 +00:00