Commit Graph

2927 Commits

Author SHA1 Message Date
Chris Lattner 397af34e6f adopt getAdjustedAnalysisPointer in BasicCallGraph.
llvm-svn: 94015
2010-01-20 19:51:46 +00:00
Chris Lattner af362f014d add some new methods to adjust this pointers. Not used yet.
llvm-svn: 94013
2010-01-20 19:26:14 +00:00
Victor Hernandez 20425abea4 Avoid unnecessary Elts array
llvm-svn: 93978
2010-01-20 05:44:11 +00:00
Dan Gohman 8d67d2f5f8 Add a comment and tidy up some whitespace.
llvm-svn: 93932
2010-01-19 22:27:22 +00:00
Dan Gohman 510bffca45 Fix a typo and an 80-column violation in comments.
llvm-svn: 93931
2010-01-19 22:26:02 +00:00
Dan Gohman f86d904b7d Give ScalarEvolution access to the DominatorTree. It'll need this
to make more intellegent AddRec folding decisions.

llvm-svn: 93930
2010-01-19 22:21:27 +00:00
Dan Gohman d693472821 Add a new helper function to IVUsers for returning the "canonical"
form of an expression. This is the expression without the
post-increment adjustment made, which is useful in determining
which registers will be used by the expansion.

llvm-svn: 93921
2010-01-19 21:55:32 +00:00
Victor Hernandez 870913f707 Make findDbgDeclare/findDbgGlobalDeclare local static functions; avoid Elts array
llvm-svn: 93764
2010-01-18 20:42:09 +00:00
Tobias Grosser 53da3f8da8 Create Generic DOTGraphTraits Printer/Viewer
Move the DOTGraphTraits dotty printer/viewer templates, that were developed for
the dominance tree into their own header file. This will allow reuse in future
passes.

llvm-svn: 93632
2010-01-16 10:56:41 +00:00
Devang Patel c0e17df3ce Replace DebugLocTuple with DILocation.
llvm-svn: 93630
2010-01-16 06:09:35 +00:00
Victor Hernandez b324e66f4c Improve llvm.dbg.declare intrinsic by referring directly to the storage in its first argument, via function-local metadata (instead of via a bitcast).
This patch also cleans up code that expects there to be a bitcast in the first argument and testcases that call llvm.dbg.declare.
It also strips old llvm.dbg.declare intrinsics that did not pass metadata as the first argument.

llvm-svn: 93531
2010-01-15 19:04:09 +00:00
Victor Hernandez 8d4904b639 Revert r93504 because older uses of llvm.dbg.declare intrinsics need to be auto-upgraded
llvm-svn: 93515
2010-01-15 17:36:47 +00:00
Victor Hernandez 5d6551816b Improve llvm.dbg.declare intrinsic by referring directly to the storage in its first argument, via function-local metadata (instead of via a bitcast).
This patch also cleans up code that expects there to be a bitcast in the first argument and testcases that call llvm.dbg.declare.

llvm-svn: 93504
2010-01-15 03:37:48 +00:00
Eric Christopher f567e1b426 Pad my commit stats by reducing indentation in this now separate
commit.

llvm-svn: 93473
2010-01-14 23:00:10 +00:00
Eric Christopher 35dd9e8e1d Few minor changes that were requested. No functional change.
llvm-svn: 93462
2010-01-14 21:48:00 +00:00
Evan Cheng 8e670ee381 Small tweak to inline cost computation. Ext of i/fcmp results are mostly optimized away in codegen.
llvm-svn: 93453
2010-01-14 21:04:31 +00:00
Eric Christopher f3ac066418 Reduce the inlining cost of functions that contain calls to easily,
and frequently optimized functions.

llvm-svn: 93448
2010-01-14 20:12:34 +00:00
Victor Hernandez 9ce5b5134d Respond to Chris' review:
Make InsertDbgValueIntrinsic() and get Offset take and recieve a uint64_t.
Get constness correct for getVariable() and getValue().

llvm-svn: 93149
2010-01-11 07:45:19 +00:00
Chris Lattner 25963c6113 "In order to ease automatic bindings generation, it would be helpful if boolean values were distinguishable from integers. The attached patch introduces "typedef int LLVMBool;", and uses LLVMBool instead of int throughout the C API, wherever a boolean value is called for."
Patch by James Y Knight!

llvm-svn: 93079
2010-01-09 22:27:07 +00:00
Dan Gohman bc694918cc Use WriteAsOperand instead of getName() to print loop header names,
so that unnamed blocks are handled.

llvm-svn: 93059
2010-01-09 18:17:45 +00:00
Chris Lattner a69f89c17a fix PR5978 by peeling the loop so that we avoid shifting the
result int by 8 for the first byte.  While normally harmless,
if the result is smaller than a byte, this shift is invalid.

llvm-svn: 93018
2010-01-08 19:02:23 +00:00
Chris Lattner 35d3b9dcd0 teach ComputeNumSignBits to look through PHI nodes.
llvm-svn: 92964
2010-01-07 23:44:37 +00:00
Duncan Sands 78376ad7e1 Partially address a README by having functionattrs consider calls to
memcpy, memset and other intrinsics that only access their arguments
to be readnone if the intrinsic's arguments all point to local memory.
This improves the testcase in the README to readonly, but it could in
theory be made readnone, however this would involve more sophisticated
analysis that looks through the memcpy.

llvm-svn: 92829
2010-01-06 08:45:52 +00:00
Dan Gohman c3f2137c06 Restore dump() methods to Loop and MachineLoop.
llvm-svn: 92772
2010-01-05 21:08:02 +00:00
Benjamin Kramer d2564e3afb Move remaining stuff to the isInteger predicate.
llvm-svn: 92771
2010-01-05 21:05: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
Devang Patel be94f23992 Remove dead debug info intrinsics.
Intrinsic::dbg_stoppoint
 Intrinsic::dbg_region_start 
 Intrinsic::dbg_region_end 
 Intrinsic::dbg_func_start
AutoUpgrade simply ignores these intrinsics now.

llvm-svn: 92557
2010-01-05 01:10:40 +00:00
Chris Lattner 8fb74c6ee2 constant fold nasty constant expressions formed by llvm-gcc,
wrapping up PR3351.

llvm-svn: 92410
2010-01-02 01:22:23 +00:00
Chris Lattner 6a0ca6aa90 fix Analysis/DebugInfo.h to not include Metadata.h. Do this
by moving one method out of line and eliminating redundant checks
from other methods.

llvm-svn: 92337
2009-12-31 03:02:08 +00:00
Chris Lattner 9b493028df rename "elements" of metadata to "operands". "Elements" are
things that occur in types.  "operands" are things that occur
in values.

llvm-svn: 92322
2009-12-31 01:22:29 +00:00
Chris Lattner 8cb6c3476d Optimize MDNode to coallocate the operand list immediately
after the MDNode in memory.  This eliminates the operands
pointer and saves a new[] per node.

Note that the code in DIDerivedType::replaceAllUsesWith is wrong
and quite scary.  A MDNode should not be RAUW'd with something
else: this changes all uses of the mdnode, which may not be debug
info related!  Debug info should use something non-mdnode for
declarations.

llvm-svn: 92321
2009-12-31 01:05:46 +00:00
Chris Lattner 8e805be369 remove a bunch of unneeded functions.
llvm-svn: 92263
2009-12-29 09:32:19 +00:00
Chris Lattner 047fd2fd97 major cleanups, much of this file was incorrectly indented.
llvm-svn: 92262
2009-12-29 09:22:47 +00:00
Chris Lattner 573f294c00 one pass of cleanup over DebugInfo.h. Much more is still needed.
llvm-svn: 92261
2009-12-29 09:15:46 +00:00
Chris Lattner a0566979b7 Final step in the metadata API restructuring: move the
getMDKindID/getMDKindNames methods to LLVMContext (and add
convenience methods to Module), eliminating MetadataContext.
Move the state that it maintains out to LLVMContext.

llvm-svn: 92259
2009-12-29 09:01:33 +00:00
Chris Lattner 2f2aa2b067 This is a major cleanup of the instruction metadata interfaces that
I asked Devang to do back on Sep 27.  Instead of going through the
MetadataContext class with methods like getMD() and getMDs(), just
ask the instruction directly for its metadata with getMetadata()
and getAllMetadata().

This includes a variety of other fixes and improvements: previously
all Value*'s were bloated because the HasMetadata bit was thrown into
value, adding a 9th bit to a byte.  Now this is properly sunk down to
the Instruction class (the only place where it makes sense) and it
will be folded away somewhere soon.

This also fixes some confusion in getMDs and its clients about 
whether the returned list is indexed by the MDID or densely packed.
This is now returned sorted and densely packed and the comments make
this clear.

This introduces a number of fixme's which I'll follow up on.

llvm-svn: 92235
2009-12-28 23:41:32 +00:00
Chris Lattner 7093946ab1 rename getMDKind -> getMDKindID, make it autoinsert if an MD Kind
doesn't exist already, eliminate registerMDKind.  Tidy up a bunch
of random stuff.

llvm-svn: 92225
2009-12-28 20:45:51 +00:00
David Greene 1495b5f887 Change dbgs() back to errs() as Chris requested.
llvm-svn: 92086
2009-12-23 23:29:28 +00:00
David Greene f790593e6e Change dbgs() back to errs() as Chris requested.
llvm-svn: 92085
2009-12-23 23:27:15 +00:00
David Greene 91b6bcefc6 Change dbgs() back to errs() for assert messages as Chris requested.
llvm-svn: 92081
2009-12-23 23:14:41 +00:00
David Greene 3d64631fef Change dbgs() back to errs() for assert messages as Chris requested.
llvm-svn: 92080
2009-12-23 23:09:39 +00:00
David Greene 3fe18e72b3 Change dbgs() back to errs() for assert messages as Chris requested.
llvm-svn: 92077
2009-12-23 23:00:50 +00:00
David Greene d79102d6f2 Change dbgs() back to errs() for assert messages as Chris requested.
llvm-svn: 92076
2009-12-23 22:59:29 +00:00
David Greene 2330f78075 Remove dump routine and the associated Debug.h from a header. Patch up
other files to compensate.

llvm-svn: 92075
2009-12-23 22:58:38 +00:00
David Greene 0295ecfea0 Change dbgs() back to errs() as Chris requested.
llvm-svn: 92073
2009-12-23 22:49:57 +00:00
David Greene 452fc61a26 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92071
2009-12-23 22:35:10 +00:00
David Greene faa00b7a7f Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92068
2009-12-23 22:28:01 +00:00
David Greene df1c497c2f Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92067
2009-12-23 22:18:14 +00:00
David Greene 2e23db1156 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92066
2009-12-23 22:10:20 +00:00
David Greene 8135870f23 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92063
2009-12-23 21:58:29 +00:00
David Greene cf1884c246 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92060
2009-12-23 21:48:18 +00:00
David Greene 1e4ea201d5 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92050
2009-12-23 21:27:29 +00:00
David Greene 047ac4aa79 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92048
2009-12-23 21:16:54 +00:00
David Greene 04e7ae6a57 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92046
2009-12-23 21:06:14 +00:00
David Greene 9507879bca Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92042
2009-12-23 20:52:41 +00:00
David Greene 37e9809294 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92040
2009-12-23 20:43:58 +00:00
David Greene a7b92ee147 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92039
2009-12-23 20:34:27 +00:00
David Greene 069857ea31 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92037
2009-12-23 20:20:46 +00:00
David Greene f8ed991e5a Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92035
2009-12-23 20:10:59 +00:00
David Greene ba44b3ed59 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92034
2009-12-23 20:03:58 +00:00
David Greene 23e8c74d69 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92033
2009-12-23 19:51:44 +00:00
David Greene 83d478145d Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92032
2009-12-23 19:45:49 +00:00
David Greene 2ec90035e8 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92029
2009-12-23 19:27:59 +00:00
David Greene 2281998095 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92026
2009-12-23 19:21:19 +00:00
David Greene a4375f1ffd Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92024
2009-12-23 19:15:13 +00:00
Chris Lattner 9b7d99eb76 The phi translated pointer can be computed when returning a partially cached result
instead of stored.  This reduces memdep memory usage, and also eliminates a bunch of
weakvh's.  This speeds up gvn on gcc.c-torture/20001226-1.c from 23.9s to 8.45s (2.8x)
on a different machine than earlier.

llvm-svn: 91885
2009-12-22 04:25:02 +00:00
Chris Lattner 2ee6787c1b avoid calling extractMallocCall when it's obvious we don't have
a call.  This speeds up memdep ~1.5%

llvm-svn: 91869
2009-12-22 01:00:32 +00:00
Chris Lattner 25bf6f8946 fix an overly conservative caching issue that caused memdep to
cache a pointer as being unavailable due to phi trans in the
wrong place.  This would cause later queries to fail even when
they didn't involve phi trans.

llvm-svn: 91787
2009-12-19 21:29:22 +00:00
Dan Gohman 876f45d7d2 Fix a spello in a comment that Nick spotted.
llvm-svn: 91742
2009-12-19 01:46:34 +00:00
Dan Gohman f902c8c1b5 Eliminate unnecessary LLVMContexts.
llvm-svn: 91729
2009-12-18 23:42:08 +00:00
Dan Gohman 7db230f5c9 Make this comment more precise.
llvm-svn: 91722
2009-12-18 23:18:03 +00:00
Dan Gohman 51f13056bd Revert this use of NUW/NSW also. Overflow-undefined multiplication isn't
associative either.

llvm-svn: 91701
2009-12-18 18:45:31 +00:00
Dan Gohman 7a2dab8826 Revert this use of NSW; this one isn't actually safe. NSW addition
is not reassociative.

llvm-svn: 91667
2009-12-18 03:57:04 +00:00
Dan Gohman 916fec41fb Delete an unused variable.
llvm-svn: 91659
2009-12-18 02:14:37 +00:00
Dan Gohman b256ccfbe5 Preserve NSW information in more places.
llvm-svn: 91656
2009-12-18 02:09:29 +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 cb0efecd33 Whitespace cleanups.
llvm-svn: 91651
2009-12-18 01:14:11 +00:00
Dan Gohman 92c3696524 Reapply LoopStrengthReduce and IVUsers cleanups, excluding the part
of 91296 that caused trouble -- the Processed list needs to be
preserved for the livetime of the pass, as AddUsersIfInteresting
is called from other passes.

llvm-svn: 91641
2009-12-18 00:06:20 +00:00
Evan Cheng 090ac0865a Revert 91280-91283, 91286-91289, 91291, 91293, 91295-91296. It apparently introduced a non-deterministic behavior in the optimizer somewhere.
llvm-svn: 91598
2009-12-17 09:39:49 +00:00
Chris Lattner a3aef788ec Fix GetConstantStringInfo to not look into MDString (it works on
real data, not metadata) and fix DbgInfoPrinter to not abuse
GetConstantStringInfo.

llvm-svn: 91444
2009-12-15 19:34:20 +00:00
Devang Patel 1f4690c624 Add support to emit debug info for C++ namespaces.
llvm-svn: 91440
2009-12-15 19:16:48 +00:00
Chris Lattner 45d040bd85 Remove isPod() from DenseMapInfo, splitting it out to its own
isPodLike type trait.  This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.

llvm-svn: 91421
2009-12-15 07:26:43 +00:00
John McCall 4ea24f19f5 You can't use typedefs to declare template member specializations, and
clang enforces it.

llvm-svn: 91397
2009-12-15 02:35:24 +00:00
Dan Gohman 2a07fd94f1 Clear the Processed set when it is no longer used, and clear the
IVUses list in releaseMemory().

llvm-svn: 91296
2009-12-14 17:35:17 +00:00
Dan Gohman fbeec7270c Fix a thinko; isNotAlreadyContainedIn had a built-in negative, so the
condition was inverted when the code was converted to contains().

llvm-svn: 91295
2009-12-14 17:31:01 +00:00
Dan Gohman 57eb6cda7a Drop Loop::isNotAlreadyContainedIn in favor of Loop::contains. The
former was just exposing a LoopInfoBase implementation detail.

llvm-svn: 91286
2009-12-14 17:06:50 +00:00
Dan Gohman 84ba039cf2 Make getUniqueExitBlocks's precondition assert more precise, to
avoid spurious failures. This fixes PR5758.

llvm-svn: 91147
2009-12-11 20:05:23 +00:00
Dan Gohman 220b196c94 Reuse the Threshold value to size these containers because it's
currently somewhat convenient for them to have the same value.

llvm-svn: 90980
2009-12-09 18:48:53 +00:00
Chris Lattner 9f9010ef47 Add a minor optimization: if we haven't changed the operands of an
add, there is no need to scan the world to find the same add again.
This invalidates the previous testcase, which wasn't wonderful anyway,
because it needed a run of instcombine to permute the use-lists in 
just the right way to before GVN was run (so it was really fragile).
Not a big loss.

llvm-svn: 90973
2009-12-09 17:27:45 +00:00
Chris Lattner fa2e536831 fix PR5733, a case where we'd replace an add with a lexically identical
binary operator that wasn't an add.  In this case, a xor.  Whoops.

llvm-svn: 90971
2009-12-09 17:18:49 +00:00
Chris Lattner eea0f58393 enhance NonLocalDepEntry to keep the per-block phi translated address
of the query.

llvm-svn: 90958
2009-12-09 07:31:04 +00:00
Chris Lattner 0c31547168 change NonLocalDepEntry from being a typedef for an std::pair to be its
own small class.  No functionality change.

llvm-svn: 90956
2009-12-09 07:08:01 +00:00
Chris Lattner 972e6d8d00 Switch GVN and memdep to use PHITransAddr, which correctly handles
phi translation of complex expressions like &A[i+1].  This has the
following benefits:

1. The phi translation logic is all contained in its own class with
   a strong interface and verification that it is self consistent.

2. The logic is more correct than before.  Previously, if intermediate
   expressions got PHI translated, we'd miss the update and scan for
   the wrong pointers in predecessor blocks.  @phi_trans2 is a testcase
   for this.

3. We have a lot less code in memdep.

We can handle phi translation across blocks of things like @phi_trans3,
which is pretty insane :).

This patch should fix the miscompiles of 255.vortex, and I tested it 
with a bootstrap of llvm-gcc, llvm-test and dejagnu of course.

llvm-svn: 90926
2009-12-09 01:59:31 +00:00
Chris Lattner 9af9d0f74e fix a nasty variable that was shadowing the real CurBB but with the wrong value.
llvm-svn: 90920
2009-12-09 01:19:16 +00:00
Chris Lattner 11da6b0050 fix many input tracking bugs.
llvm-svn: 90915
2009-12-09 00:56:14 +00:00
Dan Gohman 56a5f19c70 Fix a typo in a comment, and adjust SmallSet and SmallVector sizes,
that Chris noticed.

llvm-svn: 90910
2009-12-09 00:28:42 +00:00
Chris Lattner 37251f8375 fix PHI translation to take the PHI out of the instinputs set and add
the translated value back to it if an instruction.

llvm-svn: 90909
2009-12-09 00:18:13 +00:00
Chris Lattner cfd76375e3 instructions defined in CurBB may be intermediate nodes of the computation.
llvm-svn: 90908
2009-12-09 00:10:55 +00:00
Chris Lattner 0aa75680d6 add dumping and sanity checking support.
llvm-svn: 90906
2009-12-09 00:01:00 +00:00
Dan Gohman 2d27b191d9 Put a threshold on the number of users PointerMayBeCaptured
examines; fall back to a conservative answer if there are
more. This works around some several compile time problems
resulting from BasicAliasAnalysis calling PointerMayBeCaptured.

The value has been chosen arbitrarily.

This fixes rdar://7438917 and may partially address PR5708.

llvm-svn: 90905
2009-12-08 23:59:12 +00:00