Commit Graph

2374 Commits

Author SHA1 Message Date
Dan Gohman
bc3d77a0df SCEV objects are no longer reference-counted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77080 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 16:18:07 +00:00
Dan Gohman
19378d622e When attempting to sign-extend an addrec by interpreting
the step value as unsigned, the start value and the addrec
itself still need to be treated as signed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77078 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 16:03:30 +00:00
Andreas Bolka
8a8bd3d690 Convert DOUT to DEBUG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77065 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 12:19:58 +00:00
Dan Gohman
eb490a7aa3 Teach ScalarEvolution to make use of no-overflow flags when
analyzing add recurrences.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77034 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 01:22:26 +00:00
Dan Gohman
fef8bb24de Instead of eagerly creating new SCEVs to replace all SCEVs that are
affected after a PHI node has been analyzed, just remove affected
SCEVs from the Scalars map, so that they'll be (lazily) recreated as
needed. This avoids creating SCEV objects that aren't actually needed.

Also, rewrite the associated def-use walking code to be non-recursive
and to continue traversing past Instructions that don't have an
entry in the Scalars map.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77032 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 01:13:03 +00:00
Dan Gohman
fc2a3ed0c9 Make AliasAnalysis and related classes use
getAnalysisIfAvailable<TargetData>().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77028 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 00:48:42 +00:00
Daniel Dunbar
ce63ffb52f More migration to raw_ostream, the water has dried up around the iostream hole.
- Some clients which used DOUT have moved to DEBUG. We are deprecating the
   "magic" DOUT behavior which avoided calling printing functions when the
   statement was disabled. In addition to being unnecessary magic, it had the
   downside of leaving code in -Asserts builds, and of hiding potentially
   unnecessary computations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77019 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 00:23:56 +00:00
Andreas Bolka
0baa25d539 Forward-declare raw_ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77014 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 23:19:28 +00:00
Owen Anderson
eed707b1e6 Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77011 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 23:12:02 +00:00
Daniel Dunbar
3f0e83067d Move to raw_ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76963 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 09:53:24 +00:00
Daniel Dunbar
f6ccee5a9d Switch to getNameStr().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76962 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 08:24:36 +00:00
Dan Gohman
d1e5db6c7c Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 01:03:59 +00:00
Daniel Dunbar
6316fbcb04 Convert StringMap to using StringRef for its APIs.
- Yay for '-'s and simplifications!

 - I kept StringMap::GetOrCreateValue for compatibility purposes, this can
   eventually go away. Likewise the StringMapEntry Create functions still follow
   the old style.

 - NIFC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 18:17:34 +00:00
Andreas Bolka
b4c28e97f4 Cache dependence computation using FoldingSet.
This introduces an LDA-internal DependencePair class. The intention is,
that this is a place where dependence testers can store various results
such as SCEVs describing conflicting iterations, breaking conditions,
distance/direction vectors, etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76877 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 14:32:46 +00:00
Andreas Bolka
3b59dd886a Minor cosmetics: indentation, formatting, naming.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76839 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 01:57:06 +00:00
Devang Patel
6930f4f945 Fix thinko.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76769 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-22 18:56:16 +00:00
Devang Patel
c4999d71e1 Add replaceAllUsesWith() to FE replace debug info constructs while building complex types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76765 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-22 18:23:44 +00:00
Owen Anderson
e922c02019 Get rid of the Pass+Context magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-22 00:24:57 +00:00
Dan Gohman
0f4b285a5b Replace the original ad-hoc code for determining whether (v pred w) implies
(x pred y) with more thorough code that does more complete canonicalization
before resorting to range checks. This helps it find more cases where
the canonicalized expressions match.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76671 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 23:03:19 +00:00
Owen Anderson
b3056faa55 Rename getConstantInt{True|False} to get{True|False} at Chris' behest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76598 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 18:03:38 +00:00
Dan Gohman
a16b5764e3 Make the range calculations for addrecs to be more conservative,
as they aren't currently prepared to handle complicated overflow
cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76524 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 00:42:47 +00:00
Dan Gohman
c2b015e4c0 Whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76523 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 00:38:55 +00:00
Dan Gohman
c268e7c51e Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76521 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 00:37:45 +00:00
Dan Gohman
f117ed462c Add a comment to clarify why there isn't any code in this spot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76505 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20 23:54:43 +00:00
Dan Gohman
4500e9eb80 Remove the code that tried to evaluate whether (A pred B) is known
by determining if (B pred (B-A)) is known, as it doesn't handle
overflow correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76504 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20 23:53:35 +00:00
Dan Gohman
0d5bae41fb Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76496 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20 22:41:51 +00:00
Dan Gohman
746f3b1a9b The upper argument of ConstantRange is exclusive, not inclusive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76492 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20 22:34:18 +00:00
Dan Gohman
13c5e35222 Update this comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76438 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20 17:44:17 +00:00
Dan Gohman
f241174421 Revert the addition of hasNoPointerOverflow to GEPOperator.
Getelementptrs that are defined to wrap are virtually useless to
optimization, and getelementptrs that are undefined on any kind
of overflow are too restrictive -- it's difficult to ensure that
all intermediate addresses are within bounds. I'm going to take
a different approach.

Remove a few optimizations that depended on this flag.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76437 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20 17:43:30 +00:00
Nick Lewycky
3a4a884c16 Replace intersectWith with maximalIntersectWith. The latter guarantees that
all values belonging to the intersection will belong to the resulting range.
The former was inconsistent about that point (either way is fine, just pick
one.) This is part of PR4545.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76289 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-18 06:34:42 +00:00
Dan Gohman
3a7a68c108 Make BasicAliasAnalysis and Value::getUnderlyingObject use
GEPOperator's hasNoPointer0verflow(), and make a few places in instcombine
that create GEPs that may overflow clear the NoOverflow value. Among
other things, this partially addresses PR2831.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76252 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 22:25:10 +00:00
Dan Gohman
ca178908c8 Add a new Operator class, for handling Instructions and ConstantExprs
in a convenient manner, factoring out some common code from
InstructionCombining and ValueTracking. Move the contents of
BinaryOperators.h into Operator.h and use Operator to generalize them
to support ConstantExprs as well as Instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76232 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 20:47:02 +00:00
Eli Friedman
0b79a7727d Replace isTrapping with a new, similar method called
isSafeToSpeculativelyExecute. The new method is a bit closer to what 
the callers actually care about in that it rejects more things callers 
don't want.  It also adds more precise handling for integer 
division, and unifies code for analyzing the legality of a speculative 
load.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76150 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 04:28:42 +00:00
Owen Anderson
001dbfebcb Move the ConstantInt uniquing table into LLVMContextImpl. This exposed a number of issues in
our current context-passing stuff, which is also fixed here


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76089 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 18:04:31 +00:00
Dan Gohman
850f791abc Fill in some holes in ScalarEvolution's loop iteration condition
analysis. This allows indvars to emit a simpler loop trip count
expression.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76085 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 17:34:36 +00:00
Dan Gohman
9377386493 Add an isLoopSimplifyForm() predicate, following the example of
isLCSSAForm(), to test whether a loop is in the form guaranteed
by the LoopSimplify pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 16:16:23 +00:00
Ted Kremenek
1935629829 Lexically order files in CMakeLists.txt files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75831 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-15 21:08:16 +00:00
Dan Gohman
bdc017edac Make makeLoopInvariant report whether it made any changes or not,
and use this to simplify more code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-15 01:25:43 +00:00
Owen Anderson
9adc0abad3 Move EVER MORE stuff over to LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75703 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 23:09:55 +00:00
Dan Gohman
0196dc5733 Fix the expansion of umax and smax in the case where one or more of
the operands have pointer type, so that the resulting type matches
the original SCEV type, and so that unnecessary ptrtoints are
avoided in common cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75680 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 20:57:04 +00:00
Ted Kremenek
2da51dba63 Update CMake file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75666 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 19:46:07 +00:00
Torok Edwin
969f28dfb6 Introduce a pointertracking pass.
For now this only computes the allocated size of the memory pointed to by a
pointer, and offset a pointer from allocated pointer.
The actual checkLimits part will come later, after another round of review.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75657 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 18:44:28 +00:00
Torok Edwin
c23197a26f llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 16:55:14 +00:00
Dan Gohman
69fcae91a4 Make SCEVCallbackVH::allUsesReplacedWith more thorough in removing
users from the Scalars map.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75634 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 14:34:04 +00:00
Dan Gohman
a653fc5f6b Add a comment about why ScalarEvolution doesn't recognize non-loop PHIs
even when they're obvious.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75632 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 14:06:25 +00:00
Daniel Dunbar
858cb8a5e0 ProfileInfo interface tweaks.
- Add getExecutionCount(const Function).

 - Add helper Edge type.

 - constify.

 - No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75623 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 06:58:59 +00:00
Dan Gohman
a342026504 Introduce a new LoopInfo utility function makeLoopInvariant, which
works similar to isLoopInvariant, except that it will do trivial
hoisting to try to make the value loop invariant if it isn't already.
This makes it easier for transformation passes to clear trivial
instructions out of the way (the regular LICM pass doesn't run
until relatively late). This is code factored out of LoopSimplify
and other places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75578 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 01:06:29 +00:00
Dan Gohman
d9ef1a860e Add a newline, now that Value's operator<< doesn't print one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75568 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 00:32:49 +00:00
Owen Anderson
385396221b Move more functionality over to LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75559 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-13 23:50:59 +00:00
Dan Gohman
c902e136d1 Print a newline after printing a Value, now that Value's operator<<
doesn't print a newline.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75543 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-13 23:03:05 +00:00