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

3440 Commits

Author SHA1 Message Date
Owen Anderson
86690fa988 Add the beginnings of infrastructure for range tracking.
llvm-svn: 110388
2010-08-05 22:59:19 +00:00
Owen Anderson
68ee87e057 Split the tag and value members of LVILatticeVal in preparation for expanding the lattice to something that won't fit in two bits.
llvm-svn: 110383
2010-08-05 22:10:46 +00:00
Dan Gohman
7260387710 Fix memdep's code for reasoning about dependences between two calls. A Ref
response from getModRefInfo is not useful here. Instead, check for identical
calls only in the NoModRef case.

Reapply r110270, and strengthen it to compensate for the memdep changes.
When both calls are readonly, there is no dependence between them.

llvm-svn: 110382
2010-08-05 22:09:15 +00:00
Dan Gohman
c42ed0aa91 Revert r110270 for now. It appears to uncover a memdep bug.
llvm-svn: 110293
2010-08-05 00:43:10 +00:00
Dan Gohman
fc6b043376 The trouble with testing for "ModRef" and "NoModRef" is that
one is a suffix of the other, and FileCheck accepts superstrings.
Adjust the output to avoid this problem.

llvm-svn: 110280
2010-08-04 23:37:55 +00:00
Dan Gohman
dcb6099f9e The two-callsite form of AliasAnalysis::getModRefInfo is documented
to return Ref if the left callsite only reads memory read or written
by the right callsite; fix BasicAliasAnalysis to implement this.

Add AliasAnalysisEvaluator support for testing the two-callsite
form of getModRefInfo.

llvm-svn: 110270
2010-08-04 22:56:29 +00:00
Dan Gohman
bafce59252 Fix a minor bug which resulted in intermediate calculations
using wider types than are necessary.

llvm-svn: 110241
2010-08-04 19:52:50 +00:00
Torok Edwin
967fc5164f Add a missing function.
llvm-svn: 110195
2010-08-04 11:42:45 +00:00
Dan Gohman
aac19e4ffe Remove PointerAccessInfo, which nothing was using.
llvm-svn: 110167
2010-08-03 23:08:10 +00:00
Dan Gohman
a087b90950 Thread const correctness through a bunch of AliasAnalysis interfaces and
eliminate several const_casts.

Make CallSite implicitly convertible to ImmutableCallSite.

Rename the getModRefBehavior for intrinsic IDs to
getIntrinsicModRefBehavior to avoid overload ambiguity with CallSite,
which happens to be implicitly convertible to bool.

llvm-svn: 110155
2010-08-03 21:48:53 +00:00
Dan Gohman
3ea223305c The singular of "indices" is "index".
llvm-svn: 110135
2010-08-03 20:23:52 +00:00
Dan Gohman
b0d9b03b13 Delete an unused function.
llvm-svn: 110134
2010-08-03 20:20:56 +00:00
Dan Gohman
10d085dcba Make AliasAnalysis::getModRefInfo conservative in the face of volatility.
llvm-svn: 110120
2010-08-03 17:27:43 +00:00
Dan Gohman
03b02a1ee1 Fix a typo Devang noticed.
llvm-svn: 110115
2010-08-03 16:48:31 +00:00
Michael J. Spencer
5878996848 Fix CMake build
llvm-svn: 110097
2010-08-03 02:38:20 +00:00
Dan Gohman
6604a72154 Introduce a symbolic constant for ~0u for use with AliasAnalysis.
llvm-svn: 110091
2010-08-03 01:03:11 +00:00
Dan Gohman
e0489ffe8e Add a convenient form of AliasAnalysis::alias for the case where the sizes
are unknown.

llvm-svn: 110090
2010-08-03 00:56:30 +00:00
Dan Gohman
68ac0492a4 Make SCEVUnknown a CallbackVH, so that it can be notified directly
of Value deletions and RAUWs, instead of relying on ScalarEvolution's
Scalars map being notified, as that's complicated at best, and
insufficient in general.

This means SCEVUnknown needs a non-trivial destructor, so introduce
a mechanism to allow ScalarEvolution to locate all the SCEVUnknowns.

llvm-svn: 110086
2010-08-02 23:49:30 +00:00
Dan Gohman
9d80b87a4d Sketch up a preliminary Type-Based Alias Analysis implementation.
llvm-svn: 110077
2010-08-02 23:11:01 +00:00
Dan Gohman
abb2503036 Add a lint check for indirectbr with no successors.
llvm-svn: 110074
2010-08-02 23:06:43 +00:00
Devang Patel
f18faa5945 Add explicit constructors. Patch by Renato Golin.
llvm-svn: 110072
2010-08-02 22:51:46 +00:00
Dan Gohman
213f64b54c Fix namespace polution.
llvm-svn: 110056
2010-08-02 18:50:06 +00:00
Oscar Fuentes
4742c01c2a Prefix next' iterator operation with llvm::'.
Fixes potential ambiguity problems on VS 2010.

Patch by nobled!

llvm-svn: 110029
2010-08-02 06:00:15 +00:00
Owen Anderson
e1aed29cca Add an initial implementation of PHI translation for LazyValueInfo. This involves rolling back some
of my earlier data structure improvements until I can ensure that there are no iterator invalidation problems.

llvm-svn: 109935
2010-07-30 23:59:40 +00:00
Owen Anderson
4e6f48d705 Revert my last two patches to LVI, which recent changes have exposed a miscompilation in.
llvm-svn: 109889
2010-07-30 20:56:07 +00:00
Eric Christopher
6a1da7b4a5 Speculatively revert r109705 since it seems to be causing some build bot
angst.

llvm-svn: 109718
2010-07-29 01:25:38 +00:00
Dan Gohman
ea1486b53c Factor out some of the code for updating old SCEVUnknown values, and
extend it to handle the case where multiple RAUWs affect a single
SCEVUnknown.

Add a ScalarEvolution unittest to test for this situation.

llvm-svn: 109705
2010-07-29 00:17:55 +00:00
Owen Anderson
712152a68e Pass the queried value by argument rather than in a member, in preparation for supporting PHI translation.
llvm-svn: 109701
2010-07-28 23:50:08 +00:00
Owen Anderson
670fd343a5 Get rid of LVIQuery as a distinct data structure, so that we don't have to initialize a new set of maps on every query.
llvm-svn: 109679
2010-07-28 22:07:25 +00:00
Daniel Dunbar
111cf008aa RegionInfo: Make sure to free cached nodes; Tobias, please check!
llvm-svn: 109650
2010-07-28 20:28:50 +00:00
Gabor Greif
4909c0a1f1 simplify
llvm-svn: 109585
2010-07-28 15:31:37 +00:00
Gabor Greif
9bb43864b1 use Value* constructor of CallSite to create potentially improper site, and test that
llvm-svn: 109580
2010-07-28 12:35:54 +00:00
Gabor Greif
f6966fafe3 use Value* constructor of CallSite to create potentially improper site
llvm-svn: 109579
2010-07-28 12:19:46 +00:00
Gabor Greif
e27a194ce5 simplify
llvm-svn: 109578
2010-07-28 10:57:28 +00:00
Gabor Greif
6dc7dec8c1 simplify
llvm-svn: 109577
2010-07-28 10:46:09 +00:00
Dan Gohman
2bea1e1572 Make SCEVCallbackVH::allUsesReplacedWith update the old SCEVUnknown
object, as it may still be referenced by SCEVs not cleaned up by the
use list traversal.

Also, in ScalarEvolution::forgetValue, only check for a SCEVUnknown
object for the original value, not for any value in the use list,
because other SCEVUnknown values aren't necessary obsolete at that
point.

llvm-svn: 109570
2010-07-28 01:09:07 +00:00
Dan Gohman
9a6ea54d94 Make SCEVCallbackVH::allUsesReplacedWith unconditionally delete
the old value.

llvm-svn: 109567
2010-07-28 00:28:25 +00:00
Owen Anderson
2d39891e91 Rearrange several datastructures in LazyValueInfo to improve compile time.
This is still not perfect, but better than it was before.

llvm-svn: 109563
2010-07-27 23:58:11 +00:00
Gabor Greif
ec0c7b2427 reintroduce original (asserting) semantics of CallSite(Instruction *II)
add instead a CallSite(Value* V) constructor that is consistent with ImmutableCallSize
and use that one in client code

llvm-svn: 109553
2010-07-27 22:53:28 +00:00
Gabor Greif
8c197e5dbb recommit simplification (originally r109504, backed out in r109508) now that problem in CallSiteBase is fixed
llvm-svn: 109547
2010-07-27 22:02:00 +00:00
Gabor Greif
981f3d3a31 back out r109504, breaks the bots
llvm-svn: 109508
2010-07-27 15:18:11 +00:00
Gabor Greif
90a627cfaa simplify
llvm-svn: 109504
2010-07-27 14:38:38 +00:00
Gabor Greif
aaf68e2e5a use ImmutableCallSite for const-corrgoodness
llvm-svn: 109503
2010-07-27 14:15:29 +00:00
Tobias Grosser
ebc6c0cf50 RegionInfo: Add getMaxRegionExit()
getMaxRegionExit returns the exit of the maximal refined region starting
at a specific basic block.

llvm-svn: 109496
2010-07-27 08:39:43 +00:00
Tobias Grosser
16789d79fe Add function to query RegionInfo about loops.
* contains(Loop), * getOutermostLoop()
* Improve getNameStr() to return a sensible name, if basic blocks are not named.

llvm-svn: 109490
2010-07-27 04:17:13 +00:00
Owen Anderson
12ab6162bf Add an initial implementation of LazyValueInfo updating for JumpThreading. Disabled for now.
llvm-svn: 109424
2010-07-26 18:48:03 +00:00
Dan Gohman
9e0ae022d2 Fix SCEVExpander::visitAddRecExpr so that it remembers the induction variable
it inserted rather than using LoopInfo::getCanonicalInductionVariable to
rediscover it, since that doesn't work on non-canonical loops. This fixes
infinite recurrsion on such loops; PR7562.

llvm-svn: 109419
2010-07-26 18:28:14 +00:00
Dan Gohman
0627594a67 Use DominatorTree::properlyDominates instead of dominates with an
explicit inequality check.

llvm-svn: 109398
2010-07-26 17:34:05 +00:00
Dan Gohman
e6e38c1685 Eliminate getCanonicalInductionVariableIncrement's last user and
eliminate it.

llvm-svn: 109270
2010-07-23 21:34:51 +00:00
Dan Gohman
1d19d69faf Simplify this code; it can use the regular CFG utlities rather than
the BlockTraits abstractions.

llvm-svn: 109268
2010-07-23 21:25:16 +00:00
Dan Gohman
188a4d7d53 Micro-optimize SCEVComplexityCompare.
llvm-svn: 109267
2010-07-23 21:20:52 +00:00
Dan Gohman
2de2b0713e Add a const qualifier.
llvm-svn: 109266
2010-07-23 21:18:55 +00:00
Gabor Greif
346b13120a use cascading operator-> feature
llvm-svn: 109104
2010-07-22 13:49:27 +00:00
Gabor Greif
96a9f8c7c6 mass elimination of reliance on automatic iterator dereferencing
llvm-svn: 109103
2010-07-22 13:36:47 +00:00
Gabor Greif
197322c365 use -> instead of (*).
llvm-svn: 109094
2010-07-22 11:12:32 +00:00
Gabor Greif
e826ece8c2 cache dereferenced iterator
llvm-svn: 109093
2010-07-22 11:07:46 +00:00
Tobias Grosser
604a50cd71 Add new RegionInfo pass.
The RegionInfo pass detects single entry single exit regions in a function,
where a region is defined as any subgraph that is connected to the remaining
graph at only two spots.
Furthermore an hierarchical region tree is built.
Use it by calling "opt -regions analyze" or "opt -view-regions".

llvm-svn: 109089
2010-07-22 07:46:31 +00:00
Dan Gohman
859ffd353e Make NamedMDNode not be a subclass of Value, and simplify the interface
for creating and populating NamedMDNodes.

llvm-svn: 109061
2010-07-21 23:38:33 +00:00
Owen Anderson
b36d01c1b6 Add INSTANTIATE_AG_PASS, which combines RegisterPass<> with RegisterAnalysisGroup<> for pass registration.
llvm-svn: 109058
2010-07-21 23:07:00 +00:00
Owen Anderson
f8addbb0a1 Fix batch of converting RegisterPass<> to INTIALIZE_PASS().
llvm-svn: 109045
2010-07-21 22:09:45 +00:00
Jim Grosbach
4d3c808fd9 tidy up.
llvm-svn: 109038
2010-07-21 21:36:25 +00:00
Dan Gohman
fc3ee085a0 Disallow null as a named metadata operand.
Make MDNode::destroy private.
Fix the one thing that used MDNode::destroy, outside of MDNode itself.

One should never delete or destroy an MDNode explicitly. MDNodes
implicitly go away when there are no references to them (implementation
details aside).

llvm-svn: 109028
2010-07-21 18:54:18 +00:00
Dan Gohman
45ba7b5c5c Fix SCEV denormalization of expressions where the exit value from
one loop is involved in the increment of an addrec for another
loop. This fixes rdar://8168938.

llvm-svn: 108863
2010-07-20 17:06:20 +00:00
Dan Gohman
61bb92a5ff Add a fast path for x - x.
llvm-svn: 108855
2010-07-20 16:53:00 +00:00
Dan Gohman
ac63cc9b2e Simplify this code; LoopInfo::getCanonicalInductionVariable will only
find integer induction variables.

llvm-svn: 108853
2010-07-20 16:46:58 +00:00
Dan Gohman
0bfc6146bf Make getOrInsertCanonicalInductionVariable guarantee that its
result is a PHINode*.

llvm-svn: 108852
2010-07-20 16:44:52 +00:00
Dan Gohman
64ebb77660 Change an argument from an Instruction* to a Value*, which is all
that is needed here.

llvm-svn: 108850
2010-07-20 16:34:50 +00:00
Dan Gohman
6a45181120 Minor code cleanups.
llvm-svn: 108848
2010-07-20 16:32:11 +00:00
Owen Anderson
5f218b8612 Speculatively revert r108813, in an attempt to get the self-host buildbots working again. I don't see why this patch
would cause them to fail the way they are, but none of the other intervening patches seem likely either.

llvm-svn: 108818
2010-07-20 08:26:15 +00:00
Owen Anderson
cf625d0179 Reapply r108794, a fix for the failing test from last time.
llvm-svn: 108813
2010-07-20 06:52:42 +00:00
Daniel Dunbar
3280e3aebf Revert r108794, "Separate PassInfo into two classes: a constructor-free
superclass (StaticPassInfo) and a constructor-ful subclass (PassInfo).", it is
breaking teh everything.

llvm-svn: 108805
2010-07-20 03:06:07 +00:00
Owen Anderson
3502f9a91b Separate PassInfo into two classes: a constructor-free superclass (StaticPassInfo) and a constructor-ful subclass (PassInfo).
llvm-svn: 108794
2010-07-20 01:19:58 +00:00
Dan Gohman
3a3e97cdbd Minor code simplification.
llvm-svn: 108793
2010-07-20 00:57:18 +00:00
Stuart Hastings
587ed4918c Correct line info for declarations/definitions. Radar 8063111.
llvm-svn: 108784
2010-07-19 23:56:30 +00:00
Gabor Greif
17c48ecd68 eliminate CallInst::ArgOffset
llvm-svn: 108522
2010-07-16 09:38:02 +00:00
Dan Gohman
1705ac2740 Fix the order that SCEVExpander considers add operands in so that
it doesn't miss an opportunity to form a GEP, regardless of the
relative loop depths of the operands. This fixes rdar://8197217.

llvm-svn: 108475
2010-07-15 23:38:13 +00:00
Dan Gohman
04768aa9a5 Teach ScalarEvolution how to fold trunc(undef) and anyext(undef) to undef.
This helps LSR behave more consistently on bugpoint-reduced testcases.

llvm-svn: 108451
2010-07-15 20:02:11 +00:00
Gabor Greif
0b8d6a43c0 cache another dereferenced iterator
llvm-svn: 108421
2010-07-15 10:19:23 +00:00
Chris Lattner
2b2265a9c5 Fix PR7647, handling the case when 'To' ends up being
mutated by recursive simplification.  This also enhances
ReplaceAndSimplifyAllUses to actually do a real RAUW
at the end of it, which updates any value handles
pointing to "From" to start pointing to "To".  This
seems useful for debug info and random other VH users.

llvm-svn: 108415
2010-07-15 06:36:08 +00:00
Eli Friedman
f7ae898f2b Revert r108401; it breaks bootstrap :(
llvm-svn: 108407
2010-07-15 05:09:31 +00:00
Eli Friedman
5d36d37a4a Add AssertingVH which makes PR7647 break consistently.
llvm-svn: 108401
2010-07-15 04:46:14 +00:00
Dan Gohman
0af129aa1b Add a lint check for mismatched return types, inspired by PR6944.
llvm-svn: 108162
2010-07-12 18:02:04 +00:00
Duncan Sands
f7b98e2b1e Convert some tab stops into spaces.
llvm-svn: 108130
2010-07-12 08:16:59 +00:00
Chandler Carruth
6b1b1c63b9 Add parentheses around an || to correct the logic. Also silences a GCC warning
that was actually useful here.

Chris, please double check that this is the correct interpretation. I was
pretty sure, and ran it by Nick as well.

llvm-svn: 108129
2010-07-12 06:47:05 +00:00
Chris Lattner
d8288040c3 fix PR7429, a crash turning a load from a string into a float.
llvm-svn: 108113
2010-07-12 00:22:51 +00:00
Gabor Greif
0a544667f8 remove useless cast and fix typos in comment
llvm-svn: 107989
2010-07-09 16:42:04 +00:00
Gabor Greif
a2c75f904d cache result of operator*
llvm-svn: 107988
2010-07-09 16:39:02 +00:00
Gabor Greif
e249fc8808 cache result of operator*
llvm-svn: 107982
2010-07-09 16:22:36 +00:00
Gabor Greif
1277447002 cache result of operator*
llvm-svn: 107978
2010-07-09 15:53:42 +00:00
Gabor Greif
9096841571 cache result of operator*
llvm-svn: 107977
2010-07-09 15:52:36 +00:00
Gabor Greif
6184b1a2fa cache result of operator*
llvm-svn: 107976
2010-07-09 15:40:10 +00:00
Gabor Greif
6c80602356 cache result of operator*
llvm-svn: 107967
2010-07-09 14:28:41 +00:00
Gabor Greif
7bc80c7586 do not repeatedly dereference use_iterator
llvm-svn: 107963
2010-07-09 13:17:13 +00:00
Stuart Hastings
a3999081cf Reverting r107918 and r107919. Radar 8063111.
llvm-svn: 107930
2010-07-08 23:25:39 +00:00
Stuart Hastings
b70d4e06e3 Fix decl/def debug info for template functions. Radar 8063111.
llvm-svn: 107919
2010-07-08 22:28:59 +00:00
Dan Gohman
dbfdd07710 Minore code simplification.
llvm-svn: 107777
2010-07-07 14:30:04 +00:00
Dan Gohman
2a08e2ce81 Remove interprocedural-basic-aa and associated code. The AliasAnalysis
interface needs implementations to be consistent, so any code which
wants to support different semantics must use a different interface.
It's not currently worthwhile to add a new interface for this new
concept.

Document that AliasAnalysis doesn't support cross-function queries.

llvm-svn: 107776
2010-07-07 14:27:09 +00:00
Gabor Greif
600c671ab6 conditionalize by CallInst::ArgOffset
llvm-svn: 107767
2010-07-07 10:34:03 +00:00
Dan Gohman
0cea029f14 Add some more TODO comments.
llvm-svn: 107657
2010-07-06 15:23:00 +00:00
Dan Gohman
fa0252225f Add a comment.
llvm-svn: 107656
2010-07-06 15:21:57 +00:00
Dan Gohman
f9365363db Remove context sensitivity concerns from interprocedural-basic-aa, and
make it more aggressive in cases where both pointers are known to live
in the same function.

llvm-svn: 107420
2010-07-01 20:08:40 +00:00
Dan Gohman
547c92af20 In ScalarEvolution::forgetValue, eliminate any SCEVUnknown
entries associated with the value being erased in the
folding set map.  These entries used to be harmless, because
a SCEVUnknown doesn't store any information about its Value*,
so having a new Value allocated at the old Value's address
wasn't a problem. But now that ScalarEvolution is storing more
information about values, this is no longer safe.

llvm-svn: 107316
2010-06-30 20:21:12 +00:00
Dan Gohman
683a9e2498 Revert the part of r107257 which introduced new logic for using
nsw and nuw flags from IR Instructions. On further consideration,
this isn't valid.

llvm-svn: 107298
2010-06-30 17:27:11 +00:00
Dan Gohman
b7fc09a156 Improve ScalarEvolution's nsw and nuw preservation.
llvm-svn: 107257
2010-06-30 07:16:37 +00:00
Dan Gohman
7446416058 When computing a new ConservativeResult, intersect it with
the old one instead of replacing it, to be more precise.

llvm-svn: 107256
2010-06-30 06:58:35 +00:00
Dan Gohman
2112bbf184 Rework scev-aa's basic computation so that it doesn't depend
on ScalarEvolution successfully folding and preserving
range information for both A-B and B-A. Now, if it gets
either one, it's sufficient.

llvm-svn: 107249
2010-06-30 06:12:16 +00:00
Dan Gohman
01304ebfad Simplify.
llvm-svn: 107248
2010-06-30 06:09:46 +00:00
Dan Gohman
32534063c7 Fix ScalarEvolution's tripcount computation for chains of loops
where each loop's induction variable's start value is the exit
value of a preceding loop.

llvm-svn: 107224
2010-06-29 23:43:06 +00:00
Dan Gohman
1c9ce3e66d Fix whitespace style.
llvm-svn: 107175
2010-06-29 18:12:34 +00:00
Duncan Sands
b367b1e428 Remove a pointless variable.
llvm-svn: 107128
2010-06-29 11:39:45 +00:00
Benjamin Kramer
acb45b427b Use a more obvious way to avoid compiling functions which are only used when XDEBUG is enabled.
llvm-svn: 107125
2010-06-29 10:03:11 +00:00
Chandler Carruth
e9bf8c4ee8 Jump through some silly hoops to make GCC accept that a function may not always
be called.

llvm-svn: 107124
2010-06-29 06:46:00 +00:00
Dan Gohman
f5dfb360be Just as its not safe to blindly transfer the nsw bit from an add
instruction to an add scev, it's not safe to blindly transfer the
inbounds flag from a gep instruction to an nsw on the scev for the
gep.

llvm-svn: 107117
2010-06-29 01:41:41 +00:00
Dan Gohman
37bf33ccff Add an Intraprocedural form of BasicAliasAnalysis, which aims to
properly handles instructions and arguments defined in different
functions, or across recursive function iterations.

llvm-svn: 107109
2010-06-29 00:50:39 +00:00
Dan Gohman
bd121d9b9f Fix Value::stripPointerCasts and BasicAA to avoid trouble on
code in unreachable blocks, which have have use-def cycles.
This fixes PR7514.

llvm-svn: 107071
2010-06-28 21:16:52 +00:00
Dan Gohman
d454f5c234 Generalize AAEval so that it can be used both per-function and
interprocedurally. Note that as of this writing, existing alias
analysis passes are not prepared to be used interprocedurally.

llvm-svn: 107013
2010-06-28 16:01:37 +00:00
Devang Patel
fdca552823 Use named MDNode, llvm.dbg.sp, to collect subprogram info. This will be used to emit local variable's debug info of deleted functions.
llvm-svn: 106989
2010-06-28 05:53:08 +00:00
Devang Patel
858a0f3664 Do not forget last element, function, while creating Subprogram definition MDNode from subprogram declare MDNode.
llvm-svn: 106985
2010-06-27 21:04:31 +00:00
Dan Gohman
01de3704f9 Eliminate a redundant FoldingSet lookup.
llvm-svn: 106872
2010-06-25 18:47:08 +00:00
Dan Gohman
bfbfa95b51 Don't try to preserve pointer types in SCEVConstants; the old code
was over-complicated.

llvm-svn: 106760
2010-06-24 16:47:03 +00:00
Dan Gohman
35a5a7285a Make the trunc code consistent with the zext and sext code in its
handling of pointer types.

llvm-svn: 106757
2010-06-24 16:33:38 +00:00
Gabor Greif
b86c04f740 use ArgOperand accessors
llvm-svn: 106697
2010-06-23 23:38:07 +00:00
Gabor Greif
bfb7386690 use the new isFreeCall API and ArgOperand accessors
llvm-svn: 106692
2010-06-23 22:48:06 +00:00
Gabor Greif
4615fc1c93 minor enhancement to llvm::isFreeCall API: return CallInst; no functional change
llvm-svn: 106686
2010-06-23 21:51:12 +00:00
Gabor Greif
0b348ae475 use ArgOperand getters
llvm-svn: 106685
2010-06-23 21:41:47 +00:00
Dan Gohman
f44783ab4e Replace ScalarEvolution's private copy of getLoopPredecessor
with LoopInfo's public copy.

llvm-svn: 106603
2010-06-22 23:43:28 +00:00
Dan Gohman
74d5144414 Use pre-increment instead of post-increment when the result is not used.
llvm-svn: 106542
2010-06-22 15:08:57 +00:00
Dan Gohman
a3bc6b13f7 Allow "exhaustive" trip count evaluation on phi nodes with all
constant operands.

llvm-svn: 106537
2010-06-22 13:15:46 +00:00
Devang Patel
f50b6147ad Use single interface, using twine, to get named metadata.
getNamedMetadata().

llvm-svn: 106518
2010-06-22 01:19:38 +00:00
Devang Patel
dee41b010a Do not rely on Twine temporaries to survive.
llvm-svn: 106515
2010-06-22 01:01:58 +00:00
Dan Gohman
6a3c46ad49 Use A.append(...) instead of A.insert(A.end(), ...) when A is a
SmallVector, and other SmallVector simplifications.

llvm-svn: 106452
2010-06-21 19:47:52 +00:00
Devang Patel
3dbb143c29 Do not directly use function names to construct new name for named metadata.
"llvm.dbg.lv.~A" is not a valid name.

llvm-svn: 106438
2010-06-21 18:36:58 +00:00
Dan Gohman
90c5f8753d Restore a call to rememberInstruction which was accidentally dropped
in refactoring.

llvm-svn: 106398
2010-06-19 22:50:35 +00:00
Dan Gohman
cec5b682b6 Fix ScalarEvolution's "exhaustive" trip count evaluation code to avoid
assuming that loops are in canonical form, as ScalarEvolution doesn't
depend on LoopSimplify itself. Also, with indirectbr not all loops can
be simplified. This fixes PR7416.

llvm-svn: 106389
2010-06-19 14:17:24 +00:00
Dan Gohman
fb091c213b Factor out duplicated code for reusing and inserting casts into
a helper function.

llvm-svn: 106388
2010-06-19 13:25:23 +00:00
Dan Gohman
b5ec637e57 Revert r106304 (105548 and friends), which are the SCEVComplexityCompare
optimizations. There is still some nondeterminism remaining.

llvm-svn: 106306
2010-06-18 19:54:20 +00:00
Dan Gohman
527b570925 Reapply 105540, 105542, and 105548, and revert r105732.
llvm-svn: 106304
2010-06-18 19:26:04 +00:00
Dan Gohman
75f6f94c48 Reapply 105546.
llvm-svn: 106302
2010-06-18 19:12:32 +00:00
Dan Gohman
ab895769a7 Reapply 105544.
llvm-svn: 106301
2010-06-18 19:09:27 +00:00
Dan Gohman
e20e668c7e Remove getIntegerSCEV; it's redundant with getConstant, and getConstant
is more consistent with the ConstantInt API.

llvm-svn: 106281
2010-06-18 14:33:50 +00:00
Dan Gohman
0b5b93b20d Eliminate unnecessary uses of getZExtValue().
llvm-svn: 106279
2010-06-18 14:22:04 +00:00
Dan Gohman
eab6b51039 Fix a typo in a comment.
llvm-svn: 106260
2010-06-18 00:53:08 +00:00
Dan Gohman
1d9d93381a Simplify this code.
llvm-svn: 106254
2010-06-17 23:34:09 +00:00
Jim Grosbach
67b46d6303 A few more places where SCEVExpander bits need to skip over debug intrinsics
when iterating through instructions. Yet more work for rdar://7797940

llvm-svn: 106149
2010-06-16 21:13:38 +00:00
Devang Patel
108d77796f Check function pointer first, before comparing function names.
llvm-svn: 106088
2010-06-16 06:42:02 +00:00
Devang Patel
3282324020 Use separate named MDNode to hold each function's local variable info.
This speeds up local variable handling in DwarfDebug.

llvm-svn: 106075
2010-06-16 00:53:55 +00:00
Stuart Hastings
f9ef9ff3d6 Support for nested functions/classes in debug output. (Again.) Radar 7424645.
llvm-svn: 105828
2010-06-11 20:08:44 +00:00
Stuart Hastings
7b15c202c7 Delete duplicate function.
llvm-svn: 105827
2010-06-11 20:05:01 +00:00
Evan Cheng
28c151ae52 Revert 105540, 105542, 105544, 105546, and 105548 to unbreak bootstrapping.
llvm-svn: 105740
2010-06-09 18:59:43 +00:00
Kenneth Uildriks
2c6b68924d 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
Dan Gohman
490f4d7020 The FoldingSet hash data includes pointer values, so it isn't
determinstic. Instead, give SCEV objects an arbitrary sequence
number.

llvm-svn: 105548
2010-06-07 19:36:14 +00:00
Dan Gohman
ee75f6f4dd Optimize this code somewhat by taking advantage of the fact
that the operands are sorted.

llvm-svn: 105546
2010-06-07 19:20:57 +00:00
Dan Gohman
e4676a62de Micro-optimize this, to speed up this hotspot in debug builds a little.
llvm-svn: 105544
2010-06-07 19:16:37 +00:00
Dan Gohman
044a968609 Micro-optimize this.
llvm-svn: 105542
2010-06-07 19:12:54 +00:00
Dan Gohman
65954b2eb4 Optimize ScalarEvolution's SCEVComplexityCompare predicate: don't go
scrounging through SCEVUnknown contents and SCEVNAryExpr operands;
instead just do a simple deterministic comparison of the precomputed
hash data.

Also, since this is more precise, it eliminates the need for the slow
N^2 duplicate detection code.

llvm-svn: 105540
2010-06-07 19:06:13 +00:00
Bill Wendling
a96eaed21d Create new accessors to get arguments for call/invoke instructions. It breaks
encapsulation to force the users of these classes to know about the internal
data structure of the Operands structure. It also can lead to errors, like in
the MSIL writer.

llvm-svn: 105539
2010-06-07 19:05:06 +00:00
Stuart Hastings
37ed2a9663 Revert 105492 & 105493 due to a testcase regression. Radar 7424645.
llvm-svn: 105511
2010-06-05 00:39:29 +00:00
Dan Gohman
1865db1b89 LSR needs to remember inserted instructions even in postinc mode, because
there could be multiple subexpressions within a single expansion which
require insert point adjustment. This fixes PR7306.

llvm-svn: 105510
2010-06-05 00:33:07 +00:00
Stuart Hastings
eb78f8db98 Support for nested functions/classes in debug output. Radar 7424645.
llvm-svn: 105492
2010-06-04 22:36:03 +00:00
Dan Gohman
332b06bd4f Fix normalization and de-normalization of non-affine SCEVs.
llvm-svn: 105480
2010-06-04 19:16:34 +00:00
Dan Gohman
56a2a0fb80 Fix the noalias checking so that it doesn't worry about
an argument aliasing itself. Thanks Duncan!

llvm-svn: 105288
2010-06-01 20:51:40 +00:00
Dan Gohman
13a88a7def Fix AliasDebugger to be aware of operand values too.
llvm-svn: 105012
2010-05-28 22:31:51 +00:00
Dan Gohman
fe69bf7b4c Add lint checks for function attributes.
llvm-svn: 105009
2010-05-28 21:43:57 +00:00
Dan Gohman
a20b0d02e6 Fix lint's memcpy and memmove checks, and its basic block traversal.
llvm-svn: 104970
2010-05-28 17:44:00 +00:00
Dan Gohman
9a50a9215c Detect self-referential values.
llvm-svn: 104957
2010-05-28 16:45:33 +00:00
Stuart Hastings
369d3391d8 Revert 104841, 104842, 104876 due to buildbot failures. Radar 7424645.
llvm-svn: 104953
2010-05-28 16:41:07 +00:00
Dan Gohman
8570c1a249 Eli pointed out that va_arg instruction result values don't
reference the stack.

llvm-svn: 104951
2010-05-28 16:34:49 +00:00
Dan Gohman
7981165281 Teach lint how to look through simple store+load pairs and other
effective no-op constructs, to make it more effective on
unoptimized IR.

llvm-svn: 104950
2010-05-28 16:21:24 +00:00
Dan Gohman
0d7d3faf8e Move FindAvailableLoadedValue isSafeToLoadUnconditionally out of
lib/Transforms/Utils and into lib/Analysis so that Analysis passes
can use them.

llvm-svn: 104949
2010-05-28 16:19:17 +00:00
Dan Gohman
5ba21692e6 ConstantFoldConstantExpression can theoretically return null.
llvm-svn: 104948
2010-05-28 16:12:08 +00:00
Dan Gohman
a6c568fa77 Add a lint check for returning the address of stack memory.
llvm-svn: 104936
2010-05-28 04:33:42 +00:00
Stuart Hastings
60d799e343 Support for nested functions/classes in debug output. Radar 7424645.
llvm-svn: 104841
2010-05-27 16:16:54 +00:00
Jakob Stoklund Olesen
2803135445 Avoid counting InlineAsm as a call - it prevents loop unrolling.
PR7026
Patch by Pekka Jääskeläinen!

llvm-svn: 104780
2010-05-26 22:40:28 +00:00
Dan Gohman
0b5922b032 Fix Lint printing warnings multiple times. Remove the ErrorStr
option from lintModule, which was an artifact from being
based on Verifier code.

llvm-svn: 104765
2010-05-26 22:28:53 +00:00
Dan Gohman
2c70e05105 Reinstate checking of stackrestore, with checking for both Read
and Write, and add a comment explaining this.

llvm-svn: 104756
2010-05-26 22:21:25 +00:00
Dan Gohman
5ec2a338ac Stackrestore is not a load.
llvm-svn: 104752
2010-05-26 22:00:10 +00:00
Dan Gohman
35b59125b0 Remove a TODO which isn't practical.
llvm-svn: 104748
2010-05-26 21:50:41 +00:00
Dan Gohman
6b78ee79c1 Implement checking of the tail keyword.
llvm-svn: 104744
2010-05-26 21:46:36 +00:00
Devang Patel
3d4cd812aa Rename variable. add comment.
llvm-svn: 104274
2010-05-20 20:35:24 +00:00
Devang Patel
2b99c27e47 Add support to preserve type info for the variables that are removed by the optimizer.
llvm-svn: 103798
2010-05-14 21:01:35 +00:00
Nick Lewycky
b5bf752087 Clear CachedFunctionInfo upon Pass::releaseMemory. Because ValueMap will abort
on RAUW of functions, this is a correctness issue instead of a mere memory
usage problem.


No testcase until the new MergeFunctions can land.

llvm-svn: 103653
2010-05-12 21:48:15 +00:00
Dan Gohman
b993c131bd Fix whitespace in debug output to be consistent.
llvm-svn: 103422
2010-05-10 20:07:44 +00:00
Devang Patel
14f07a8625 Remove DIGlobal.
llvm-svn: 103325
2010-05-07 23:19:07 +00:00
Devang Patel
62b4a23a3b Add DINameSpace::Verify().
llvm-svn: 103318
2010-05-07 23:04:32 +00:00
Devang Patel
3c2f4664fc Verify variable directly.
llvm-svn: 103305
2010-05-07 22:04:20 +00:00
Devang Patel
0743ea736f Verify compile unit also.
llvm-svn: 103300
2010-05-07 21:42:24 +00:00
Devang Patel
0638b539bb Wrap const MDNode * inside DIDescriptor.
llvm-svn: 103295
2010-05-07 20:54:48 +00:00
Devang Patel
5b2d1c23a7 Use overloaded operators instead of DIDescriptor::getNode()
llvm-svn: 103276
2010-05-07 18:19:32 +00:00
Devang Patel
02bb578ffd Avoid DIDescriptor::getNode(). Use overloaded operators instead.
llvm-svn: 103272
2010-05-07 18:11:54 +00:00
Dan Gohman
073b9dc2df Add some words to this output to indicate what the numbers mean.
llvm-svn: 103264
2010-05-07 16:39:27 +00:00
Dan Gohman
38fe30a595 Add a simple module-level debug info printer. It just sets up a
DebugInfoFinder and iterates over all the contents calling print.

llvm-svn: 103262
2010-05-07 16:22:32 +00:00
Dan Gohman
2ec28eb3fe Fix the new print functions to call print instead of dump.
llvm-svn: 103261
2010-05-07 16:17:22 +00:00
Dan Gohman
612fbfa641 Convert the DebugInfo classes dump() methods into print(raw_ostream &)
methods, and add dump functions implemented in terms of the print.

llvm-svn: 103254
2010-05-07 15:30:29 +00:00
Dan Gohman
5c61a913b2 Use the SCEVAddRecExpr::getPostIncExpr utility function instead
of doing the same thing manually.

llvm-svn: 102997
2010-05-04 01:12:27 +00:00
Dan Gohman
4e1dbacdf8 Fix a copy+pasto.
llvm-svn: 102996
2010-05-04 01:11:15 +00:00
Devang Patel
edbef722d6 Do not ignore debug loc attached with llvm.dbg.declare while collecting debug info used by a module.
llvm-svn: 102995
2010-05-04 01:05:02 +00:00
Dan Gohman
2f27d59870 Use getConstant instead of getIntegerSCEV. The two are basically the
same, now that getConstant has overloads consistent with ConstantInt::get.

llvm-svn: 102965
2010-05-03 22:09:21 +00:00
Dan Gohman
66c6519877 Silence warnings about -1 being converted to an unsigned value.
Also, pass true for isSigned even when creating constants for unsigned
comparisons, because the point is to create an all-ones constant,
rather than UINT64_MAX, even for integers wider than 64 bits.

llvm-svn: 102946
2010-05-03 20:23:47 +00:00
Dan Gohman
51faf74c7d Use isTrueWhenEqual and isFalseWhenEqual instead of assuming that
SimplifyICmpOperands will simplify such cases to EQ or NE. This makes
the correcntess of the code independent on SimplifyICmpOperands doing
certain simplifications.

llvm-svn: 102927
2010-05-03 18:00:24 +00:00
Dan Gohman
b4fdc7ea81 In ScalarEvolution::print, don't bother printing out the SCEVs for
comparison instructions, since they aren't interesting, despite having
integer result types.

llvm-svn: 102925
2010-05-03 17:03:23 +00:00