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

2966 Commits

Author SHA1 Message Date
Victor Hernandez
97d7107d5e 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
aee71b4e81 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
9230a37bb0 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
013342ad23 Few minor changes that were requested. No functional change.
llvm-svn: 93462
2010-01-14 21:48:00 +00:00
Evan Cheng
595cdb7091 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
b2708c4ba1 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
832bd4fd2d 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
953394de82 "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
771144e807 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
0dc48180de 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
944f9c4ac1 teach ComputeNumSignBits to look through PHI nodes.
llvm-svn: 92964
2010-01-07 23:44:37 +00:00
Duncan Sands
4ef1119d94 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
b4e120e7a7 Restore dump() methods to Loop and MachineLoop.
llvm-svn: 92772
2010-01-05 21:08:02 +00:00
Benjamin Kramer
0ba7479f2c Move remaining stuff to the isInteger predicate.
llvm-svn: 92771
2010-01-05 21:05:54 +00:00
Benjamin Kramer
c233521d45 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
3b08c33f33 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
8a0648118b 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
ecba817b0e 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
c12382b7c8 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
9afb6e9c27 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
d981b3fc91 remove a bunch of unneeded functions.
llvm-svn: 92263
2009-12-29 09:32:19 +00:00
Chris Lattner
430379c2d5 major cleanups, much of this file was incorrectly indented.
llvm-svn: 92262
2009-12-29 09:22:47 +00:00
Chris Lattner
f0034478f8 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
84e9de4a58 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
9ec640a902 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
cd3aa9d1ff 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
c0eced92e3 Change dbgs() back to errs() as Chris requested.
llvm-svn: 92086
2009-12-23 23:29:28 +00:00
David Greene
693db7a309 Change dbgs() back to errs() as Chris requested.
llvm-svn: 92085
2009-12-23 23:27:15 +00:00
David Greene
0c06474821 Change dbgs() back to errs() for assert messages as Chris requested.
llvm-svn: 92081
2009-12-23 23:14:41 +00:00
David Greene
5980bb69ba Change dbgs() back to errs() for assert messages as Chris requested.
llvm-svn: 92080
2009-12-23 23:09:39 +00:00
David Greene
b73d637eba Change dbgs() back to errs() for assert messages as Chris requested.
llvm-svn: 92077
2009-12-23 23:00:50 +00:00
David Greene
f227aac0f4 Change dbgs() back to errs() for assert messages as Chris requested.
llvm-svn: 92076
2009-12-23 22:59:29 +00:00
David Greene
1b160211dd 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
dafe3d88d6 Change dbgs() back to errs() as Chris requested.
llvm-svn: 92073
2009-12-23 22:49:57 +00:00
David Greene
02480b7d83 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
b348240e9c 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
62d4863b56 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
f2377def25 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
fc8ae247eb 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
4caa552456 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
c8b577197f 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
fd7042fa79 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
28b8bcd98d 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
33f717c804 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
016e0af68d 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
1c88ae8f15 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
e34eb9cc32 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
a2539e0ff7 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
2a072c7ac5 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
218c909299 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
bcfb683e76 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
b7dde86ae2 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
f0082114af 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
4d8f4303bd 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
cd79ebb23c 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
15c2988820 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
07f0e8ec8a 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
a9cdf5b0d8 Fix a spello in a comment that Nick spotted.
llvm-svn: 91742
2009-12-19 01:46:34 +00:00
Dan Gohman
4e04fb5ca8 Eliminate unnecessary LLVMContexts.
llvm-svn: 91729
2009-12-18 23:42:08 +00:00
Dan Gohman
f4af7d049c Make this comment more precise.
llvm-svn: 91722
2009-12-18 23:18:03 +00:00
Dan Gohman
34f714b928 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
2e46566444 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
ec766ea441 Delete an unused variable.
llvm-svn: 91659
2009-12-18 02:14:37 +00:00
Dan Gohman
91b1161840 Preserve NSW information in more places.
llvm-svn: 91656
2009-12-18 02:09:29 +00:00
Dan Gohman
0f8f7f179d 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
7c0f6a6c1b Whitespace cleanups.
llvm-svn: 91651
2009-12-18 01:14:11 +00:00
Dan Gohman
c483bed5e8 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
18e334195d 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
ea6ba0d59b 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
ffb33d1df8 Add support to emit debug info for C++ namespaces.
llvm-svn: 91440
2009-12-15 19:16:48 +00:00
Chris Lattner
587962c667 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
6bf01a2caf 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
106fce040d 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
abb2ea84d9 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
c6a7652b5e 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
c22d542754 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
663165c16f 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
2f9b661ab8 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
e05f9a128c 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
366b8ac755 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
e0207b46d2 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
dda5ca59e2 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
9c2474e272 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
3211af28ba fix many input tracking bugs.
llvm-svn: 90915
2009-12-09 00:56:14 +00:00
Dan Gohman
ed3d370a10 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
c457aaea0d 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
b0d20540ad instructions defined in CurBB may be intermediate nodes of the computation.
llvm-svn: 90908
2009-12-09 00:10:55 +00:00
Chris Lattner
83cb0b1450 add dumping and sanity checking support.
llvm-svn: 90906
2009-12-09 00:01:00 +00:00
Dan Gohman
2d7d4fb9a6 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
Chris Lattner
604cebbfc1 make sure that PHITransAddr keeps its 'InstInputs' list up to
date when instsimplify kicks in.

llvm-svn: 90901
2009-12-08 23:42:51 +00:00
Devang Patel
11874672da Revert 90858 90875 and 90805 for now.
llvm-svn: 90898
2009-12-08 23:21:45 +00:00
Chris Lattner
8cc673c6a0 fix a typo (and -> add) and fix GetAvailablePHITranslatedSubExpr to not
side-effect the current object.

llvm-svn: 90837
2009-12-08 06:06:26 +00:00
Victor Hernandez
f5143485fa Rename DIFactory::InsertValue() as DIFactory::InsertDbgValueIntrinsic()
llvm-svn: 90807
2009-12-07 21:54:43 +00:00
Devang Patel
e59f4f7204 Add support to emit debug info for c++ style namespaces.
llvm-svn: 90805
2009-12-07 21:41:32 +00:00
Chris Lattner
3d338590d6 fix typo
llvm-svn: 90793
2009-12-07 19:52:57 +00:00
Chris Lattner
9ed7e3ffb9 add accessor, improve comment.
llvm-svn: 90792
2009-12-07 19:45:30 +00:00
Victor Hernandez
2a16652946 Introduce the "@llvm.dbg.value" debug intrinsic.
The semantics of llvm.dbg.value are that starting from where it is executed, an offset into the specified user source variable is specified to get a new value.

An example:
  call void @llvm.dbg.value(metadata !{ i32 7 }, i64 0, metadata !2)
Here the user source variable associated with metadata #2 gets the value "i32 7" at offset 0.
 

llvm-svn: 90788
2009-12-07 19:36:34 +00:00
Chris Lattner
233d9bf82d add support for phi translation and incorpation of new expression.
llvm-svn: 90782
2009-12-07 19:04:49 +00:00
Chris Lattner
0a810a827f checkpoint of the new PHITransAddr code, still not done and not used by
anything.

llvm-svn: 90779
2009-12-07 18:36:53 +00:00
Nick Lewycky
056fe5f97d Fix indentation in switch statement.
llvm-svn: 90650
2009-12-05 06:37:24 +00:00
Chris Lattner
107fc93d48 Fix PR5551 by not ignoring the top level constantexpr when
folding a load from constant.

llvm-svn: 90545
2009-12-04 06:29:29 +00:00
Chris Lattner
269f4c1c24 add to cmake
llvm-svn: 90539
2009-12-04 04:15:36 +00:00
Chris Lattner
167f1dc040 add the start of a class used to handle phi translation in memdep and
gvn (this is just a skeleton so far).  This will ultimately be used
to fix a nasty miscompilation with GVN.

llvm-svn: 90518
2009-12-04 02:10:16 +00:00
Bob Wilson
052088272f Fix a comment typo.
llvm-svn: 90511
2009-12-04 01:33:04 +00:00
Devang Patel
fe7cf074f0 Add support to emit debug info for virtual functions and virtual base classes.
llvm-svn: 90474
2009-12-03 19:11:07 +00:00
Benjamin Kramer
ea59929634 Fix MSVC build.
llvm-svn: 90454
2009-12-03 13:23:03 +00:00
Andreas Neustifter
aed28d814f Convert ProfileVerifier to template so it can be used for different types of ProfileInfo.
llvm-svn: 90451
2009-12-03 12:55:57 +00:00
Andreas Neustifter
75c913c200 Do not create negative edge weights in ProfileEstimator.
Use integer values for weights to prevent rounding errors.
Make ProfileEstimator more robust in general CFGs.

llvm-svn: 90449
2009-12-03 12:41:14 +00:00
Andreas Neustifter
39cc7661ad Use ProfileInfo-API in ProfileInfo Loader and do more assertions.
llvm-svn: 90446
2009-12-03 11:00:37 +00:00
Andreas Neustifter
83d47e4f5f Converted ProfileInfo to template, added more API for ProfileInfo-preserving.
llvm-svn: 90445
2009-12-03 09:30:12 +00:00
Chris Lattner
851aea6ce2 fix PR5673 by being more careful about pointers to functions.
llvm-svn: 90369
2009-12-03 01:05:45 +00:00
Chris Lattner
9ce833945e improve portability to avoid conflicting with std::next in c++'0x.
Patch by Howard Hinnant!

llvm-svn: 90365
2009-12-03 00:50:42 +00:00
Benjamin Kramer
65c962b3aa Silence compiler warnings.
llvm-svn: 90319
2009-12-02 15:33:44 +00:00
Owen Anderson
f47cde694f Cleanup/remove some parts of the lifetime region handling code in memdep and GVN,
per Chris' comments.  Adjust testcases to match.

llvm-svn: 90304
2009-12-02 07:35:19 +00:00
Mon P Wang
91ac05d480 Fixed an assertion failure for tracking sext of a vector of integers
llvm-svn: 90290
2009-12-02 04:59:58 +00:00
Devang Patel
122acaf238 Add utility routine to create subprogram definition entry from subprogram declaration entry.
llvm-svn: 90282
2009-12-01 23:09:02 +00:00
Chris Lattner
cb2e2bd645 rename some variables.
llvm-svn: 90258
2009-12-01 21:16:01 +00:00
Chris Lattner
9cd2498f45 tidy
llvm-svn: 90257
2009-12-01 21:15:15 +00:00
Chris Lattner
d576951cec fix 255.vortex again, third time's the charm.
llvm-svn: 90217
2009-12-01 07:33:32 +00:00
Tobias Grosser
74c7605daf Remove ShortNames from getNodeLabel in DOTGraphTraits
llvm-svn: 90134
2009-11-30 12:38:47 +00:00
Tobias Grosser
48d8ba7043 Instantiate DefaultDOTGraphTraits
llvm-svn: 90133
2009-11-30 12:38:13 +00:00
Tobias Grosser
38b3077d08 Small PostDominatorTree improvements
* Do not SEGFAULT if tree entryNode() is NULL
 * Print function names in dotty printer

llvm-svn: 90130
2009-11-30 12:06:37 +00:00
Nick Lewycky
81fea1665b Revert r90107, fixing test/Transforms/GVN/2009-11-29-ReverseMap.ll and the
llvm-gcc build.

llvm-svn: 90113
2009-11-30 07:05:51 +00:00
Chris Lattner
dd895d559f reapply r90093 with an addition of keeping the forward
and reverse nonlocal memdep maps in synch, this should
fix 255.vortex.

llvm-svn: 90107
2009-11-30 02:26:29 +00:00
Nick Lewycky
116b145b02 Teach ConstantFolding to do a better job when folding gep(bitcast).
This permits the devirtualization of llvm.org/PR3100#c9 when compiled by clang.

llvm-svn: 90099
2009-11-29 21:40:55 +00:00
Chris Lattner
de1d55c200 revert this patch for now, it causes failures of:
LLVM::Transforms/GVN/2009-02-17-LoadPRECrash.ll
    LLVM::Transforms/GVN/2009-06-17-InvalidPRE.ll

llvm-svn: 90096
2009-11-29 21:14:59 +00:00
Chris Lattner
6155ce3427 Fix a really nasty caching bug I introduced in memdep. An entry
was being added to the Result vector, but not being put in the
cache.  This means that if the cache was reused wholesale for a
later query that it would be missing this entry and we'd do an
incorrect load elimination.

Unfortunately, it's not really possible to write a useful 
testcase for this, but this unbreaks 255.vortex.

llvm-svn: 90093
2009-11-29 21:09:36 +00:00
Nick Lewycky
2c7105b098 Detabify.
llvm-svn: 90085
2009-11-29 18:10:39 +00:00
Nick Lewycky
ff44d9d88a Teach memdep to look for memory use intrinsics during dependency queries. Fixes
PR5574.

llvm-svn: 90045
2009-11-28 21:27:49 +00:00
Chris Lattner
f8d8142a06 Enhance InsertPHITranslatedPointer to be able to return a list of newly
inserted instructions.  No functionality change until someone starts using it.

llvm-svn: 90039
2009-11-28 15:39:14 +00:00
Chris Lattner
f825d5d176 implement a FIXME: limit the depth that DecomposeGEPExpression goes the same
way that getUnderlyingObject does it. 

This fixes the 'DecomposeGEPExpression and getUnderlyingObject disagree!' 
assertion on sqlite3.

llvm-svn: 90038
2009-11-28 15:12:41 +00:00
Chris Lattner
2e5340d0dc enable code to handle un-phi-translatable cases more aggressively:
if we don't have an address expression available in a predecessor,
then model this as the value being clobbered at the end of the pred
block instead of being modeled as a complete phi translation failure.
This is important for PRE of loads because we want to see that the
load is available in all but this predecessor, and complete phi
translation failure results in not getting any information about
predecessors.

This doesn't do anything until I renable code insertion since PRE
now sees that it is available in all but one predecessors, but can't
insert the addressing in the predecessor that is missing it to 
eliminate the redundancy.

llvm-svn: 90037
2009-11-28 14:54:10 +00:00
Chris Lattner
73b425ba51 Rework InsertPHITranslatedPointer to handle the recursive case, this
fixes PR5630 and sets the stage for the next phase of goodness (testcase
pending).

llvm-svn: 90019
2009-11-27 22:05:15 +00:00
Chris Lattner
473e8af336 recursively phi translate bitcast operands too, for consistency.
llvm-svn: 90016
2009-11-27 20:25:30 +00:00
Chris Lattner
b1fceb6006 add support for recursive phi translation and phi
translation of add with immediate.  This allows us
to optimize this function:

void test(int N, double* G) {
  long j;
  G[1] = 1;
    for (j = 1; j < N - 1; j++)
        G[j+1] = G[j] + G[j+1];
}

to only do one load every iteration of the loop.

llvm-svn: 90013
2009-11-27 19:11:31 +00:00
Chris Lattner
bdaed088ea factor some logic out of instcombine into a new SimplifyAddInst method.
llvm-svn: 90011
2009-11-27 17:42:22 +00:00
Chris Lattner
c81be8ddba add comment.
llvm-svn: 90002
2009-11-27 08:40:14 +00:00
Chris Lattner
af321b5729 reduce nesting, no functionality change.
llvm-svn: 90001
2009-11-27 08:37:22 +00:00
Chris Lattner
e7056c8cde limit the recursion depth of GetLinearExpression. This
fixes a crash analyzing consumer-lame, which had an "%X = add %X, 1"
in unreachable code.

llvm-svn: 90000
2009-11-27 08:32:52 +00:00
Chris Lattner
a466dbe80a teach GVN's load PRE to insert computations of the address in predecessors
where it is not available.  It's unclear how to get this inserted 
computation into GVN's scalar availability sets, Owen, help? :)

llvm-svn: 89997
2009-11-27 08:25:10 +00:00
Chris Lattner
0971e6da1f Fix phi translation in load PRE to agree with the phi
translation done by memdep, and reenable gep translation 
again.

llvm-svn: 89992
2009-11-27 06:31:14 +00:00
Chris Lattner
16ee3226ce redisable this, my bootstrap worked because it wasn't an optimized build, whoops.
llvm-svn: 89991
2009-11-27 05:53:01 +00:00
Chris Lattner
ea3b1f2186 try again.
llvm-svn: 89990
2009-11-27 05:19:56 +00:00
Chris Lattner
895214c65e this is causing buildbot failures, disable for now.
llvm-svn: 89985
2009-11-27 01:52:22 +00:00
Chris Lattner
02ffb0a608 teach phi translation of GEPs to simplify geps like 'gep x, 0'.
This allows us to compile the example from PR5313 into:

LBB1_2:                                                     ## %bb
	incl	%ecx
	movb	%al, (%rsi)
	movslq	%ecx, %rax
	movb	(%rdi,%rax), %al
	testb	%al, %al
	jne	LBB1_2

instead of:

LBB1_2:                                                     ## %bb
	movslq	%eax, %rcx
	incl	%eax
	movb	(%rdi,%rcx), %cl
	movb	%cl, (%rsi)
	movslq	%eax, %rcx
	cmpb	$0, (%rdi,%rcx)
	jne	LBB1_2

llvm-svn: 89981
2009-11-27 00:34:38 +00:00
Chris Lattner
6611a6f733 factor some instcombine simplifications for getelementptr out to a new
SimplifyGEPInst method in InstructionSimplify.h.  No functionality change.

llvm-svn: 89980
2009-11-27 00:29:05 +00:00
Chris Lattner
4810fa619f teach memdep to do trivial PHI translation of GEPs. More to
come.

llvm-svn: 89979
2009-11-27 00:07:37 +00:00
Chris Lattner
4824ebfded Teach memdep to phi translate bitcasts. This allows us to compile
the example in GCC PR16799 to:

LBB1_2:                                                     ## %bb1
	movl	%eax, %eax
	subq	%rax, %rdi
	movq	%rdi, (%rcx)
	movl	(%rdi), %eax
	testl	%eax, %eax
	je	LBB1_2

instead of:

LBB1_2:                                                     ## %bb1
	movl	(%rdi), %ecx
	subq	%rcx, %rdi
	movq	%rdi, (%rax)
	cmpl	$0, (%rdi)
	je	LBB1_2

llvm-svn: 89978
2009-11-26 23:41:07 +00:00
Chris Lattner
5020bb83d7 factor some code out into some helper functions.
llvm-svn: 89975
2009-11-26 23:18:49 +00:00
Chris Lattner
ce573daf09 Implement PR1143 (at -m64) by making basicaa look through extensions. We
previously already handled it at -m32 because there were no i32->i64 
extensions for addressing.

llvm-svn: 89959
2009-11-26 18:53:33 +00:00