Commit Graph

2355 Commits

Author SHA1 Message Date
Dan Gohman
a6b35e201f SCEVComplexityCompare's new code was missing SCEVUDivExpr. Implement
the SCEVUDivExpr case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71173 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 19:23:21 +00:00
Duncan Sands
1978426a94 Revert r70876 and add a testcase (@c7) showing the problem:
bits captured, but the pointer marked nocapture.  In fact
I now recall that this problem is why only readnone functions
returning void were considered before!  However keep a small
fix that was also in r70876: a readnone function returning
void can result in bits being captured if it unwinds, so
test for this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71168 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 18:08:34 +00:00
Bill Wendling
5b8479c385 Temporarily revert r71158. It was causing a failure during a full bootstrap:
checking for bcopy... no
checking for getc_unlocked... Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decUtility.c:360: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[4]: *** [decUtility.o] Error 1
make[4]: *** Waiting for unfinished jobs....
Assertion failed: (0 && "Unknown SCEV kind!"), function operator(), file /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/src/lib/Analysis/ScalarEvolution.cpp, line 511.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/libdecnumber/decNumber.c:5591: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[4]: *** [decNumber.o] Error 1
make[3]: *** [all-stage2-libdecnumber] Error 2
make[3]: *** Waiting for unfinished jobs....



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71165 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 17:26:14 +00:00
Dan Gohman
72861308d5 Make ScalarEvolution's GroupByComplexity more thorough. In addition
to sorting SCEVs by their kind, sort SCEVs of the same kind according
to their operands. This helps avoid things like (a+b) being a distinct
expression from (b+a).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71160 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 14:39:04 +00:00
Dan Gohman
6ee2f3d840 Trim unnecessary headers. Code in Analysis shouldn't use Transforms
headers due to library dependencies.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71159 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 14:30:26 +00:00
Dan Gohman
704b6980b8 Constant-fold ptrtoint+add+inttoptr to gep when the pointer is an
array and the add is within range. This helps simplify expressions
expanded by ScalarEvolutionExpander.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71158 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 14:24:56 +00:00
Dan Gohman
ecb403a9d3 Factor out a common base class between SCEVCommutativeExpr and
SCEVAddRecExpr. This eliminates redundant code for visiting
all the operands of an expression.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-07 14:00:19 +00:00
Dan Gohman
0a8eb57c3d Use stable_sort instead of plain sort to avoid the risk of generating
trivially different code on different hosts (due to differing
std::sort implementations).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71124 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06 22:54:33 +00:00
Bill Wendling
16de013640 Add dump method to DIDescriptor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71028 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 22:19:25 +00:00
Chris Lattner
e3f6cea9e9 Do not require variable debug info nodes to have a compile unit.
For implicit decls like "self" and "_cmd" in ObjC, these decls
should not have a location.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05 04:55:56 +00:00
Dan Gohman
35738ac150 Re-apply 70645, converting ScalarEvolution to use
CallbackVH, with fixes. allUsesReplacedWith need to
walk the def-use chains and invalidate all users of a
value that is replaced. SCEVs of users need to be
recalcualted even if the new value is equivalent. Also,
make forgetLoopPHIs walk def-use chains, since any
SCEV that depends on a PHI should be recalculated when
more information about that PHI becomes available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70927 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 22:30:44 +00:00
Dan Gohman
bf2176a000 Fix an 80-column violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70925 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 22:23:18 +00:00
Dan Gohman
92fa56eb58 Fix doxygen comment syntax.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 22:20:30 +00:00
Dan Gohman
622ed671b9 Constify a bunch of SCEV-using code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70919 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 22:02:23 +00:00
Mike Stump
fe095f39e7 Restore minor deletion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04 18:40:41 +00:00
Argyrios Kyrtzidis
77eaa6880b -Move the DwarfWriter::ValidDebugInfo check to a static DIDescriptor::ValidDebugInfo
-Create DebugLocs without the need to have a DwarfWriter around


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70682 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 08:50:41 +00:00
Dan Gohman
f9a77b77c2 Revert r70645 for now; it's causing a variety of regressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70661 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03 05:46:20 +00:00
Dan Gohman
db6fa29641 Convert ScalarEvolution to use CallbackVH for its internal map. This
makes ScalarEvolution::deleteValueFromRecords, and it's code that
subtly needed to be called before ReplaceAllUsesWith, unnecessary.

It also makes ValueDeletionListener unnecessary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70645 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-02 21:19:20 +00:00
Dan Gohman
fb7d35f22a When ScalarEvolution is told to forget the trip count for a loop, have
it also forget any SCEVs associated with loop-header PHIs in the loop,
as they may be dependent on trip count information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70633 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-02 17:43:35 +00:00
Dan Gohman
7e5440404b Change the description string of the LoopInfo pass.
"Construction" makes it sound like a pass that might
modify the CFG to construct natural loops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70580 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-01 21:58:05 +00:00
Dan Gohman
cf5ab82022 Actually insert inserted instructions into the InsertedValues map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70557 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-01 17:13:31 +00:00
Dan Gohman
9032b78c98 When printing a SCEVUnknown with pointer type, don't print an
artificial "ptrtoint", as it tends to clutter up complicated
expressions. The cast operators now print both source and
destination types, which is usually sufficient.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70554 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-01 17:02:22 +00:00
Dan Gohman
80dcdee0f4 Short-circuit inttoptr-ptrtoint constant expressions; these aren't
always folded by the regular constant folder because it doesn't have
TargetData information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70553 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-01 17:00:00 +00:00
Dan Gohman
99243b3830 Fix an 80-column violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70550 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-01 16:44:56 +00:00
Dan Gohman
10b9479f55 When creating cast scevs, canonicalize the destination type. This
avoids duplicate scevs that differ only in type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70549 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-01 16:44:18 +00:00
Torok Edwin
e3d12854b8 hasSCEV() was declared in ScalarEvolution.h, but never defined. This must have
gone lost during the pImpl conversion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70536 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-01 08:33:47 +00:00
Dan Gohman
3d739fe375 Add some comments, and tidy up some whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70510 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 20:48:53 +00:00
Dan Gohman
a1af757e0a Extend ScalarEvolution's getBackedgeTakenCount to be able to
compute an upper-bound value for the trip count, in addition to
the actual trip count. Use this to allow getZeroExtendExpr and
getSignExtendExpr to fold casts in more cases.

This may eventually morph into a more general value-range
analysis capability; there are certainly plenty of places where
more complete value-range information would allow more folding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70509 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 20:47:05 +00:00
Dan Gohman
4acd12a0cb Don't try to mix integers and pointers in an icmp instruction
in getSCEVAtScope.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70495 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 16:40:30 +00:00
Dan Gohman
d9c1c85c2a Fix ScalarEvolution::print to print a value for any Instruction with
a SCEVable type, not just integer types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70463 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30 01:30:18 +00:00
Dan Gohman
eb3948be16 Implement getSCEVAtScope for SCEV cast expressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70422 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 22:29:01 +00:00
Dan Gohman
ac70ceafbc Generalize the cast-of-addrec folding to handle folding of SCEVs like
(sext i8 {-128,+,1} to i64) to i64 {-128,+,1}, where the iteration
crosses from negative to positive, but is still safe if the trip
count is within range.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70421 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 22:28:28 +00:00
Dan Gohman
36b8e53fe0 Include the source type in SCEV cast expression debug output, and
print sext, zext, and trunc, instead of signextend, zeroextend,
and truncate, respectively, for consistency with the main IR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70405 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 20:27:52 +00:00
Dale Johannesen
c9cf35055f Fix recent regression in gcc.dg/pr26719.c (6835035).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70386 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 16:38:47 +00:00
Dan Gohman
f0aa4850ce Update comments to reflect the current code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70357 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29 01:54:20 +00:00
Dan Gohman
01ecca20bf Teach getZeroExtendExpr and getSignExtendExpr to use trip-count
information to simplify [sz]ext({a,+,b}) to {zext(a),+,[zs]ext(b)},
as appropriate.

These functions and the trip count code each call into the other, so
this requires careful handling to avoid infinite recursion. During
the initial trip count computation, conservative SCEVs are used,
which are subsequently discarded once the trip count is actually
known.

Among other benefits, this change lets LSR automatically eliminate
some unnecessary zext-inreg and sext-inreg operation where the
operand is an induction variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70241 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 20:16:15 +00:00
Dan Gohman
d6c329532b Handle ands with ~0 correctly too. This fixes PR4052.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70176 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27 01:41:10 +00:00
Dan Gohman
2c73d5fb9e Handle ands with 0 and shifts by 0 correctly. These aren't
common, but indvars shouldn't crash on them. This fixes PR4054.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70051 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 17:05:40 +00:00
Dan Gohman
752ec7da50 Change SCEVExpander's expandCodeFor to provide more flexibility
with the persistent insertion point, and change IndVars to make
use of it. This fixes a bug where IndVars was holding on to a
stale insertion point and forcing the SCEVExpander to continue to
use it.

This fixes PR4038.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 15:16:49 +00:00
Nick Lewycky
5cd28fad15 Simplify trunc(extend(x)) in SCEVs, just for completeness. Also fix some odd
whitespace in the same file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69870 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23 05:15:08 +00:00
Devang Patel
e2a17468d1 Fix cut-n-pasto.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69816 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 18:51:05 +00:00
Dan Gohman
20900cae35 Simplify trivial cast-of-cast SCEVs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69809 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 16:20:48 +00:00
Dan Gohman
aabb04f527 SCEVExpander's InsertCastOfTo knows how to move existing cast
instructions in order to avoid inserting new ones. However, if
the cast instruction is the SCEVExpander's InsertPt, this
causes subsequently emitted instructions to be inserted near
the cast, and not at the location of the original insert point.
Fix this by adjusting the insert point in such cases.
This fixes PR4009.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69808 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 16:11:16 +00:00
Dan Gohman
6cdc727f2d Use BasicBlock::iterator instead of Instruction* for insert points,
to better handle inserting instructions at the end of a block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69807 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-22 16:05:50 +00:00
Dan Gohman
f8a8be86e3 De-pImpl-ify ScalarEvolution. The pImpl pattern doesn't provide much
practical benefit in the case of ScalarEvolution, and it's otherwise
a nuisance.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69749 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 23:15:49 +00:00
Dan Gohman
578ccf81e5 When turning (ashr(shl(x, n), n)) into sext(trunc(x)), the width of the
type to truncate to should be the number of bits of the value that are
preserved, not the number that are clobbered with sign-extension.
This fixes regressions in ldecod.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69704 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 20:18:36 +00:00
Dan Gohman
4ee29af754 Teach ScalarEvolution how to recognize zext-inreg and sext-inreg,
as they appear in LLVM IR. This isn't particularly interesting
on its own; this is just setting up some infrastructure.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69655 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 02:26:00 +00:00
Dan Gohman
59d0704c8f This FIXME is fixed, now that SCEV understands pointers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69651 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 01:41:18 +00:00
Dan Gohman
84923602fd Factor out a common base class from SCEVTruncateExpr, SCEVZeroExtendExpr,
and SCEVSignExtendExpr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69649 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 01:25:57 +00:00
Dan Gohman
a682430653 Usage getAnalysisToUpdate for TargetData, per PR760.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69645 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 01:11:19 +00:00
Dan Gohman
af79fb5f47 Introduce encapsulation for ScalarEvolution's TargetData object, and refactor
the code to minimize dependencies on TargetData.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69644 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 01:07:12 +00:00
Dan Gohman
fb17fd2cdf Move some assertion checks so they can do more complete checking.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69643 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 00:55:22 +00:00
Dan Gohman
b7ef72963b Convert ScalarEvolution to use raw_ostream instead of OStream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21 00:47:46 +00:00
Dan Gohman
f4ccfcb704 Add a ScalarEvolution::getCouldNotCompute() function, and use it
instead of allocating and leaking new SCEVCouldNotCompute objects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69452 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 17:58:19 +00:00
Dan Gohman
b40c23672b More const qualifiers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69451 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 17:57:20 +00:00
Dan Gohman
890f92b744 Use more const qualifiers with SCEV interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69450 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 17:56:28 +00:00
Dan Gohman
4d177592f2 Handle a pointer type correctly in SCEVExpander::visitAddRecExpr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69310 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 21:34:54 +00:00
Dan Gohman
8170a6849e Fix a bug with inttoptr/ptrtoint casts where the pointer has a different
size from the integer, requiring zero extension or truncation. Don't
create ZExtInsts with pointer types. This fixes a regression in
consumer-jpeg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69307 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 19:25:55 +00:00
Dan Gohman
6524d3ab0e Fix SCEVExpander::visitSMaxExpr and SCEVExpander::visitUMaxExpr to
not create ICmpInsts with operands of different types. This fixes
a regression in Applications/d/make_dparser.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69294 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 16:15:25 +00:00
Dan Gohman
f04fa483b8 Teach SCEVExpander::InsertCastOfTo to avoid creating inttoptr-of-ptrtoint
and ptrtoint-of-inttoptr expressions. This fixes a regression in 300.twolf.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 15:52:57 +00:00
Dan Gohman
2d1be87ee4 Expand GEPs in ScalarEvolution expressions. SCEV expressions can now
have pointer types, though in contrast to C pointer types, SCEV
addition is never implicitly scaled. This not only eliminates the
need for special code like IndVars' EliminatePointerRecurrence
and LSR's own GEP expansion code, it also does a better job because
it lets the normal optimizations handle pointer expressions just
like integer expressions.

Also, since LLVM IR GEPs can't directly index into multi-dimensional
VLAs, moving the GEP analysis out of client code and into the SCEV
framework makes it easier for clients to handle multi-dimensional
VLAs the same way as other arrays.

Some existing regression tests show improved optimization.
test/CodeGen/ARM/2007-03-13-InstrSched.ll in particular improved to
the point where if-conversion started kicking in; I turned it off
for this test to preserve the intent of the test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69258 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 03:18:22 +00:00
Devang Patel
af5b6bb6a5 Add a method to check that the subprogram holds debug info for the given Function or not.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69113 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 00:06:07 +00:00
Chris Lattner
6f532a988e use higher level APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68351 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 00:02:39 +00:00
Devang Patel
6d9a2df4ec getEntryFor() may invalidate DenseMap iterator.
Walking an invalidated iterator is not a good idea.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68047 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 18:34:47 +00:00
Chris Lattner
6a0dcc1077 now that you can put a PointerIntPair in a SmallPtrSet, remove some
hackish workarounds from memdep


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67971 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 00:24:04 +00:00
Devang Patel
575ec806e0 Before deleting a basic block, give other loop passes a chance cleanup analysis values, related to the instructions in the basic block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67719 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-25 23:57:48 +00:00
Devang Patel
25cb0d75d0 Do not ignore DW_TAG_class_type!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67675 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-25 03:52:06 +00:00
Gabor Greif
f73e319751 simplify logic and get rid of the assumption that operand 0 is the callee
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67642 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 19:28:39 +00:00
Dan Gohman
2ba682c7e2 LoopVR is not CFGOnly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67524 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 15:50:52 +00:00
Dan Gohman
a9d71e1319 Enhance LiveValues to work on PHI operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67523 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 15:49:37 +00:00
Dan Gohman
654c98c4f3 The last use in a block that doesn't have successors
(return or unreachable) is a kill.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67357 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 01:28:21 +00:00
Sebastian Redl
48fe63526e Fix the Win32 VS2008 build:
- Make type declarations match the struct/class keyword of the definition.
 - Move AddSignalHandler into the namespace where it belongs.
 - Correctly call functions from template base.
 - Some other small changes.
With this patch, LLVM and Clang should build properly and with far less noise under VS2008.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-19 23:26:52 +00:00
Dale Johannesen
1f67ce4aa3 Clear the cached cost when removing a function in
the inliner; prevents nondeterministic behavior
when the same address is reallocated.
Don't build call graph nodes for debug intrinsic calls;
they're useless, and there were typically a lot of them.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67311 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-19 18:03:56 +00:00
Dan Gohman
3751f564e3 Add a liveness analysis pass for LLVM IR values. This computes
the set of blocks in which values are used, the set in which
values are live-through, and the set in which values are
killed. For the live-through and killed sets, conservative
approximations are used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67309 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-19 17:29:04 +00:00
Bill Wendling
9a507cd915 Revert r66920. It was causing failures in the self-hosting buildbot (in release
mode).

Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/dg.exp ...
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes > /dev/null
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
6   bugpoint          0x00000004 start + 18446744073709543220
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes 

FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
6   bugpoint          0x00000006 start + 18446744073709543222
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes 

FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll  -bugpoint-crashcalls -silence-passes
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll -bugpoint-crashcalls -silence-passes 

--- Reverse-merging (from foreign repository) r66920 into '.':
U    include/llvm/Support/CallSite.h
U    include/llvm/Instructions.h
U    lib/Analysis/IPA/GlobalsModRef.cpp
U    lib/Analysis/IPA/Andersens.cpp
U    lib/Bitcode/Writer/BitcodeWriter.cpp
U    lib/VMCore/Instructions.cpp
U    lib/VMCore/Verifier.cpp
U    lib/VMCore/AsmWriter.cpp
U    lib/Transforms/Utils/LowerInvoke.cpp
U    lib/Transforms/Scalar/SimplifyCFGPass.cpp
U    lib/Transforms/IPO/PruneEH.cpp
U    lib/Transforms/IPO/DeadArgumentElimination.cpp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 21:15:59 +00:00
Gabor Greif
b14cda3c0d Second installment of "BasicBlock operands to the back"
changes.

For InvokeInst now all arguments begin at op_begin().
The Callee, Cont and Fail are now faster to get by
access relative to op_end().

This patch introduces some temporary uglyness in CallSite.
Next I'll bring CallInst up to a similar scheme and then
the uglyness will magically vanish.

This patch also exposes all the reliance of the libraries
on InvokeInst's operand ordering. I am thinking of taking
care of that too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66920 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 18:27:29 +00:00
Bill Wendling
0582ae99ba Oops...I committed too much.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66867 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 04:39:26 +00:00
Bill Wendling
c7a09ab311 Temporarily XFAIL this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66866 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 04:37:11 +00:00
Dale Johannesen
497cb6fd4c Debug intriniscs should be skipped when looking
for a dependency, not terminate the search.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66709 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 21:13:01 +00:00
Torok Edwin
1d9887054a Make Print callable from a pass's print method: add const qualifier. No
functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66700 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 20:50:17 +00:00
Torok Edwin
ff7d0e9509 Global variables don't have a corresponding llvm.dbg.declare, yet it is possible
to obtain debug info about them.
Introduce helpers to access debug info for global variables. Also introduce a
helper that works for both local and global variables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66541 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 13:41:26 +00:00
Owen Anderson
f6cec85a4b Ignore debug intrinsics when computing dependences.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66399 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 05:12:38 +00:00
Chris Lattner
d7168ddb11 reimplement AliasSetTracker in terms of DenseMap instead of hash_map,
hopefully no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66398 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 05:11:09 +00:00
Bill Wendling
ccbdc7ab82 Pass in a std::string when getting the names of debugging things. This cuts down
on the number of times a std::string is created and copied.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 05:04:40 +00:00
Duncan Sands
667d4b8de6 Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr.  These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global.  In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time.   This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function.  If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body.  The
code generators on the other hand map weak and weak_odr linkage
to the same thing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 15:45:40 +00:00
Chris Lattner
d6f16587ab Sprinkle some PrettyStackEntry magic into the passmanager. With this, we now
get nice and happy stack traces when we crash in an optimizer or codegen.  For
example, an abort put in UnswitchLoops now looks like this:

Stack dump:
0.	Program arguments: clang pr3399.c -S -O3 
1.	<eof> parser at end of file
2.	per-module optimization passes
3.	Running pass 'CallGraph Pass Manager' on module 'pr3399.c'.
4.	Running pass 'Loop Pass Manager' on function '@foo'
5.	Running pass 'Unswitch loops' on basic block '%for.inc'
Abort



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66260 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 06:45:05 +00:00
Zhou Sheng
7157228a58 Remove this as dbginfo intrinsics has been defined as
IntrNoMem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 06:05:01 +00:00
Zhou Sheng
9b89f0de12 Ignore the debug info intrinsics when looking for dependency through basic block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66119 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 01:45:43 +00:00
Zhou Sheng
7e4286eb7c Ignore the debug info intrinsics when adding instructions into alias sets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-03 06:02:04 +00:00
Chris Lattner
c287137ce7 Change WriteTypeSymbolic to not put a space out before types, also, remove
the old std::ostream version.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65720 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 21:05:51 +00:00
Devang Patel
d8e880c670 If compile unit's language is not set then don't crash while dump'ing compile unit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65402 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-24 23:15:09 +00:00
Dan Gohman
46bdfb0e6b Rename ScalarEvolution's getIterationCount to getBackedgeTakenCount,
to more accurately describe what it does. Expand its doxygen comment
to describe what the backedge-taken count is and how it differs
from the actual iteration count of the loop. Adjust names and
comments in associated code accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65382 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-24 18:55:53 +00:00
Dan Gohman
0001e56f15 Fix a ValueTracking rule: RHS means operand 1, not 0. Add a simple
ashr instcombine to help expose this code. And apply the fix to
SelectionDAG's copy of this code too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65364 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-24 02:00:40 +00:00
Dan Gohman
f5a309e989 Use a sign-extend instead of a zero-extend when promoting a
trip count value when the original loop iteration condition is
signed and the canonical induction variable won't undergo signed
overflow. This isn't required for correctness; it just preserves
more information about original loop iteration values.

Add a getTruncateOrSignExtend method to ScalarEvolution,
following getTruncateOrZeroExtend.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64918 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 17:22:41 +00:00
Devang Patel
13319ceffd The debugger sometimes lookup dynamically in the runtime to find ivar info of any Objective-C classes. It would be very helpful to debugger if the compiler encodes runtime version number in DWARF.
Add support for two additional DWARF attributes to encode Objective-C runtime version number.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64834 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 22:43:44 +00:00
Devang Patel
36375ee7a5 Emit debug info for bitfields.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64815 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 21:23:59 +00:00
Dan Gohman
60f8a63e25 Add a method to ScalarEvolution for telling it when a loop has been
modified in a way that may effect the trip count calculation. Change
IndVars to use this method when it rewrites pointer or floating-point
induction variables instead of using a doInitialization method to
sneak these changes in before ScalarEvolution has a chance to see
the loop. This eliminates the need for LoopPass to depend on
ScalarEvolution.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64810 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 20:49:49 +00:00
Dan Gohman
189c6357a1 Move dumpPassStructure out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64796 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 19:41:26 +00:00
Evan Cheng
5a6c1a840a Strengthen the "non-constant stride must dominate loop preheader" check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64703 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 00:13:06 +00:00
Duncan Sands
d869b3847f Generalize some alias analysis logic from atomic
intrinsics to any IntrWriteArgMem intrinsics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64551 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-14 10:56:35 +00:00
Duncan Sands
ddd8c450ec If a function only reads memory, then we know that...
it only reads memory!  The other change has no
functional effect, it just seems more logical to
go in order of decreasing knowledge.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64463 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 17:32:26 +00:00
Nick Lewycky
8968a07768 Reapply r64300:
Make sure the SCC pass manager initializes any contained
function pass managers.  Without this, simplify-libcalls
would add nocapture attributes when run on its own, but
not when run as part of -std-compile-opts or similar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64443 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 07:15:53 +00:00
Nick Lewycky
826f7cebfd BasicAA was making the assumption that a local allocation which hadn't escaped
couldn't ever be the return of call instruction. However, it's quite possible
that said local allocation is itself the return of a function call. That's
what malloc and calloc are for, actually.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64442 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 07:06:27 +00:00
Dan Gohman
c2390b14c9 Teach IndVarSimplify to optimize code using the C "int" type for
loop induction on LP64 targets. When the induction variable is
used in addressing, IndVars now is usually able to inserst a
64-bit induction variable and eliminates the sign-extending cast.
This is also useful for code using C "short" types for
induction variables on targets with 32-bit addressing.

Inserting a wider induction variable is easy; the tricky part is
determining when trunc(sext(i)) expressions are no-ops. This
requires range analysis of the loop trip count. A common case is
when the original loop iteration starts at 0 and exits when the
induction variable is signed-less-than a fixed value; this case
is now handled.

This replaces IndVarSimplify's OptimizeCanonicalIVType. It was
doing the same optimization, but it was limited to loops with
constant trip counts, because it was running after the loop
rewrite, and the information about the original induction
variable is lost by that point.

Rename ScalarEvolution's executesAtLeastOnce to
isLoopGuardedByCond, generalize it to be able to test for
ICMP_NE conditions, and move it to be a public function so that
IndVars can use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 22:19:27 +00:00
Bill Wendling
905c7e9a04 Revert r64300 and r64301. These were causing the following errors respectively:
During llvm-gcc bootstrap:

Undefined symbols:
  "llvm::FPPassManager::doFinalization(llvm::Module&)", referenced from:
      (anonymous namespace)::CGPassManager::doFinalization(llvm::CallGraph&, llvm::Module&)
        in libLLVMipa.a(CallGraphSCCPass.o)
  "llvm::FPPassManager::doInitialization(llvm::Module&)", referenced from:
      (anonymous namespace)::CGPassManager::doInitialization(llvm::CallGraph&, llvm::Module&)
        in libLLVMipa.a(CallGraphSCCPass.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[3]: *** [/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore.roots/llvmCore~obj/obj-llvm/Release/bin/opt] Error 1

During an LLVM release build:

/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/Release/bin/tblgen -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86 -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target -gen-register-desc -o  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Target/X86/Release/X86GenRegisterInfo.inc.tmp /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86/X86.td
llvm[3]: Building X86.td instruction names with tblgen
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/Release/bin/tblgen -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86 -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target -gen-instr-enums -o  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Target/X86/Release/X86GenInstrNames.inc.tmp /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86/X86.td
llvm[3]: Building X86.td instruction information with tblgen
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/Release/bin/tblgen -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86 -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target -gen-instr-desc -o  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Target/X86/Release/X86GenInstrInfo.inc.tmp /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86/X86.td
llvm[3]: Building X86.td assembly writer with tblgen
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/Release/bin/tblgen -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86 -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target -gen-asm-writer -o  /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Target/X86/Release/X86GenAsmWriter.inc.tmp /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Target/X86/X86.td
llvm[3]: Compiling InstructionCombining.cpp for Release build 
if /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~dst/Developer/usr/bin/llvm-g++-4.2 -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Transforms/Scalar  -D_DEBUG  -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3  -fno-exceptions  -Woverloaded-virtual -pedantic -Wall -W -Wwrite-strings -Wno-long-long -Wunused -Wno-unused-parameter  -fstrict-aliasing -Wstrict-aliasing -c -MMD -MP -MF "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.d.tmp" -MT "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.lo" -MT "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.o" -MT "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.d" /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/lib/Transforms/Scalar/InstructionCombining.cpp -o /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.o ; \
           then /bin/mv -f "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Transforms/Scalar/Release/InstructionCombining.d.tmp" "/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.sh.build/lib/Trans



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64311 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-11 18:19:24 +00:00
Duncan Sands
af068750a7 Make sure the SCC pass manager initializes any contained
function pass managers.  Without this, simplify-libcalls
would add nocapture attributes when run on its own, but
not when run as part of -std-compile-opts or similar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64300 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-11 09:58:43 +00:00
Owen Anderson
d9289a54cd Fix a crasher: we need to check that the function is non-null before using it!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63902 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 00:13:43 +00:00
Owen Anderson
e79422096e Refactor my previous change to maintain the distinction between AliasAnalysis and BasicAliasAnalysis. This involves some wider changes because it
folds away some never-used methods.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63900 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 23:36:27 +00:00
Owen Anderson
fe9388ccb4 Finish making AliasAnalysis aware of the fact that most atomic intrinsics only dereference their arguments, and enhance
BasicAA to make use of this fact when computing ModRef info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63718 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 05:16:46 +00:00
Owen Anderson
cd89525434 Teach AliasAnalysis that a bunch of the atomic intrinsics only dereference their arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63616 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 06:27:22 +00:00
Dan Gohman
a5f81bba4a Move isIdentifiedObject and isNoAliasCall into AliasAnalysis.cpp since
they are useful to analyses other than BasicAliasAnalysis.cpp. Include
the full comment for isIdentifiedObject in the header file. Thanks to
Chris for suggeseting this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63589 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 01:28:32 +00:00
Devang Patel
dd9db66882 Each input file is encoded as a separate compile unit in LLVM debugging
information output. However, many target specific tool chains prefer to encode
only one compile unit in an object file. In this situation, the LLVM code
generator will include  debugging information entities in the compile unit 
that is marked as main compile unit. The code generator accepts maximum one main
compile unit per module. If a module does not contain any main compile unit 
then the code generator will emit multiple compile units in the output object 
file.

[Part 1]

Update DebugInfo APIs to accept optional boolean value while creating DICompileUnit  to mark the unit as "main" unit. By defaults all units are considered  non-main.  Update SourceLevelDebugging.html to document "main" compile unit.

Update DebugInfo APIs to not accept and encode separate source file/directory entries while creating various llvm.dbg.* entities. There was a recent, yet to be documented, change to include this additional information so no documentation changes are required here.

Update DwarfDebug to handle "main" compile unit. If "main" compile unit is seen then all DIEs are inserted into "main" compile unit. All other compile units are used to find source location for llvm.dbg.* values. If there is not any "main" compile unit then create unique compile unit DIEs for each llvm.dbg.compile_unit.

[Part 2]

Create separate llvm.dbg.compile_unit for each input file. Mark compile unit create for main_input_filename as "main" compile unit. Use appropriate compile unit, based on source location information collected from the tree node, while creating llvm.dbg.* values using DebugInfo APIs.

---

This is Part 1.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63400 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 18:20:31 +00:00
Dan Gohman
3311a1f8f0 Fix a post-RA scheduling dependency bug.
If a MachineInstr doesn't have a memoperand but has an opcode that
is known to load or store, assume its memory reference may alias
*anything*, including stack slots which the compiler completely
controls.

To partially compensate for this, teach the ScheduleDAG building
code to do basic getUnderlyingValue analysis. This greatly
reduces the number of instructions that require restrictive
dependencies. This code will need to be revisited when we start
doing real alias analysis, but it should suffice for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 02:49:14 +00:00
Devang Patel
bf3f5a08ee Add dump() routines to help debug debug info :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63353 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 01:03:10 +00:00
Duncan Sands
e02f724880 Fix PR3415 (infinite loop in EscapeAnalysis) by
deleting the escape analysis pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63197 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 11:33:59 +00:00
Nick Lewycky
237d873439 Start generating arbitrary precision integer SCEVs. This removes the temporary
code that rounded up and capped the size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62958 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-25 08:16:27 +00:00
Devang Patel
3b64c6bc29 Introduce two DWARF attribute extentions DW_AT_APPLE_optimized, DW_AT_APPLE_flags.
DW_AT_APPLE_optimized flag is set when a compile_unit is optimized. The debugger takes advantage of this information some way.

DW_AT_APPLE_flags encodes command line options when certain env. variable is set. This is used by build engineers to track various gcc command lines used by by  a project, irrespective of whether the project used makefile, Xcode or something else.

llvm-gcc patch is next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 22:33:47 +00:00
Chris Lattner
95900f2dda fix two more cases where we could let the NLPDI cache get unsorted.
With this, sqlite3 now passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62839 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 07:12:16 +00:00
Chris Lattner
4433a09b9f Unconditionally reset 'cache' to zero, even if we don't need to resort it.
This avoids using a dangling pointer.

Reset NumSortedEntries after restoring Cache to avoid extraneous sorts.
This fixes the reduced sqlite3 testcase, but apparently not the whole app.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62838 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 06:48:41 +00:00
Chris Lattner
b54bfc2636 a minor tweak to my previous patch, handle the invalidation case
when there are multiple iterations of the loop.  This fixes PR3375.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62822 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 00:27:03 +00:00
Gabor Greif
edc4d69917 introduce a useful abstraction to find out if a Use is in the call position of an instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62788 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-22 21:35:57 +00:00
Chris Lattner
12a7db3830 Fix PR3358, a really nasty bug where recursive phi translated
analyses could be run without the caches properly sorted.  This
can fix all sorts of weirdness.  Many thanks to Bill for coming
up with the 'issorted' verification idea.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62757 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-22 07:04:01 +00:00
Devang Patel
6906ba52f0 Need only one set of debug info versions enum.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-20 19:22:03 +00:00
Chris Lattner
79abedb83a Eliminate use of uint32_t to improve compatibility with cygwin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62590 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-20 18:22:57 +00:00
Devang Patel
b79b5359fb Verify debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62545 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-19 23:21:49 +00:00
Oscar Fuentes
2cb560f6ef CMake: Add lib/Analysis/CaptureTracking.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62462 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-18 13:14:11 +00:00
Duncan Sands
8556d2a7f1 BasicAliasAnalysis and FunctionAttrs were both
doing very similar pointer capture analysis.
Factor out the common logic.  The new version
is from FunctionAttrs since it does a better
job than the version in BasicAliasAnalysis


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62461 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-18 12:19:30 +00:00
Gabor Greif
7f85bb6f83 add a comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62436 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-18 00:27:21 +00:00
Gabor Greif
7f2e381b56 switch over some other methods from indices to iterators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62430 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17 19:46:01 +00:00
Gabor Greif
7b98424f71 speed up iterative loop by using iterators. changes direction, but functionally equivalent
if this works out, I'll change the others next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17 00:14:25 +00:00
Nick Lewycky
d1f5fabd15 Reinstate r60509 from Dale:
Make the debugging dump be a full line.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62325 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 17:07:22 +00:00
Rafael Espindola
bb46f52027 Add the private linkage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62279 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 20:18:42 +00:00
Gabor Greif
6104626b46 minor simplification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62232 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-14 17:09:04 +00:00
Nick Lewycky
789558db70 Wind SCEV back in time, to Nov 18th. This 'fixes' PR3275, PR3294, PR3295,
PR3296 and PR3302.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62160 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-13 09:18:58 +00:00
Devang Patel
486938f7a1 Add classof() methods to support isa<> and other related facilities.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62104 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-12 21:38:43 +00:00
Duncan Sands
ceb4d1aecb Rename getABITypeSize to getTypePaddedSize, as
suggested by Chris.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62099 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-12 20:38:59 +00:00
Chris Lattner
d4a2700fdc make tblgen autogenerate the nocapture intrinsics for
llvm.memcpy/memset/memmove.  This allows removal of some 
hackish code from basicaa.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62071 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-12 02:41:37 +00:00
Misha Brukman
9b8f542e27 Removed trailing whitespace from Makefiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 16:44:42 +00:00
Chris Lattner
0f2831c820 ValueTracker can't assume that an alloca with no specified alignment
will get its preferred alignment.  It has to be careful and cautiously assume
it will just get the ABI alignment.  This prevents instcombine from rounding
up the alignment of a load/store without adjusting the alignment of the alloca.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 19:28:38 +00:00
Duncan Sands
91c9c31033 When checking if an Argument escapes, check if
the argument is marked nocapture - no need to
analyze the argument if the answer is already
known!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61753 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 21:19:53 +00:00
Devang Patel
a22d57d6f8 Add classof() methods so that dwarf writer can decide what DIDescriptor is in its hand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61740 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 19:55:07 +00:00
Devang Patel
68afdc3ab0 Construct array/vector type DIEs using DebugInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61724 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 18:33:01 +00:00
Dan Gohman
d68a07650c Tidy up #includes, deleting a bunch of unnecessary #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61715 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 17:59:02 +00:00
Nick Lewycky
87f333641a We know it's always a SCEVConstant if it gets here, so just cast it and
inline the only use of isNegative. Fixes warning reported by Mike Stump.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61600 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-03 01:53:24 +00:00
Nick Lewycky
ae285bf5a6 Don't try to analyze this "backward" case. This is overly conservative
pending a correct solution.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61589 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 18:54:17 +00:00
Nick Lewycky
3037eda1ef Check that the function prototypes are correct before assuming that the
parameters are pointers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61451 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-27 16:20:53 +00:00
Nick Lewycky
f23d0d392a Resubmit support for the 'nocapture' attribute.
The problematic part of this patch is that we were out of attribute bits,
requiring some fancy bit hacking to make it fit (by shrinking alignment)
without breaking existing users or the file format.

This change will require users to rebuild llvm-gcc to match llvm.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61239 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 06:39:12 +00:00
Evan Cheng
5c9f34b7a0 Remove dead comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61201 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18 09:01:18 +00:00
Devang Patel
854967effe Today the front-ends (llvm-gcc and clang) generate multiple llvm.dbg.compile_units to identify source file for various debug entities. Each llvm.dbg.compile_unit matches one file on the disk. However, the backend only supports one DW_TAG_compile_unit per .o file. The backend selects first compile_unit from the vector to construct DW_TAG_compile_unit entry, which is not correct in all cases.
First step to resolve this is, record file name and directory directly in debug info for various debug entities. 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61164 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17 22:39:29 +00:00
Bill Wendling
6fa311c233 Temporarily revert r61019, r61030, and r61040. These were breaking LLVM Release
builds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61094 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 19:06:48 +00:00
Oscar Fuentes
8069f28a5d CMake: Added DbgInfoPrinter.cpp to lib/Analysis/CMakeFiles.txt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61087 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 12:25:04 +00:00
Torok Edwin
6e68106a47 Add -print-dbginfo pass that prints LLVM IR with comments inserted to show
which source/line a certain BB/instruction comes from, original variable names,
and original (unmangled) C++ name of functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61085 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 09:09:19 +00:00
Torok Edwin
620f28095b Add utility functions to search for DbgStopPointInst corresponding to an
instruction or BasicBlock, and to search for DbgDeclareInst corresponding to a
variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61084 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 09:07:36 +00:00
Torok Edwin
a70c68efc8 use different name for parameter to make it clear that we set DIDescriptor::GV
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61083 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 09:06:01 +00:00
Nick Lewycky
1447f5ca1f Generalize support for analyzing loops to include SLE/SGE loop exit conditions
and support for non-unit strides with signed exit conditions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 08:30:01 +00:00
Chris Lattner
f478951b0e fix PR3217: fully cached queries need to be verified against the
visited set before they are used.  If used, their blocks need to be
added to the visited set so that subsequent queries don't use conflicting
pointer values in the cache result blocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61080 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 07:10:09 +00:00
Chris Lattner
1314f20283 Teach basicaa to use the nocapture attribute when possible. When the
intrinsics are properly marked nocapture, the fixme should be addressed.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61040 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 18:59:22 +00:00
Chris Lattner
3af23f8aba if we have a phi translation failure of the start block,
return *just* a clobber of the start block, not other 
random stuff as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61026 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 04:58:29 +00:00
Chris Lattner
9e59c64c14 Implement initial support for PHI translation in memdep. This means that
memdep keeps track of how PHIs affect the pointer in dep queries, which 
allows it to eliminate the load in cases like rle-phi-translate.ll, which
basically end up being:

BB1:
   X = load P
   br BB3
BB2:
   Y = load Q
   br BB3
BB3:
   R = phi [P] [Q]
   load R

turning "load R" into a phi of X/Y.  In addition to additional exposed
opportunities, this makes memdep safe in many cases that it wasn't before
(which is required for load PRE) and also makes it substantially more 
efficient.  For example, consider:


bb1:  // has many predecessors.
   P = some_operator()
   load P

In this example, previously memdep would scan all the predecessors of BB1
to see if they had something that would mustalias P.  In some cases (e.g.
test/Transforms/GVN/rle-must-alias.ll) it would actually find them and end
up eliminating something.  In many other cases though, it would scan and not
find anything useful.  MemDep now stops at a block if the pointer is defined
in that block and cannot be phi translated to predecessors.  This causes it
to miss the (rare) cases like rle-must-alias.ll, but makes it faster by not
scanning tons of stuff that is unlikely to be useful.  For example, this
speeds up GVN as a whole from 3.928s to 2.448s (60%)!.  IMO, scalar GVN 
should be enhanced to simplify the rle-must-alias pointer base anyway, which
would allow the loads to be eliminated.

In the future, this should be enhanced to phi translate through geps and 
bitcasts as well (as indicated by FIXMEs) making memdep even more powerful.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61022 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 03:35:32 +00:00
Nick Lewycky
67e3566d8f Fix whitespace in comment.
Remove TODO; icmp isn't a binary operator, so this function will never deal
with them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61020 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 01:35:36 +00:00
Torok Edwin
b07fbd9bdd Fix getFieldAs() to use the parameter instead of 6.
Add missing DIType constructor, needed by DIVariable::getType().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60976 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-13 08:25:29 +00:00
Nick Lewycky
8bdc6920cd Revert my re-instated reverted commit, fixes the bootstrap build on x86-64 linux.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60951 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-12 17:09:07 +00:00
Nick Lewycky
277a147f87 Sneaky, sneaky: move the -1 to the outside of the SMax. Reinstate the
optimization of SGE/SLE with unit stride, now that it works properly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60881 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-11 17:40:14 +00:00
Duncan Sands
7050f3d5ec Don't dereference the end() iterator. This was
causing a bunch of failures when running
"make ENABLE_EXPENSIVE_CHECKS=1 check".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60832 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 09:38:36 +00:00
Chris Lattner
b957bda0bc Allow basicaa to walk through geps with identical indices in
parallel, allowing it to decide that P/Q must alias if A/B
must alias in things like:
 P = gep A, 0, i, 1
 Q = gep B, 0, i, 1

This allows GVN to delete 62 more instructions out of 403.gcc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60820 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 01:04:47 +00:00
Chris Lattner
5a45bf1b48 loosen up an assertion that isn't valid when called from
invalidateCachedPointerInfo.  Thanks to Bill for sending me
a testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60805 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 22:45:32 +00:00
Chris Lattner
bc99be10b8 Teach GVN to invalidate some memdep information when it does an RAUW
of a pointer.  This allows is to catch more equivalencies.  For example,
the type_lists_compatible_p function used to require two iterations of
the gvn pass (!) to delete its 18 redundant loads because the first pass
would CSE all the addressing computation cruft, which would unblock the
second memdep/gvn passes from recognizing them.  This change allows
memdep/gvn to catch all 18 when run just once on the function (as is 
typical :) instead of just 3.

On all of 403.gcc, this bumps up the # reundandancies found from:

     63 gvn    - Number of instructions PRE'd
 153991 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted
to:
     63 gvn    - Number of instructions PRE'd
 154137 gvn    - Number of instructions deleted
  50185 gvn    - Number of loads deleted

+120 loads deleted isn't bad.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60799 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 22:06:23 +00:00
Chris Lattner
20d6f0982a Teach BasicAA::getModRefInfo(CallSite, CallSite) some
tricks based on readnone/readonly functions.

Teach memdep to look past readonly calls when analyzing
deps for a readonly call.  This allows elimination of a
few more calls from 403.gcc:

before:
     63 gvn    - Number of instructions PRE'd
 153986 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted

after:
     63 gvn    - Number of instructions PRE'd
 153991 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted

5 calls isn't much, but this adds plumbing for the next change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60794 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 21:19:42 +00:00
Chris Lattner
3579e44bf3 Fix a fixme: allow memdep to see past read-only calls when doing
load dependence queries.  This allows GVN to eliminate a few more
instructions on 403.gcc:

 152598 gvn    - Number of instructions deleted
  49240 gvn    - Number of loads deleted
after:
 153986 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60786 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 19:47:40 +00:00
Chris Lattner
1559b3625b rename getNonLocalDependency -> getNonLocalCallDependency, and remove
pointer stuff from it, simplifying the code a bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60783 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 19:38:05 +00:00
Evan Cheng
a9d50c00f1 Back out 60748 for now. It's breaking SPASS, 254.gap, and 464.h264ref.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60776 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 18:21:49 +00:00
Chris Lattner
9f1e12a2f2 fix typos gabor noticed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60754 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 08:38:36 +00:00
Chris Lattner
6563371bad restructure the top level non-local ptr dep query to handle
the first block of a query specially.  This makes the "complete query
caching" subsystem more effective, avoiding predecessor queries.  This
speeds up GVN another 4%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60752 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:52:59 +00:00
Chris Lattner
9863c3f507 rename getNonLocalPointerDepInternal -> getNonLocalPointerDepFromBB
and split its inner loop out into a new GetNonLocalInfoForBlock
function.  No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60751 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:47:11 +00:00
Nick Lewycky
0bed364307 It's easy to handle SLE/SGE when the loop has a unit stride.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60748 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:25:04 +00:00
Chris Lattner
ba4dacc875 if we have two elements, insert both, don't use std::sort.
This speeds up the new GVN by another 3%


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60747 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:05:45 +00:00
Chris Lattner
1aeadacdad If we're only adding one new element to 'Cache', insert it into its known
position instead of using a full sort. This speeds up GVN by ~4% with the
new memdep stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60746 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 06:58:04 +00:00
Chris Lattner
511b36c00f convert a couple other places that use pred_iterator to use the caching
pred iterator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60745 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 06:44:17 +00:00
Chris Lattner
4012fdda13 use hte new pred cache to speed up the new non-local memdep
queries.  This speeds up GVN using the new queries (not yet
checked in) by just over 10%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60743 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 06:28:49 +00:00
Duncan Sands
1832705b06 Fix comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60697 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 14:01:59 +00:00
Chris Lattner
11dcd8d38d add another level of caching for non-local pointer queries, keeping
track of whether the CachedNonLocalPointerInfo for a block is specific
to a block.  If so, just return it without any pred scanning.  This is
good for a 6% speedup on GVN (when it uses this lookup method, which
it doesn't right now).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 07:31:50 +00:00
Chris Lattner
295d4e953a Some minor optimizations for isObjectSmallerThan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 06:28:54 +00:00
Chris Lattner
3f7eb5b795 add an assert. the cast<> below would catch this but a message is more
useful.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60674 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 18:45:15 +00:00
Chris Lattner
0655f73ef7 factor some code better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60673 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 18:42:51 +00:00
Chris Lattner
d44745d241 factor some code, fixing some fixme's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60672 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 18:39:13 +00:00
Chris Lattner
6290f5cac2 add support for caching pointer dependence queries. Nothing uses this yet
so it "can't" break anything.  That said, it does appear to work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60654 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 08:50:20 +00:00
Chris Lattner
9a193fd8ae Some internal refactoring to make it easier to cache results.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60650 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 02:56:57 +00:00
Chris Lattner
7ebcf03246 Introduce a new MemDep::getNonLocalPointerDependency
method.  This will eventually take over load/store dep
queries from getNonLocalDependency.  For now it works
fine, but is incredibly slow because it does no caching.
Lets not switch GVN to use it until that is fixed :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60649 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 02:15:47 +00:00
Chris Lattner
e79be944c8 push the "pointer case" up the analysis stack a bit. This causes
duplication of logic (in 2 places) to determine what pointer a 
load/store touches.  This will be addressed in a future commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60648 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 01:50:16 +00:00
Chris Lattner
d8dd934d16 make clients have to know how to call getCallSiteDependencyFrom
instead of making getDependencyFrom do it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60647 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 01:21:14 +00:00
Chris Lattner
106c6ca7b0 rename some variables for consistency
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60644 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:39:19 +00:00
Chris Lattner
fbc72e3e61 I love how using out of scope variables is not an error with GCC, no really I do.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60643 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:38:27 +00:00
Chris Lattner
8ef57c5faf Rename getCallSiteDependency -> getCallSiteDependencyFrom to
emphasize the scanning and make it more similar to 
getDependencyFrom
 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60642 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:35:51 +00:00
Chris Lattner
745291a6ce a memdep query on a volatile load/store will always return
clobber with the current implementation.  Instead of returning
a "precise clobber" just return a fuzzy one.  This doesn't 
matter to any clients anyway and should speed up analysis time
very very slightly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60641 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:28:02 +00:00
Chris Lattner
84b9a56d11 remove the ability to get memdep info for vaarg. I don't think the
original impl was correct and noone actually makes the query anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60639 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:21:18 +00:00
Nick Lewycky
4a3136444e Minor cleanup. Use dyn_cast, not isa/cast pairs. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60623 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 17:57:05 +00:00
Chris Lattner
b51deb929c Make a few major changes to memdep and its clients:
1. Merge the 'None' result into 'Normal', making loads
   and stores return their dependencies on allocations as Normal.
2. Split the 'Normal' result into 'Clobber' and 'Def' to
   distinguish between the cases when memdep knows the value is
   produced from when we just know if may be changed.
3. Move some of the logic for determining whether readonly calls
   are CSEs into memdep instead of it being in GVN.  This still
   leaves verification that the arguments are hte same to GVN to
   let it know about value equivalences in different contexts.
4. Change memdep's call/call dependency analysis to use 
   getModRefInfo(CallSite,CallSite) instead of doing something 
   very weak.  This only really matters for things like DSA, but
   someday maybe we'll have some other decent context sensitive
   analyses :)
5. This reimplements the guts of memdep to handle the new results.
6. This simplifies GVN significantly:
   a) readonly call CSE is slightly simpler
   b) I eliminated the "getDependencyFrom" chaining for load 
      elimination and load CSE doesn't have to worry about 
      volatile (they are always clobbers) anymore.
   c) GVN no longer does any 'lastLoad' caching, leaving it to 
      memdep.
7. The logic in DSE is simplified a bit and sped up.  A potentially
   unsafe case was eliminated.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60607 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 21:04:20 +00:00
Chris Lattner
6951381995 Make it illegal to call getDependency* on non-memory instructions
like binary operators.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60600 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 18:46:19 +00:00
Dale Johannesen
1bdd93a3dc Make the debugging dump be a full line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60509 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 22:45:31 +00:00
Nick Lewycky
48dd644109 Add a new SCEV representing signed division.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60407 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 08:05:48 +00:00
Chris Lattner
bf145d6e2b Reimplement the non-local dependency data structure in terms of a sorted
vector instead of a densemap.  This shrinks the memory usage of this thing
substantially (the high water mark) as well as making operations like
scanning it faster.  This speeds up memdep slightly, gvn goes from
3.9376 to 3.9118s on 403.gcc

This also splits out the statistics for the cached non-local case to
differentiate between the dirty and clean cached case.  Here's the stats
for 403.gcc:

  6153 memdep - Number of dirty cached non-local responses
169336 memdep - Number of fully cached non-local responses
162428 memdep - Number of uncached non-local responses

yay for caching :)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 01:15:42 +00:00
Chris Lattner
fd3dcbea06 Eliminate the DepResultTy abstraction. It is now completely
redundant with MemDepResult, and MemDepResult has a nicer interface.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60308 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 23:17:19 +00:00
Chris Lattner
d777d405cd Cache TargetData/AliasAnalysis in the pass instead of calling
getAnalysis<>.  getAnalysis<> is apparently extremely expensive.
Doing this speeds up GVN on 403.gcc by 16%!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60304 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 19:24:31 +00:00
Chris Lattner
4a69bade23 Two changes: Make getDependency remove QueryInst for a dirty record's
ReverseLocalDeps when we update it.  This fixes a regression test
failure from my last commit.

Second, for each non-local cached information structure, keep a bit that
indicates whether it is dirty or not.  This saves us a scan over the whole
thing in the common case when it isn't dirty.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60274 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 02:52:26 +00:00
Chris Lattner
25f4b2b7a3 introduce a typedef, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60272 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 02:30:50 +00:00
Chris Lattner
f68f310386 Change NonLocalDeps to be a densemap of pointers to densemap
instead of containing them by value.  This increases the density
(!) of NonLocalDeps as well as making the reallocation case 
faster.  This speeds up gvn on 403.gcc by 2% and makes room for
future improvements.

I'm not super thrilled with having to explicitly manage the new/delete
of the map, but it is necesary for the next change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60271 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 02:28:25 +00:00
Chris Lattner
cfbb634225 calls never depend on allocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60268 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:44:00 +00:00
Chris Lattner
237a828745 Fix a fixme by making memdep's handling of allocations more logical.
If we see that a load depends on the allocation of its memory with no
intervening stores, we now return a 'None' depedency instead of "Normal".
This tweaks GVN to do its optimization with the new result.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60267 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:39:32 +00:00
Chris Lattner
73ec3cdd71 implement a fixme by introducing a new getDependencyFromInternal
method that returns its result as a DepResultTy instead of as a
MemDepResult.  This reduces conversion back and forth.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60266 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:26:32 +00:00
Chris Lattner
37d041c25f Move the getNonLocalDependency method to a more logical place in
the file, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:18:27 +00:00
Chris Lattner
0e0a5b690c REmove an old fixme, resolve another fixme by adding liberal
comments about what this class does.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60264 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:17:08 +00:00
Chris Lattner
125ce36269 remove a bit of incorrect code that tried to be tricky about speeding up
dependencies.  The basic situation was this: consider if we had:

  store1
  ...
  store2
  ...
  store3

Where memdep thinks that store3 depends on store2 and store2 depends 
on store1.  The problem happens when we delete store2: The code in 
question was updating dep info for store3 to be store1.  This is a
spiffy optimization, but is not safe at all, because aliasing isn't
transitive.  This bug isn't exposed today with DSE because DSE will only
zap store2 if it is identifical to store 3, and in this case, it is 
safe to update it to depend on store1.  However, memcpyopt is not so
fortunate, which is presumably why the "dropInstruction" code used to
exist.

Since this doesn't actually provide a speedup in practice, just rip the
code out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60263 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:09:30 +00:00
Chris Lattner
4f8c18c7c7 Eliminate the dropInstruction method, which is not needed any more.
Fix a subtle iterator invalidation bug I introduced in the last commit.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60258 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 23:30:39 +00:00
Chris Lattner
0ec48ddef2 implement some fixme's: when deleting an instruction with
an entry in the nonlocal deps map, don't reset entries
referencing that instruction to [dirty, null], instead, set
them to [dirty,next] where next is the instruction after the
deleted one.  Use this information in the non-local deps
code to avoid rescanning entire blocks.

This speeds up GVN slightly by avoiding pointless work.  On
403.gcc this makes GVN 1.5% faster. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60256 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 22:02:15 +00:00
Chris Lattner
396a4a55e5 Change MemDep::getNonLocalDependency to return its results as
a smallvector instead of a DenseMap.  This speeds up GVN by 5%
on 403.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60255 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 21:33:22 +00:00
Chris Lattner
729b23758a move MemoryDependenceAnalysis::verifyRemoved to the end of the file,
no functionality/code change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60254 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 21:25:10 +00:00
Chris Lattner
86b29ef64a reimplement getNonLocalDependency with a simpler worklist
formulation that is faster and doesn't require nonLazyHelper.
Much less code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60253 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 21:22:42 +00:00
Chris Lattner
8c4652790e rename some maps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60242 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 09:20:15 +00:00
Chris Lattner
00314b3d84 rename some variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60241 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 09:15:21 +00:00
Chris Lattner
a161ab06d9 eliminate a bunch of code in favor of using AliasAnalysis::getModRefInfo.
Put a some code back to handle buggy behavior that GVN expects: it wants
loads to depend on each other, and accesses to depend on their allocations.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60240 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 09:09:48 +00:00
Chris Lattner
25a081439f simplify some code and rename some variables. Reduce nesting.
Use getTypeStoreSize instead of ABITypeSize for in-memory size
in a couple places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60238 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 08:51:16 +00:00
Chris Lattner
5391a1d804 Split getDependency into getDependency and getDependencyFrom, the
former does caching, the later doesn't.  This dramatically simplifies
the logic in getDependency and getDependencyFrom.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60234 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 03:47:00 +00:00
Chris Lattner
7f52422a3c Now that DepType is private, we can start cleaning up some of its uses:
Document the Dirty value more precisely, use it for the uninitialized
DepResultTy value.  Change reverse mappings to be from an instruction*
instead of DepResultTy, and stop tracking other forms.  This makes it more
clear that we only care about the instruction cases.

Eliminate a DepResultTy,bool pair by using Dirty in the local case as well,
shrinking the map and simplifying the code.

This speeds up GVN by ~3% on 403.gcc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60232 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 03:22:12 +00:00
Chris Lattner
4c72400625 Introduce and use a new MemDepResult class to hold the results of a memdep
query.  This makes it crystal clear what cases can escape from MemDep that
the clients have to handle.  This also gives the clients a nice simplified
interface to it that is easy to poke at.

This patch also makes DepResultTy and MemoryDependenceAnalysis::DepType
private, yay.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60231 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 02:29:27 +00:00
Chris Lattner
39f372e23e Reimplement the internal abstraction used by MemDep in terms
of a pointer/int pair instead of a manually bitmangled pointer.
This forces clients to think a little more about checking the 
appropriate pieces and will be useful for internal 
implementation improvements later.

I'm not particularly happy with this.  After going through this
I don't think that the clients of memdep should be exposed to
the internal type at all.  I'll fix this in a subsequent commit.

This has no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60230 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 01:43:36 +00:00
Chris Lattner
d3d12ecadd Fix PR3141 by ensuring that MemoryDependenceAnalysis::removeInstruction
properly updates the reverse dependency map when it installs updated 
dependencies for instructions that depend on the removed instruction.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60222 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 22:51:08 +00:00
Chris Lattner
baad8881f1 more cleanups for MemoryDependenceAnalysis::removeInstruction,
no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60219 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 22:28:27 +00:00
Chris Lattner
5f589dc77f random cleanups, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60218 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 22:04:47 +00:00
Chris Lattner
0e575f428c Run verifyRemoved from removeInstruction when -debug is specified.
This shows the root problem behind PR3141.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60216 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 21:45:17 +00:00
Chris Lattner
8b589fa135 rename "ping" to "verifyRemoved". I don't know why 'ping' what chosen,
but it doesn't make any sense at all.

Also make the method const, private, and fit in 80 cols while we're at it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60215 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 21:42:09 +00:00
Chris Lattner
57d4012f65 remove mysterious escaped newlines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60211 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 21:16:44 +00:00
Nick Lewycky
b2b32fd3fe Seriously strengthen the guarantee offered by noalias on a function's return
value. It must now be as if the pointer were allocated and has not escaped to
the caller. Thanks to Dan Gohman for pointing out the error in the original
and helping devise this definition.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59940 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 05:00:44 +00:00
Nick Lewycky
02ff308aa1 Extend the 'noalias' attribute to function return values. This is intended to
indicate functions that allocate, such as operator new, or list::insert. The
actual definition is slightly less strict (for now).

No changes to the bitcode reader/writer, asm printer or verifier were needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59934 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 03:41:24 +00:00
Chris Lattner
824b958e6f reapply Sanjiv's patch to genericize memcpy/memset/memmove to take an
arbitrary integer width for the count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59823 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 16:42:48 +00:00
Bill Wendling
dc770929cb Revert r59802. It was breaking the build of llvm-gcc:
g++ -m32 -c -g -DIN_GCC -W -Wall -Wwrite-strings -Wmissing-format-attribute -fno-common -mdynamic-no-pic -DHAVE_CONFIG_H -Wno-unused -DTARGET_NAME=\"i386-apple-darwin9.5.0\" -I. -I. -I../../llvm-gcc.src/gcc -I../../llvm-gcc.src/gcc/. -I../../llvm-gcc.src/gcc/../include -I./../intl -I../../llvm-gcc.src/gcc/../libcpp/include  -I../../llvm-gcc.src/gcc/../libdecnumber -I../libdecnumber -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/include -DENABLE_LLVM -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/../llvm.src/include  -D_DEBUG  -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS   -I. -I. -I../../llvm-gcc.src/gcc -I../../llvm-gcc.src/gcc/. -I../../llvm-gcc.src/gcc/../include -I./../intl -I../../llvm-gcc.src/gcc/../libcpp/include  -I../../llvm-gcc.src/gcc/../libdecnumber -I../libdecnumber -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/include ../../llvm-gcc.src/gcc/llvm-types.cpp -o llvm-types.o
../../llvm-gcc.src/gcc/llvm-convert.cpp: In member function 'void TreeToLLVM::EmitMemCpy(llvm::Value*, llvm::Value*, llvm::Value*, unsigned int)':
../../llvm-gcc.src/gcc/llvm-convert.cpp:1496: error: 'memcpy_i32' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp:1496: error: 'memcpy_i64' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp: In member function 'void TreeToLLVM::EmitMemMove(llvm::Value*, llvm::Value*, llvm::Value*, unsigned int)':
../../llvm-gcc.src/gcc/llvm-convert.cpp:1512: error: 'memmove_i32' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp:1512: error: 'memmove_i64' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp: In member function 'void TreeToLLVM::EmitMemSet(llvm::Value*, llvm::Value*, llvm::Value*, unsigned int)':
../../llvm-gcc.src/gcc/llvm-convert.cpp:1528: error: 'memset_i32' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp:1528: error: 'memset_i64' is not a member of 'llvm::Intrinsic'
make[3]: *** [llvm-convert.o] Error 1
make[3]: *** Waiting for unfinished jobs....
rm fsf-funding.pod gcov.pod gfdl.pod cpp.pod gpl.pod gcc.pod
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59809 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 09:09:41 +00:00
Sanjiv Gupta
219ab405e6 Make mem[cpy,move,set] intrinsics overloaded.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59802 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 07:49:09 +00:00
Nick Lewycky
d433904982 undef beats zero. Fix this missed optimization opportunity. Patch by Matt Elder!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59705 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 04:36:13 +00:00
Nick Lewycky
dd643f26c4 Add a utility function that detects whether a loop is guaranteed to be finite.
Use it to safely handle less-than-or-equals-to exit conditions in loops. These
also occur when the loop exit branch is exit on true because SCEV inverses the
icmp predicate.

Use it again to handle non-zero strides, but only with an unsigned comparison
in the exit condition.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59528 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 15:10:54 +00:00
Duncan Sands
130fea2ca0 Remove unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59515 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 10:39:04 +00:00
Nick Lewycky
d72a81ee64 Don't brute-force analyze cubic or higher polynomials.
If this patch causes a performance regression for anyone, please let me know,
and it can be fixed in a different way with much more effort.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59384 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 04:14:25 +00:00
Devang Patel
89d0a4dd84 Silence unused variable warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59064 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 19:17:41 +00:00
Chris Lattner
497a7a81a8 Move getCastToEmpty out of DIDescriptor into DIFactory. It is an
implementation detail of DIFactory anyway, and this allows it to avoid
recomputing the same type over and over.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58960 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-10 04:10:34 +00:00
Chris Lattner
903361e509 add new file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58955 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-10 02:58:28 +00:00
Chris Lattner
a45664f709 Add a new set of helper classes for creating and reading debug
information.  This logically replaces the "Desc" classes in
MachineModuleInfo.  Nice features of these classes are that they:

1. Are much more efficient than MMI because they don't create a 
   temporary parallel data structure for debug info that has to be
   'serialized' and 'deserialized' into/out of the module.
2. These provide a much cleaner abstraction for debug info than 
   MMI, which will make it easier to change the implementation in 
   the future (to be MDNode-based).
3. These are much easier to use than the MMI interfaces, requiring
   a lot less code in the front-ends.
4. These can be used to both create (for frontends) and read (for
   codegen) debug information.  DebugInfoBuilder can only be used
   to create the nodes.

So far, this is implemented just enough to support the debug info
generation needs of clang.  This can and should be extended to 
support the full set of debug info constructs, and we should switch
llvm-gcc and llc over to using this in the near future.

This code also has a ton of FIXMEs in it, because the way we 
currently represent debug info in LLVM IR is basically insane in a
variety of details.  This sort of issue should be fixed when we
eventually reimplement debug info on top of MDNodes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58954 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-10 02:56:27 +00:00
Nick Lewycky
8f4d5eb9e5 Don't crash analyzing certain quadratics (addrec of {X,+,Y,+,1}).
We're still waiting on code that actually analyzes them properly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58592 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 02:43:49 +00:00
David Greene
c714f13090 Re-apply 55137 with fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58296 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 23:24:03 +00:00
Torok Edwin
c83889ad90 Avoid crashing if instruction is not part of a loop.
If it is not part of a loop it is obviously invariant wrt to all loops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58240 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 10:18:45 +00:00
Nick Lewycky
04aa2c3520 Don't try to create a mask when we don't need one. Fixes a crash.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58075 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 06:14:27 +00:00
Dan Gohman
f522068412 Trim #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57649 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-16 20:18:31 +00:00
Duncan Sands
ddbe5cbb10 Fix "large integer implicitly truncated to unsigned type"
warning on x86-64 with gcc-4.3.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57634 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-16 09:14:58 +00:00