History log of /external/llvm/lib/Analysis/ScalarEvolution.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
de2d8694e25a814696358e95141f4b1aa4d8847e 20-Sep-2016 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master LLVM for rebase to r275480

Bug: http://b/31320715

This merges commit 7dcf7f03e005379ef2f06db96aa93f06186b66d5 from
aosp/dev.

Test: Build AOSP and run RenderScript tests (host tests for slang and
libbcc, RsTest, CTS)

Change-Id: Iaf3738f74312d875e69f61d604ac058f381a2a1a
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f3ef5332fa3f4d5ec72c178a2b19dac363a19383 04-Mar-2016 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master LLVM for rebase to r256229

http://b/26987366

Change-Id: I1f29c4676a8abe633ab5707dded58d846c973d50
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6948897e478cbd66626159776a8017b3c18579b9 01-Jul-2015 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master LLVM for rebase to r239765

Bug: 20140355: This rebase pulls the upstream fix for the spurious
warnings mentioned in the bug.

Change-Id: I7fd24253c50f4d48d900875dcf43ce3f1721a3da
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0c7f116bb6950ef819323d855415b2f2b0aad987 06-May-2015 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master LLVM for rebase to r235153

Change-Id: I9bf53792f9fc30570e81a8d80d296c681d005ea7
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4c5e43da7792f75567b693105cc53e3f1992ad98 08-Apr-2015 Pirama Arumuga Nainar <pirama@google.com> Update aosp/master llvm for rebase to r233350

Change-Id: I07d935f8793ee8ec6b7da003f6483046594bca49
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ebe69fe11e48d322045d5949c83283927a0d790b 23-Mar-2015 Stephen Hines <srhines@google.com> Update aosp/master LLVM for rebase to r230699.

Change-Id: I2b5be30509658cb8266be782de0ab24f9099f9b9
/external/llvm/lib/Analysis/ScalarEvolution.cpp
37ed9c199ca639565f6ce88105f9e39e898d82d0 01-Dec-2014 Stephen Hines <srhines@google.com> Update aosp/master LLVM for rebase to r222494.

Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c6a4f5e819217e1e12c458aed8e7b122e23a3a58 21-Jul-2014 Stephen Hines <srhines@google.com> Update LLVM for rebase to r212749.

Includes a cherry-pick of:
r212948 - fixes a small issue with atomic calls

Change-Id: Ib97bd980b59f18142a69506400911a6009d9df18
/external/llvm/lib/Analysis/ScalarEvolution.cpp
dce4a407a24b04eebc6a376f8e62b41aaa7b071f 29-May-2014 Stephen Hines <srhines@google.com> Update LLVM for 3.5 rebase (r209712).

Change-Id: I149556c940fb7dc92d075273c87ff584f400941f
/external/llvm/lib/Analysis/ScalarEvolution.cpp
36b56886974eae4f9c5ebc96befd3e7bfe5de338 24-Apr-2014 Stephen Hines <srhines@google.com> Update to LLVM 3.5a.

Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b69143c6a9bfc969e7c95bbd48b83bb962086070 16-Nov-2013 Benjamin Kramer <benny.kra@googlemail.com> Annotate APInt methods where it's not clear whether they are in place with warn_unused_result.

Fix ScalarEvolution bugs uncovered by this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194928 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f44941d81dc30cfd357c12292059721c9644a27f 13-Nov-2013 Sebastian Pop <spop@codeaurora.org> add more comments around the delinearization of arrays

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194612 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5230ad61fd35d3006e7764c3152d28e2e68c288f 12-Nov-2013 Sebastian Pop <spop@codeaurora.org> delinearization of arrays

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194527 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3cda2d38851d73eec38d38a46462aaa65de4ef8e 12-Nov-2013 Wan Xiaofei <xiaofei.wan@intel.com> Change data structure to memorize computed result in ScalarEvolution

Replace std::map with SmallVector to memorize the cached result since SCEV usually belongs to little Loop/BB
Linear scan on SmallVector is faster than std::map.

Code reviewer : Andrew Trick.
Test result : Pass Unit Test & LLVM Test Suite

401.bzip2 0.425721 0.419981 101.37%
403.gcc 24.53855 24.2667 101.12%
429.mcf 0.060847 0.059944 101.51%
433.milc 0.646009 0.636119 101.55%
444.namd 1.383928 1.370614 100.97%
445.gobmk 5.836575 5.800225 100.63%
450.soplex 1.911257 1.895963 100.81%
456.hmmer 1.039565 1.032534 100.68%
458.sjeng 0.897401 0.885567 101.34%
464.h264ref 3.645908 3.577991 101.90%
470.lbm 0.049456 0.048398 102.19%
471.omnetpp 5.638575 5.60435 100.61%
bitmnp01 0.045738 0.045291 100.99%
cjpegv2data 0.304359 0.302833 100.50%
idctrn01 0.046433 0.045763 101.46%
quake2 4.534416 4.4952 100.87%
quake 2.688566 2.659208 101.10%
xcsoar 12.42545 12.30385 100.99%
linpack 0.038739 0.03803 101.86%
matrix01 0.053564 0.0528 101.45%
nbench 0.402867 0.395803 101.78%
tblook01 0.021265 0.021015 101.19%
ttsprk01 0.066384 0.065566 101.25%

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
10bb82e54fc0608e6220581bda0405af8f12d32f 06-Nov-2013 Andrew Trick <atrick@apple.com> Rewrite SCEV's backedge taken count computation.

Patch by Michele Scandale!

Rewrite of the functions used to compute the backedge taken count of a
loop on LT and GT comparisons.

I decided to split the handling of LT and GT cases becasue the trick
"a > b == -a < -b" in some cases prevents the trip count computation
due to the multiplication by -1 on the two operands of the
comparison. This issue comes from the conservative computation of
value range of SCEVs: taking the negative SCEV of an expression that
have a small positive range (e.g. [0,31]), we would have a SCEV with a
fullset as value range.

Indeed, in the new rewritten function I tried to better handle the
maximum backedge taken count computation when MAX/MIN expression are
used to handle the cases where no entry guard is found.

Some test have been modified in order to check the new value correctly
(I manually check them and reasoning on possible overflow the new
values seem correct).

I finally added a new test case related to the multiplication by -1
issue on GT comparisons.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194116 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
19ea37059aaea8104ea6017abc9f1bbed610b7f2 28-Oct-2013 Benjamin Kramer <benny.kra@googlemail.com> SCEV: Make the final add of an inbounds GEP nuw if we know that the index is positive.

We can't do this for the general case as saying a GEP with a negative index
doesn't have unsigned wrap isn't valid for negative indices.
%gep = getelementptr inbounds i32* %p, i64 -1

But an inbounds GEP cannot run past the end of address space. So we check for
the very common case of a positive index and make GEPs derived from that NUW.
Together with Andy's recent non-unit stride work this lets us analyze loops
like

void foo3(int *a, int *b) {
for (; a < b; a++) {}
}

PR12375, PR12376.

Differential Revision: http://llvm-reviews.chandlerc.com/D2033

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
78fe4d62fb12fd3d77cac4d26ec1ab2010aace12 22-Oct-2013 Andrew Trick <atrick@apple.com> Clarify SCEV comments.

We handle for(i=n; i>0; i -= s) by canonicalizing within SCEV to for(i=-n; i<0; i += s).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193147 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
244d24597497c09ab68969c8bbbdf2576130262c 21-Oct-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Use more type helper functions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193109 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4784bb6f447f8078732a45ee23ccab0f93742054 21-Oct-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Fix creating bitcasts between address spaces in SCEV.

The test before wasn't successfully testing this
since it was missing the datalayout piece to change
the size of the second address space.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193102 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
325ee6e115e97a2e0c2a37d69d25269dabbe77df 21-Oct-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Remove unused SCEV functions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193097 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a5c5bc994875d34ec465b86c7539edd19dd95f22 19-Oct-2013 Andrew Trick <atrick@apple.com> SCEV should use NSW to get trip count for positive nonunit stride loops.

SCEV currently fails to compute loop counts for nonunit stride
loops. This comes up frequently. It prevents loop optimization and
forces vectorization to insert extra loop checks.

For example:
void foo(int n, int *x) {
for (int i = 0; i < n; i += 3) {
x[i] = i;
x[i+1] = i+1;
x[i+2] = i+2;
}
}

We need to properly handle the case in which limit > INT_MAX-stride. In
the above case: n > INT_MAX-3. In this case the loop counter will step
beyond the limit and overflow at the same time. However, knowing that
signed integer overlow in undefined, we can assume the loop test
behavior is arbitrary after overflow. This obeys both C undefined
behavior rules, and the more strict LLVM poison value rules.

I'm finally fixing this in response to Hal Finkel's persistence.
The most probable reason that we never optimized this before is that
we were being careful to handle case where the developer expected a
side-effect free infinite loop relying on overflow:

for (int i = 0; i < n; i += s) {
++j;
}
return j;

If INT_MAX+1 is a multiple of s and n > INT_MAX-s, then we might
expect an infinite loop. However there are plenty of ways to achieve
this effect without relying on undefined behavior of signed overflow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193015 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9ed1a3cddbdc66e8228dd58159c4418f1e561014 28-Sep-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Minor code simplification

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191579 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
14807bd8c801f976c999e5a6699f31ee9642021a 10-Sep-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Teach ScalarEvolution about pointer address spaces

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190425 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d832d32f57bc6d2bebf60e0befebc955d84aae12 31-Jul-2013 Andrew Trick <atrick@apple.com> Fix a severe compile time problem when forming large SCEV expressions.

This fix is very lightweight. The same fix already existed for AddRec
but was missing for NAry expressions.

This is obviously an improvement and I'm unsure how to test compile
time problems.

Patch by Xiaoyi Guo!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a10369920fa86d8961495b71dbc00f5596d122d9 12-Jul-2013 Shuxin Yang <shuxin.llvm@gmail.com> Stylistic change.

Thank Nick for figuring out these problems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186146 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9e639e8fd95488cb4c8ef2f7f3a41919acb29ac4 11-Jul-2013 Craig Topper <craig.topper@gmail.com> Use SmallVectorImpl& instead of SmallVector to avoid repeating small vector size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0a230e0d985625a3909cb78fd867a3abaf434565 11-Jul-2013 Benjamin Kramer <benny.kra@googlemail.com> Don't use a potentially expensive shift if all we want is one set bit.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186095 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
033e0a94cbb3df8e0f48cebe0ac5b4a024c85b2d 09-Jul-2013 Hal Finkel <hfinkel@anl.gov> Don't crash in SE dealing with ashr x, -1

ScalarEvolution::getSignedRange uses ComputeNumSignBits from ValueTracking on
ashr instructions. ComputeNumSignBits can return zero, but this case was not
handled correctly by the code in getSignedRange which was calling:
APInt::getSignedMinValue(BitWidth).ashr(NS - 1)
with NS = 0, resulting in an assertion failure in APInt::ashr.

Now, we just return the conservative result (as with NS == 1).

Another bug found by llvm-stress.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185955 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5e915e6e364532ed00b4c5508e59b42f608b5244 08-Jul-2013 Shuxin Yang <shuxin.llvm@gmail.com> Fix a SCEV update problem.

The symptom is seg-fault, and the root cause is that a SCEV contains a SCEVUnknown
which has null-pointer to a llvm::Value.

This is how the problem take place:
===================================
1). In the pristine input IR, there are two relevant instrutions Op1 and Op2,
Op1's corresponding SCEV (denoted as SCEV(op1)) is a SCEVUnknown, and
SCEV(Op2) contains SCEV(Op1). None of these instructions are dead.

Op1 : V1 = ...
...
Op2 : V2 = ... // directly or indirectly (data-flow) depends on Op1

2) Optimizer (LSR in my case) generates an instruction holding the equivalent
value of Op1, making Op1 dead.
Op1': V1' = ...
Op1: V1 = ... ; now dead)
Op2 : V2 = ... //Now deps on Op1', but the SCEV(Op2) still contains SCEV(Op1)

3) Op1 is deleted, and call-back function is called to reset
SCEV(Op1) to indicate it is invalid. However, SCEV(Op2) is not
invalidated as well.

4) Following pass get the cached, invalid SCEV(Op2), and try to manipulate it,
and cause segfault.

The fix:
========
It seems there is no clean yet inexpensive fix. I write to dev-list
soliciting good solution, unforunately no ack. So, I decide to fix this
problem in a brute-force way:

When ScalarEvolution::getSCEV is called, check if the cached SCEV
contains a invalid SCEVUnknow, if yes, remove the cached SCEV, and
re-evaluate the SCEV from scratch.

I compile buch of big *.c and *.cpp, fortunately, I don't see any increase
in compile time.

Misc:
=====
The reduced test-case has 2357 lines of code+other-stuff, too big to commit.

rdar://14283433


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185843 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
365ef0b197d7c841f8e501da64296df65be4ca23 03-Jul-2013 Craig Topper <craig.topper@gmail.com> Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185540 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f56a6ded63c93f75c7016d0e42d5356cdba7198c 04-Jun-2013 Aaron Ballman <aaron@aaronballman.com> Silencing an MSVC warning about */ being found outside of a comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183175 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
cd8e3c4dcf4383b8b1c16827c6326f6e9bc49d51 01-Jun-2013 Andrew Trick <atrick@apple.com> Prevent loop-unroll from making assumptions about undefined behavior.

Fixes rdar:14036816, PR16130.

There is an opportunity to compute precise trip counts for 'or'
expressions and multi-exit loops.
rdar:14038809: Optimize trip count computation for multi-exit loops.

To do this we need to record the fact that ExitLimit assumes NSW. When
it does not we can safely assume that the loop trip count is the
minimum ExitLimt across all subexpressions and loop exits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183060 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
616011418e7460f765469f6347417fa25b5b740b 31-May-2013 Andrew Trick <atrick@apple.com> Fix ScalarEvolution::ComputeExitLimitFromCond for 'or' conditions.

Fixes PR16130 - clang produces incorrect code with loop/expression at -O2.

This is a 2+ year old bug that's now holding up the release. It's a
case where we knowingly made aggressive assumptions about undefined
behavior. These assumptions are wrong when SCEV is computing a
subexpression that does not directly control the branch. With this
fix, we avoid making assumptions in those cases but still optimize the
common case. SCEV's trip count computation for exits controlled by
'or' expressions is now analagous to the trip count computation for
loops with multiple exits. I had already fixed the multiple exit case
to be conservative.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182989 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e74c2e86cb405963ba9c4043a1d0ca00b8f85fbe 26-Mar-2013 Andrew Trick <atrick@apple.com> Fix SCEV forgetMemoizedResults should search and destroy backedge exprs.

Fixes PR15570: SEGV: SCEV back-edge info invalid after dead code removal.

Indvars creates a SCEV expression for the loop's back edge taken
count, then determines that the comparison is always true and
removes it.

When loop-unroll asks for the expression, it contains a NULL
SCEVUnknkown (as a CallbackVH).

forgetMemoizedResults should invalidate the loop back edges expression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177986 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0b8c9a80f20772c3793201ab5b251d3520b9cea3 02-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Move all of the header files which are involved in modelling the LLVM IR
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.

There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.

The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.

I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).

I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d04a8d4b33ff316ca4cf961e06c9e312eff8e64f 03-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Use the new script to sort the includes of every file under lib.

Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7d4253af167479759fa5a71b7607b40033b96492 29-Nov-2012 Benjamin Kramer <benny.kra@googlemail.com> Follow up to 168711: It's safe to base this analysis on the found compare, just return the value for the right predicate.

Thanks to Andy for catching this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168921 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ffc9ee4bbfbde7adbfe76ae768c4545be541cded 29-Nov-2012 Andrew Trick <atrick@apple.com> Improve isImpliedCond comment a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168914 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b2a818f83bebb5d77bf07dec50102a8d84e8b010 27-Nov-2012 Benjamin Kramer <benny.kra@googlemail.com> SCEV: Even if the latch terminator is foldable we can't deduce the result of an unrelated condition with it.

Fixes PR14432.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168711 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ece6c6bb6329748b92403c06ac87f45c43485911 01-Nov-2012 Chandler Carruth <chandlerc@gmail.com> Revert the series of commits starting with r166578 which introduced the
getIntPtrType support for multiple address spaces via a pointer type,
and also introduced a crasher bug in the constant folder reported in
PR14233.

These commits also contained several problems that should really be
addressed before they are re-committed. I have avoided reverting various
cleanups to the DataLayout APIs that are reasonable to have moving
forward in order to reduce the amount of churn, and minimize the number
of commits that were reverted. I've also manually updated merge
conflicts and manually arranged for the getIntPtrType function to stay
in DataLayout and to be defined in a plausible way after this revert.

Thanks to Duncan for working through this exact strategy with me, and
Nick Lewycky for tracking down the really annoying crasher this
triggered. (Test case to follow in its own commit.)

After discussing with Duncan extensively, and based on a note from
Micah, I'm going to continue to back out some more of the more
problematic patches in this series in order to ensure we go into the
LLVM 3.2 branch with a reasonable story here. I'll send a note to
llvmdev explaining what's going on and why.

Summary of reverted revisions:

r166634: Fix a compiler warning with an unused variable.
r166607: Add some cleanup to the DataLayout changes requested by
Chandler.
r166596: Revert "Back out r166591, not sure why this made it through
since I cancelled the command. Bleh, sorry about this!
r166591: Delete a directory that wasn't supposed to be checked in yet.
r166578: Add in support for getIntPtrType to get the pointer type based
on the address space.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167221 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
974d98d730599dacee11e27ff4eee23534109287 27-Oct-2012 Benjamin Kramer <benny.kra@googlemail.com> SCEV validator: Ignore CouldNotCompute/undef on both sides. This is mostly noise and blocks finding more severe bugs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166873 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
cb8b8ea2b676e110e14c734877a2b58ed931f56a 27-Oct-2012 Benjamin Kramer <benny.kra@googlemail.com> SCEV validator: Add workarounds for some common false positives due to the way it handles strings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ff18310274e872429cd06d679b1c8c8a14166328 26-Oct-2012 Benjamin Kramer <benny.kra@googlemail.com> Add a basic verifier for SCEV's backedge taken counts.

Enabled with -verify-scev. This could be extended significantly but hopefully
catches the common cases now. Note that it's not enabled by default in any
configuration because the way it tries to distinguish SCEVs is still fragile and
may produce false positives. Also the test-suite isn't clean yet, one example
is that it fails if a pass drops an NSW bit but it's still present in SCEV's
cached. Cleaning up all those cases will take some time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166786 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8c65549318950ff3fc1cb3d7a73fb50c688c78a5 24-Oct-2012 Hal Finkel <hfinkel@anl.gov> getSmallConstantTripMultiple should never return zero.

When the trip count is -1, getSmallConstantTripMultiple could return zero,
and this would cause runtime loop unrolling to assert. Instead of returning
zero, one is now returned (consistent with the existing overflow cases).
Fixes PR14167.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166612 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
aa76e9e2cf50af190de90bc778b7f7e42ef9ceff 24-Oct-2012 Micah Villmow <villmow@gmail.com> Add in support for getIntPtrType to get the pointer type based on the address space.
This checkin also adds in some tests that utilize these paths and updates some of the
clients.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3574eca1b02600bac4e625297f4ecf745f4c4f32 08-Oct-2012 Micah Villmow <villmow@gmail.com> Move TargetData to DataLayout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165402 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
94c22716d60ff5edf6a98a3c67e0faa001be1142 27-Sep-2012 Sylvestre Ledru <sylvestre@debian.org> Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164767

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164768 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7e2c793a2b5c746344652b6579e958ee42fafdcc 27-Sep-2012 Sylvestre Ledru <sylvestre@debian.org> Fix a typo 'iff' => 'if'

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164767 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
286c4dc355b8be6806081b23c3097485821c7642 12-Sep-2012 Manman Ren <mren@apple.com> Release build: guard dump functions with
"#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)"

No functional change. Update r163344.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
cc77eece74c8db09acc2af425e7e6c88a5bb30d1 06-Sep-2012 Manman Ren <mren@apple.com> Release build: guard dump functions with "ifndef NDEBUG"

No functional change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6ce2471806316ae9e1c7715f703c380d4f4311b6 01-Aug-2012 Nick Lewycky <nicholas@mxc.ca> Stay rational; don't assert trying to take the square root of a negative value.
If it's negative, the loop is already proven to be infinite. Fixes PR13489!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161107 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8b7036b0f4ae3f76ad24a6b9bc2d874620406306 14-Jul-2012 Andrew Trick <atrick@apple.com> Factor SCEV traversal code so I can use it elsewhere. No functionality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160203 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
655b5a48b956d91e8656d8d2ef062dd9c2bf8591 10-Jul-2012 Dan Gohman <gohman@apple.com> Delete code for folding undefs in ScalarEvolution. It's invalid in
obscure ways, and it isn't actually important in the real world.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159969 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
992c25a3fcc235f07364b082d53eba9b91f395a5 01-Jul-2012 Benjamin Kramer <benny.kra@googlemail.com> Reduce use list thrashing by using DenseMap's find_as for maps with ValueHandle keys.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159497 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4d3bba5be47ec159ad3489793248acc812d75575 29-Jun-2012 Nick Lewycky <nicholas@mxc.ca> If the step value is a constant zero, the loop isn't going to terminate. Fixes
the assert reported in PR13228!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159393 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d9b0b025612992a0b724eeca8bdf10b1d7a5c355 02-Jun-2012 Benjamin Kramer <benny.kra@googlemail.com> Fix typos found by http://github.com/lyda/misspell-check

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
127563b216eadf756e03f0adf2c3900bf244b504 30-May-2012 Benjamin Kramer <benny.kra@googlemail.com> Make sure that we're dealing with a binary SCEVExpr when simplifying.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157704 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6cf07a80ff5ee8ef7dc336f954aae17c7e8d83d4 30-May-2012 Benjamin Kramer <benny.kra@googlemail.com> Teach SCEV's icmp simplification logic that a-b == 0 is equivalent to a == b.

This also required making recursive simplifications until
nothing changes or a hard limit (currently 3) is hit.

With the simplification in place indvars can canonicalize
loops of the form
for (unsigned i = 0; i < a-b; ++i)
into
for (unsigned i = 0; i != a-b; ++i)
which used to fail because SCEV created a weird umax expr
for the backedge taken count.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157701 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
fe3516f9a5f238ecf6872b5315706c7c7942a496 30-May-2012 Andrew Trick <atrick@apple.com> SCEV: Handle a corner case reducing AddRecExpr * AddRecExpr

If integer overflow causes one of the terms to reach zero, that can
force the entire expression to zero.

Fixes PR12929: cast<Ty>() argument of incompatible type

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
97178aedb5f337ad9a6ac86fa052e777c7ad50d0 30-May-2012 Andrew Trick <atrick@apple.com> Reformat the loop that does AddRecExpr * AddRecExpr reduction.

No functionality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157672 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8aa22019ca5ef29a15058be905d782e7225aa206 19-May-2012 Andrew Trick <atrick@apple.com> SCEV: Add MarkPendingLoopPredicates to avoid recursive isImpliedCond.

getUDivExpr attempts to simplify by checking for overflow.
isLoopEntryGuardedByCond then evaluates the loop predicate which
may lead to the same getUDivExpr causing endless recursion.

Fixes PR12868: clang 3.2 segmentation fault.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157092 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ac94bd88d8bcd15305500dc06bc65bcecf2aafeb 15-May-2012 Nuno Lopes <nunoplopes@sapo.pt> reuse the result of some expensive computations in getSignExtendExpr() and getZeroExtendExpr()
this gives a speedup of > 80 in a debug build in the test case of PR12825 (php_sha512_crypt_r)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156849 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
39de32f4971a01f0812375cbd117ced13652e31f 15-May-2012 Nuno Lopes <nunoplopes@sapo.pt> minor simplification to code: Ty is already a SCEV type; don't need to run getEffectiveSCEVType() twice

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156823 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ac84461e5ab64bf534a8cf11fa833b5f3569c101 10-May-2012 Dan Gohman <gohman@apple.com> Rewrite ScalarEvolution::hasOperand to use an explicit worklist instead
of recursion, to avoid excessive stack usage on deep expressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156554 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
86df062791d50b35ae274bbeb8fe2f37944e284a 17-Apr-2012 Benjamin Kramer <benny.kra@googlemail.com> Revert "SCEV: When expanding a GEP the final addition to the base pointer has NUW but not NSW."

This isn't right either, reverting for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154910 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c77764591b06655bca4313ccfb5b1b773849387e 07-Apr-2012 Benjamin Kramer <benny.kra@googlemail.com> SCEV: When expanding a GEP the final addition to the base pointer has NUW but not NSW.

Found by inspection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154262 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
26c8dcc692fb2addd475446cfff24d6a4e958bca 04-Apr-2012 Rafael Espindola <rafael.espindola@gmail.com> Always compute all the bits in ComputeMaskedBits.
This allows us to keep passing reduced masks to SimplifyDemandedBits, but
know about all the bits if SimplifyDemandedBits fails. This allows instcombine
to simplify cases like the one in the included testcase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154011 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
eb6dd23c95c1df08a4a924e2125158c5203b0991 27-Mar-2012 Andrew Trick <atrick@apple.com> SCEV fix: Handle loop invariant loads.

Fixes PR11882: NULL dereference in ComputeLoadConstantCompareExitLimit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153480 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
dada586f1677bbc58e07cd186a8b7f8c67ea3025 24-Jan-2012 Chris Lattner <sabre@nondot.org> switch SCEV to use the new ConstantFoldLoadThroughGEPIndices function
instead of its own hard coded thing, allowing it to handle
ConstantDataSequential and fixing some obscure bugs (e.g. it would
previously crash on a CAZ of vector type).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148788 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4d6ccb5f68cd7c6418a209f1fa4dbade569e4493 20-Jan-2012 David Blaikie <dblaikie@gmail.com> More dead code removal (using -Wunreachable-code)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
07df1b4d1a299d18159aa9396bb02892fed773ac 20-Jan-2012 Benjamin Kramer <benny.kra@googlemail.com> Remove obviously invalid early exit that prevented analyzing ConstantAggregateZeros.

Found by the clang static analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148540 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3eada319fc21bca31a2bc7819e4c05f46e6f82e1 11-Jan-2012 Andrew Trick <atrick@apple.com> Clarified the SCEV getSmallConstantTripCount interface with in-your-face comments.

This interface is misleading and dangerous, but it is actually what we need for unrolling.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147926 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f8fd841a4bb7a59f81cf4642169e8251e039acfe 07-Jan-2012 Andrew Trick <atrick@apple.com> Expose isNonConstantNegative to users of ScalarEvolution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147700 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
aab8e28d5e470711d80276bbf717408c3ab966fd 02-Dec-2011 Chad Rosier <mcrosier@apple.com> Fix a few more places where TargetData/TargetLibraryInfo is not being passed.
Add FIXMEs to places that are non-trivial to fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145661 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
00737bdb488cc7157ca5f7a40d6cd8467ad09a79 01-Dec-2011 Chad Rosier <mcrosier@apple.com> Last bit of TargetLibraryInfo propagation. Also fixed a case for TargetData
where it appeared beneficial to pass.
More of rdar://10500969

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145630 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
618c1dbd293d15ee19f61b1156ab8086ad28311a 01-Dec-2011 Chad Rosier <mcrosier@apple.com> Propagate TargetLibraryInfo throughout ConstantFolding.cpp and
InstructionSimplify.cpp. Other fixups as needed.
Part of rdar://10500969

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ecb35ece5c42d89057da3c2c7bc2e95f08b1dbef 29-Nov-2011 Andrew Trick <atrick@apple.com> SCEV fix. In general, Add/Mul expressions should not inherit NSW/NUW.

This reverts r139450, fixes r139453, and adds much needed comments and a
unit test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
121d78f7e7d71dc56699f249f5103562d9ce179e 29-Nov-2011 Andrew Trick <atrick@apple.com> Make SCEV print <nsw><nuw> for Add/MulExpr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
13c3c7517620a6fbff2c355b582755b73f41b87e 20-Nov-2011 Benjamin Kramer <benny.kra@googlemail.com> SCEV: Actually set overflow flags on add expressions.

setFlags doesn't modify its arguments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145007 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
79f0bfcc20135844d260a20c359222cd90481f78 16-Nov-2011 Andrew Trick <atrick@apple.com> Fix SCEV overly optimistic back edge taken count for multi-exit loops.

Fixes PR11375: Different results for 'clang++ huh.cpp'...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144746 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d7ecff49d9190262da48a9f5815c01138fd54ebc 12-Nov-2011 Nick Lewycky <nicholas@mxc.ca> Don't try to loop on iterators that are potentially invalidated inside the loop. Fixes PR11361!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144454 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
89d093d5b69d21b5a4f81b969597bd76b6327cb5 09-Nov-2011 Nick Lewycky <nicholas@mxc.ca> Don't forget to check FlagNW when determining whether an AddRecExpr will wrap
or not. Patch by Brendon Cahoon!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144173 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f8a9eb1fa6b676468d0231d1a0ee5247b664dabb 25-Oct-2011 Duncan Sands <baldrick@free.fr> Restore commits 142790 and 142843 - they weren't breaking the build
bots. Original commit messages:
- Reapply r142781 with fix. Original message:

Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the
loop header when computing the trip count.

With this, we now constant evaluate:
struct ListNode { const struct ListNode *next; int i; };
static const struct ListNode node1 = {0, 1};
static const struct ListNode node2 = {&node1, 2};
static const struct ListNode node3 = {&node2, 3};
int test() {
int sum = 0;
for (const struct ListNode *n = &node3; n != 0; n = n->next)
sum += n->i;
return sum;
}

- Now that we look at all the header PHIs, we need to consider all the header PHIs
when deciding that the loop has stopped evolving. Fixes miscompile in the gcc
torture testsuite!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142919 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
526c80bae4d9902fea9efd787c2f212bf111e85e 25-Oct-2011 Duncan Sands <baldrick@free.fr> Speculatively revert commits 142790 and 142843 to see if it fixes
the dragonegg and llvm-gcc self-host buildbots. Original commit
messages:
- Reapply r142781 with fix. Original message:

Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the
loop header when computing the trip count.

With this, we now constant evaluate:
struct ListNode { const struct ListNode *next; int i; };
static const struct ListNode node1 = {0, 1};
static const struct ListNode node2 = {&node1, 2};
static const struct ListNode node3 = {&node2, 3};
int test() {
int sum = 0;
for (const struct ListNode *n = &node3; n != 0; n = n->next)
sum += n->i;
return sum;
}

- Now that we look at all the header PHIs, we need to consider all the header PHIs
when deciding that the loop has stopped evolving. Fixes miscompile in the gcc
torture testsuite!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142916 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3846163aee1b14545057c8664f80a18c55309462 24-Oct-2011 Nick Lewycky <nicholas@mxc.ca> Now that we look at all the header PHIs, we need to consider all the header PHIs
when deciding that the loop has stopped evolving. Fixes miscompile in the gcc
torture testsuite!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142843 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7c3fc5747284a0c6ca4e370f964082c69b42b8dd 24-Oct-2011 Nick Lewycky <nicholas@mxc.ca> Reapply r142781 with fix. Original message:

Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the
loop header when computing the trip count.

With this, we now constant evaluate:
struct ListNode { const struct ListNode *next; int i; };
static const struct ListNode node1 = {0, 1};
static const struct ListNode node2 = {&node1, 2};
static const struct ListNode node3 = {&node2, 3};
int test() {
int sum = 0;
for (const struct ListNode *n = &node3; n != 0; n = n->next)
sum += n->i;
return sum;
}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142790 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5bef0eb1de5f52662de7b4808bee5e9d643b04db 24-Oct-2011 Nick Lewycky <nicholas@mxc.ca> PHI nodes not in the loop header aren't part of the loop iteration initial
state. Furthermore, they might not have two operands. This fixes the underlying
issue behind the crashes introduced in r142781.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142788 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
38af3d5a8dbcada6f264d3a268f525a827adaca2 24-Oct-2011 Nick Lewycky <nicholas@mxc.ca> Speculatively revert r142781. Bots are showing
Assertion `i_nocapture < OperandTraits<PHINode>::operands(this) && "getOperand() out of range!"' failed.
coming out of indvars.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142786 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
795cb48f1a1f01ce55b32d3d3caca728a4122d7d 24-Oct-2011 Nick Lewycky <nicholas@mxc.ca> Enhance SCEV's brute force loop analysis to handle multiple PHI nodes in the
loop header when computing the trip count.

With this, we now constant evaluate:
struct ListNode { const struct ListNode *next; int i; };
static const struct ListNode node1 = {0, 1};
static const struct ListNode node2 = {&node1, 2};
static const struct ListNode node3 = {&node2, 3};
int test() {
int sum = 0;
for (const struct ListNode *n = &node3; n != 0; n = n->next)
sum += n->i;
return sum;
}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
614fef6d5a1e24d01ffe7247b1841fd7e08e1e85 22-Oct-2011 Nick Lewycky <nicholas@mxc.ca> Make SCEV's brute force analysis stronger in two ways. Firstly, we should be
able to constant fold load instructions where the argument is a constant.
Second, we should be able to watch multiple PHI nodes through the loop; this
patch only supports PHIs in loop headers, more can be done here.

With this patch, we now constant evaluate:
static const int arr[] = {1, 2, 3, 4, 5};
int test() {
int sum = 0;
for (int i = 0; i < 5; ++i) sum += arr[i];
return sum;
}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142731 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4c7f1caadc6fdad54dd9f502224236f7e73cc6a8 14-Oct-2011 Nick Lewycky <nicholas@mxc.ca> An instruction's operands aren't necessarily instructions or constants. They
could be arguments, for example.

No testcase because this is a bug-fix broken out of a larger optimization patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141951 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ef8a4c2a65fe28e8a798a0631e34356271e5f55f 06-Oct-2011 Andrew Trick <atrick@apple.com> Fixes PR11070 - assert in SCEV getConstantEvolvingPHIOperands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b73a8414a7f7d4f5131338b7bc3a81fe34298e4a 05-Oct-2011 Andrew Trick <atrick@apple.com> Typo. Thanks Bob.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141188 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f3baa581e82b099d6cda24b8dfaf9e91faa28f2b 05-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Fix a broken assert found by -Wparentheses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141168 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
28ab7db2c3d71bbd1d55bccef6efac338dc9297c 05-Oct-2011 Andrew Trick <atrick@apple.com> Fix disabled SCEV analysis caused r141161 and add unit test.

I noticed during self-review that my previous checkin disabled some
analysis. Even with the reenabled analysis the test case runs in about
5ms. Without the fix, it will take several minutes at least.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141164 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
13d31e0368c84bc0acc9e8ac88333685cc393edb 05-Oct-2011 Andrew Trick <atrick@apple.com> Avoid exponential recursion in SCEV getConstantEvolvingPHI and EvaluateExpression.

Note to compiler writers: never recurse on multiple instruction
operands without memoization.
Fixes rdar://10187945. Was taking 45s, now taking 5ms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141161 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e97728ecf8a0ee69562cc0e7880cfaa65200c624 04-Oct-2011 Nick Lewycky <nicholas@mxc.ca> The product of two chrec's can always be represented as a chrec.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141066 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1cbae18cf60c023840aab605958eea635c837f16 03-Oct-2011 Nick Lewycky <nicholas@mxc.ca> Reapply r140979 with fix! We never did get a testcase, but careful review of the
logic by David Meyer revealed this bug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140992 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4fcc80a486300021d320aec8cd125022ef701e5b 03-Oct-2011 Nick Lewycky <nicholas@mxc.ca> Revert r140979 due to reports of bootstrap failure.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140980 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8fde4f5842b454819bc9dc4d74d4a1bfd990dc62 03-Oct-2011 Nick Lewycky <nicholas@mxc.ca> Add one more case we compute a max trip count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140979 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f63ae2159d2c20ea239e4c6d4e74bd2f14ebd408 28-Sep-2011 Andrew Trick <atrick@apple.com> indvars: generalize SCEV getPreStartForSignExtend.

Handle general Add expressions to avoid leaving around redundant
32-bit IVs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140701 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
543376743c900806109c75d4fd12c4ba01020cfe 10-Sep-2011 Andrew Trick <atrick@apple.com> Set NSW/NUW flags on SCEVAddExpr when the operation is flagged as
such.

I'm doing this now for completeness because I can't think of/remember
any reason that it was left out. I'm not sure it will help anything,
but if we don't do it we need to explain why in comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139450 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c103a08a1115249548d6bb57a74a16de4f0864e3 06-Sep-2011 Nick Lewycky <nicholas@mxc.ca> This transform only handles two-operand AddRec's. Prevent it from trying to
handle anything more complex. Fixes PR10383 again!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139186 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ecd37bcd5ce27cacfa11c4731c46d9869278745e 06-Sep-2011 Nick Lewycky <nicholas@mxc.ca> Fix typo in comment again.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9115fba853ec3f89bf335b22ae51fbf18439e171 06-Sep-2011 Nick Lewycky <nicholas@mxc.ca> Apparently we compile the code, not the comments. Thanks Eli!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139138 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e6180992eb4730563a06c85545ca9cfbc033b7c9 06-Sep-2011 Nick Lewycky <nicholas@mxc.ca> Fix typo in comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139137 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8cfb2f8bcec2af1c3228fb4e372d4dfb0010c37d 06-Sep-2011 Nick Lewycky <nicholas@mxc.ca> Nope! I had it right the first time. Revert the operative part of r139135 and
add more showing of my work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
28682ae00f6d6f71c325de2b1d80c0b7a8df0716 06-Sep-2011 Nick Lewycky <nicholas@mxc.ca> Fix flipped sign. While there, show my math.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139135 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
980e9f399de8428550faa66835a789ba22e037de 06-Sep-2011 Nick Lewycky <nicholas@mxc.ca> No no no, fix typo properly!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139134 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
fa151a79ed2d0efc8fe1d7378be264b301d8caf1 06-Sep-2011 Nick Lewycky <nicholas@mxc.ca> The logic inside getMulExpr to simplify {a,+,b}*{c,+,d} was wrong, which was
visible given a=b=c=d=1, on iteration #1 (the second iteration). Replace it with
correct math. Fixes PR10383!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139133 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b2840fdcd8a98de32e86e70a267b54cf0af35140 06-Sep-2011 Nick Lewycky <nicholas@mxc.ca> Revert r139126 due to selfhost failures reported by buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139130 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
77b7352db027cb486d25a92c2756c379a3073d7f 06-Sep-2011 Nick Lewycky <nicholas@mxc.ca> Teach SCEV to report a max backedge count in one interesting case in
HowFarToZero; the case for a canonical loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139126 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
252ef7a61a9455c1e5d7b8a5a5f7ec8b3a75e200 02-Sep-2011 Andrew Trick <atrick@apple.com> Comment and clarifying assert.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139036 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b1831c66403315a1d84593b7c198ddbd43a574cf 12-Aug-2011 Andrew Trick <atrick@apple.com> Allow loop unrolling to get known trip counts from ScalarEvolution.

SCEV unrolling can unroll loops with arbitrary induction variables. It
is a prerequisite for -disable-iv-rewrite performance. It is also
easily handles loops of arbitrary structure including multiple exits
and is generally more robust.

This is under a temporary option to avoid affecting default
behavior for the next couple of weeks. It is needed so that I can
checkin unit tests for updateUnloop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137384 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
06988bcf6a5c74e81cf7e76f06a686aa822ec00a 06-Aug-2011 Andrew Trick <atrick@apple.com> Made SCEV's UDiv expressions more canonical. When dividing a
recurrence, the initial values low bits can sometimes be ignored.

To take advantage of this, added FoldIVUser to IndVarSimplify to fold
an IV operand into a udiv/lshr if the operator doesn't affect the
result.

-indvars -disable-iv-rewrite now transforms

i = phi i4
i1 = i0 + 1
idx = i1 >> (2 or more)
i4 = i + 4

into

i = phi i4
idx = i0 >> ...
i4 = i + 4


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137013 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
fcb4356dee96563def584fe38eeafb3eb63c5cd8 02-Aug-2011 Andrew Trick <atrick@apple.com> Use consistent terminology for loop exit/exiting blocks. Name change only.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136677 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5116ff671f45d48594d11360e22991a7edb13862 26-Jul-2011 Andrew Trick <atrick@apple.com> SCEV: Added a data structure for storing not-taken info per loop
exit. Added an interfaces for querying either the loop's exact/max
backedge taken count or a specific loop exit's not-taken count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136100 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1d2f569c3428d70d0cf690c9adb459ad4a3ecff2 19-Jul-2011 Jay Foad <jay.foad@gmail.com> Use ArrayRef in ConstantFoldInstOperands and ConstantFoldCall.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135477 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
db125cfaf57cc83e7dd7453de2d509bc8efd0e5e 18-Jul-2011 Chris Lattner <sabre@nondot.org> land David Blaikie's patch to de-constify Type, with a few tweaks.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
cf31f91931b257462a5a0059389977f6adea8dae 01-Jun-2011 Andrew Trick <atrick@apple.com> SCEV: missing null check fix for r132360, dragonegg crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132416 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b1ce4c09ddc321e0e16a42a686eb6b40251df321 31-May-2011 Andrew Trick <atrick@apple.com> scev: Better sign-extend removal. Normalize postincrement recurrences
so that their sign extended forms are congruent when no overflow occurs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132360 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
77a2c4c1e54b7e3c4815b276eb6a2d99a7621460 09-May-2011 Dan Gohman <gohman@apple.com> Change a few std::maps to DenseMaps.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131088 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a2a162077c80ebacc7c1b0bd92892ae207f1231f 27-Apr-2011 Andrew Trick <atrick@apple.com> Corrects an old, old typo in a case that doesn't seem to be reached in practice.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130316 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
104f4adeac9f555530ad24be609dae9d09baea18 27-Apr-2011 Andrew Trick <atrick@apple.com> Test case and comment for PR9633.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130294 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3f95c88162cf319bce463d0e5e2d99a96c24dff6 27-Apr-2011 Andrew Trick <atrick@apple.com> Fix for PR9633 [indvars] Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

Added a type check in ScalarEvolution::computeSCEVAtScope to handle the case in which operands of an
AddRecExpr in the current scope are folded.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130271 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
308bec390f4e6cba04ae06e2ca1a274c91a14f41 26-Apr-2011 Dan Gohman <gohman@apple.com> Fix an iterator invalidation bug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130166 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7a2bdde0a0eebcd2125055e0eacaca040f0b766c 15-Apr-2011 Chris Lattner <sabre@nondot.org> Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b12a754cce0c1d5542af605203a47820edba454d 18-Mar-2011 Andrew Trick <atrick@apple.com> Added isValidRewrite() to check the result of ScalarEvolutionExpander.

SCEV may generate expressions composed of multiple pointers, which can
lead to invalid GEP expansion. Until we can teach SCEV to follow strict
pointer rules, make sure no bad GEPs creep into IR.
Fixes rdar://problem/9038671.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127839 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4dbe200b2d3da0dfd1c788c9650b8b8075c241aa 15-Mar-2011 Andrew Trick <atrick@apple.com> Remove getMinusSCEVForExitTest().
This function performed acrobatics to prove no-self-wrap, which we now
have for free.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127643 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c343c1e27eb1a8901aebbe732a2813150ff46a71 15-Mar-2011 Andrew Trick <atrick@apple.com> Propagate SCEV no-wrap flags whenever possible.
This needs review.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127638 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a053b21177015726b4cd136c42bc36f2f74556be 14-Mar-2011 Andrew Trick <atrick@apple.com> Negating a recurrence preserves no-self-wrap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127593 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
dcfd404e3ccc66844632aa601bf52522dae41512 14-Mar-2011 Andrew Trick <atrick@apple.com> HowFarToZero can compute a trip count as long as the recurrence has no-self-wrap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127591 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3228cc259b5ca00e46af36da369a451f5736cbf4 14-Mar-2011 Andrew Trick <atrick@apple.com> Added SCEV::NoWrapFlags to manage unsigned, signed, and self wrap
properties.
Added the self-wrap flag for SCEV::AddRecExpr.
A slew of temporary FIXMEs indicate the intention of the no-self-wrap flag
without changing behavior in this revision.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127590 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e62289b98f591bca3fd9073213b00a757d4cf857 09-Mar-2011 Andrew Trick <atrick@apple.com> When SCEV can determine the loop test is X < X, set ExactBECount=0.
When ExactBECount is a constant, use it for MaxBECount.
When MaxBECount cannot be computed, replace it with ExactBECount.
Fixes PR9424.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127342 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
635f71880bf26c06cdf2c678b4804439a0503429 09-Mar-2011 Andrew Trick <atrick@apple.com> whitespace


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127340 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8ebaf909580ada88d9952327323ded1e328d0708 13-Feb-2011 Chris Lattner <sabre@nondot.org> teach SCEV that the scale and addition of an inbounds gep don't NSW.
This fixes a FIXME in scev-aa.ll (allowing a new no-alias result) and
generally makes things more precise.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125449 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1021236c74dcc4beb294ebe675032ff578fae17f 11-Feb-2011 Chris Lattner <sabre@nondot.org> Per discussion with Dan G, inbounds geps *certainly* can have
unsigned overflow (e.g. "gep P, -1"), and while they can have
signed wrap in theoretical situations, modelling an AddRec as
not having signed wrap is going enough for any case we can
think of today. In the future if this isn't enough, we can
revisit this. Modeling them as having NUW isn't causing any
known problems either FWIW.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125410 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e19b7b80bd1bf48f9a6f036cf1cbc5f65445090a 26-Jan-2011 Nick Lewycky <nicholas@mxc.ca> Fix memory corruption. If one of the SCEV creation functions calls another but
doesn't return immediately after then the insert position in UniqueSCEVs will
be out of date. No test because this is a memory corruption issue. Fixes PR9051!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124282 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a3bbf2411fa1e085fc371e2c9ef27970e2c89d3c 24-Jan-2011 Dan Gohman <gohman@apple.com> Add a comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124126 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
76167af9b1968b2824fcb76db0bc571f422035b4 23-Jan-2011 Nick Lewycky <nicholas@mxc.ca> Simplify some code with no functionality change. Make the test a lot more
robust against smarter optimizations, using the power of FileCheck.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124081 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
630d85a78cdebf14a6fc2a0750bf48738f26ef08 23-Jan-2011 Nick Lewycky <nicholas@mxc.ca> Use value ranges to fold ext(trunc) in SCEV when possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124062 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9b8d2c26bce15d47a54718a50b44dd0a65eb88f4 22-Jan-2011 Nick Lewycky <nicholas@mxc.ca> Have SCEV turn sext(x) into zext(x) when x is s>= 0. This applies many times in
"make check" alone.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124046 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5c6fc1cab774244fba2746b84f2b86d71b897733 19-Jan-2011 Nick Lewycky <nicholas@mxc.ca> Similarly, analyze truncate through multiply.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123842 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
30aa8b13c93211f68bb4efddd1e47817a1d107f1 19-Jan-2011 Nick Lewycky <nicholas@mxc.ca> Add a missed SCEV fold that is required to continue analyzing the IR produced
by indvars through the scev expander.

trunc(add x, y) --> add(trunc x, y). Currently SCEV largely folds the other way
which is probably wrong, but preserved to minimize churn. Instcombine doesn't
do this fold either, demonstrating a missed optz'n opportunity on code doing
add+trunc+add.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123838 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
73f565e7546f63900738cd31a2f956444e7bb544 19-Jan-2011 Nick Lewycky <nicholas@mxc.ca> Add a missing SCEV simplification sext(zext x) --> zext x.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123832 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6038a6351e7a9601a1eb3ffe4623c424ae2c80a4 11-Jan-2011 Chris Lattner <sabre@nondot.org> some comment improvements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123243 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
87376839a651ed1221dd46762701f13ad6ece0eb 11-Jan-2011 Eric Christopher <echristo@apple.com> Temporarily revert 123133, it's causing some regressions and I'm trying
to get a testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123225 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
965187081538623b5ed76beafb6888c81dcc80f2 11-Jan-2011 Chris Lattner <sabre@nondot.org> the GEP faq says that only inbounds geps are guaranteed to not overflow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123218 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
bd9d53cc65e0e6e492f150e3a06d908fb6ccbc14 10-Jan-2011 Chris Lattner <sabre@nondot.org> add a fixme: ir isn't expressive enough.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
53e1d45adbe94304ce685600a99694240fc1185a 09-Jan-2011 Chris Lattner <sabre@nondot.org> Step #4 in improving trip count analysis: HowFarToZero can analyze
NUW AddRec's much more aggressively. We now get a trip count
for @test2 in nsw.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123138 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7975e3ebbac67cc50d918843bf68373cf48daa2e 09-Jan-2011 Chris Lattner <sabre@nondot.org> rearrange some code, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ad19c8c63cae112a2677c2f5d65717aeba44f8cb 09-Jan-2011 Chris Lattner <sabre@nondot.org> Step #3 to improving trip count analysis: If we fold
a + {b,+,stride} into {a+b,+,stride} (because a is LIV),
then the resultant AddRec is NUW/NSW if the client says it
is.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123133 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
992efb03785f2a368fbb63b09373be1d6a96ce5a 09-Jan-2011 Chris Lattner <sabre@nondot.org> Step #2 to improve trip count analysis for loops like this:

void f(int* begin, int* end) { std::fill(begin, end, 0); }

which turns into a != exit expression where one pointer is
strided and (thanks to step #1) known to not overflow, and
the other is loop invariant.

The observation here is that, though the IV is strided by
4 in this case, that the IV *has* to become equal to the
end value. It cannot "miss" the end value by stepping over
it, because if it did, the strided IV expression would
eventually wrap around.

Handle this by turning A != B into "A-B != 0" where the A-B
part is known to be NUW.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6d5a2411aad379141df29687b8cec0938ab7ae61 09-Jan-2011 Chris Lattner <sabre@nondot.org> teach SCEV analysis of PHI nodes that PHI recurences formed
with GEP instructions are always NUW, because PHIs cannot wrap
the end of the address space.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123105 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f1859891b7bef1ac8d5cea100f152aeb5783c3b3 09-Jan-2011 Chris Lattner <sabre@nondot.org> reduce indentation. Print <nuw> and <nsw> when dumping SCEV AddRec's
that have the bit set.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123104 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
40f8f6264d5af2c38e797e0dc59827cd231e8ff7 07-Dec-2010 Jay Foad <jay.foad@gmail.com> PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121120 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7a874ddda037349184fbeb22838cc11a1a9bb78f 01-Dec-2010 Jay Foad <jay.foad@gmail.com> PR5207: Rename overloaded APInt methods set(), clear(), flip() to
setAllBits(), setBit(unsigned), etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120564 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f601d6df6f43bb833461cbcee475c36998e6c259 20-Nov-2010 Benjamin Kramer <benny.kra@googlemail.com> Simplify code. No change in functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119908 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b458b15510712a241b02639d14afd35b422a1cc0 19-Nov-2010 Benjamin Kramer <benny.kra@googlemail.com> Silence warning about an uninitialized variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119800 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d0c6f3dafd7c3e9137d4e6415014c94137fcd3fc 18-Nov-2010 Duncan Sands <baldrick@free.fr> Factor code for testing whether replacing one value with another
preserves LCSSA form out of ScalarEvolution and into the LoopInfo
class. Use it to check that SimplifyInstruction simplifications
are not breaking LCSSA form. Fixes PR8622.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119727 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9c9fcfc719158a46cb2e41b66d7dc1a63cd48d74 18-Nov-2010 Dan Gohman <gohman@apple.com> Introduce memoization for ScalarEvolution dominates and properlyDominates
queries, and SCEVExpander getRelevantLoop queries.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119595 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
56a756821842678a96f2baa8c6a53bd28fc2b69e 18-Nov-2010 Dan Gohman <gohman@apple.com> Factor out the code for purging a SCEV from all the various memoization maps.
Some of these maps may merge in the future, but for now it's convenient to have
a utility function for them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119587 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
714b5290b04e08570dae4304c1c92d30c06d3c99 18-Nov-2010 Dan Gohman <gohman@apple.com> Merge the implementations of isLoopInvariant and hasComputableLoopEvolution, and
memoize the results. This improves compile time in code which highly complex
expressions which get queried many times.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119584 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4ce32db913beb6ae27df2fa0a9db5d68fd4889d2 17-Nov-2010 Dan Gohman <gohman@apple.com> Make SCEV::getType() and SCEV::print non-virtual. Move SCEV::hasOperand
to ScalarEvolution. Delete SCEV::~SCEV. SCEV is no longer virtual.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
dc0e8fb9f9512622f55f73e1a434caa5c0915694 17-Nov-2010 Dan Gohman <gohman@apple.com> Move SCEV::dominates and properlyDominates to ScalarEvolution.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119570 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
17ead4ff4baceb2c5503f233d0288d363ae44165 17-Nov-2010 Dan Gohman <gohman@apple.com> Move SCEV::isLoopInvariant and hasComputableLoopEvolution to be member
functions of ScalarEvolution, in preparation for memoization and
other optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119562 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6f8a5ddcd8d7e5b041ff083009ae84de0e6e588b 17-Nov-2010 Duncan Sands <baldrick@free.fr> Before replacing a phi node with a different value, it
needs to be checked that this won't break LCSSA form.
Change the existing checking method to a more direct one:
rather than seeing if all predecessors belong to the loop,
check that the replacing value is either not in any loop or
is in a loop that contains the phi node.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119556 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
203a7239ae928568fe7a34c03ead4b1b3133870e 17-Nov-2010 Dan Gohman <gohman@apple.com> Verify SCEVAddRecExpr's invariant in ScalarEvolution::getAddRecExpr
instead of in SCEVAddRecExpr's constructor, in preparation for an
upcoming change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119554 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7c0fd8eb724a7228a6cf7e3e5487614c25202a91 17-Nov-2010 Dan Gohman <gohman@apple.com> Fix ScalarEvolution's range memoization to avoid using a
default ctor with ConstantRange.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119550 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a0c5244e8575ae91af318af09353ff34ac6bca1e 17-Nov-2010 Duncan Sands <baldrick@free.fr> Have ScalarEvolution use SimplifyInstruction rather than hasConstantValue.
While there, add a note about an inefficiency I noticed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119458 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6678e7b6eb534b43b92105076e6d0553e5cf7def 17-Nov-2010 Dan Gohman <gohman@apple.com> Memoize results from ScalarEvolution's getUnsignedRange and getSignedRange.
This fixes some extreme compile times on unrolled sha512 code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119455 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e60dcb5e974989998f1d008ea2a1caee29665d58 29-Oct-2010 Dan Gohman <gohman@apple.com> Make ScalarEvolution::forgetLoop forget all contained loops too, because
they may have ValuesAtScopes map entries referencing their outer loops.
This fixes a user-after-free reported in PR8471.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
081c34b725980f995be9080eaec24cd3dfaaf065 19-Oct-2010 Owen Anderson <resistor@mac.com> Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which
must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize
the pass's dependencies.

Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the
CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h
before parsing commandline arguments.

I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems
with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass
registration/creation, please send the testcase to me directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116820 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2ab36d350293c77fc8941ce1023e4899df7e3a82 12-Oct-2010 Owen Anderson <resistor@mac.com> Begin adding static dependence information to passes, which will allow us to
perform initialization without static constructors AND without explicit initialization
by the client. For the moment, passes are required to initialize both their
(potential) dependencies and any passes they preserve. I hope to be able to relax
the latter requirement in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ce665bd2e2b581ab0858d1afe359192bac96b868 08-Oct-2010 Owen Anderson <resistor@mac.com> Now with fewer extraneous semicolons!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7a391832f46ca2947f6ee46f6fad53cf64197d28 04-Oct-2010 Dan Gohman <gohman@apple.com> Don't add the operand count to SCEV uniquing data; FoldingSetNodeID
already knows its own length, so this is redundant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115521 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3f19c091bf9cfe717e14b8a1967085ba84db3877 01-Sep-2010 Dan Gohman <gohman@apple.com> Reapply r112432, now that the real problem is addressed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6a0c125ed566d3d2fecd70b9dcac65ef10b7958a 01-Sep-2010 Dan Gohman <gohman@apple.com> Reapply r112433, now that the real problem is addressed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112666 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
90b5f25e8d3db3a05a6cedfb70ad59e7db884f29 01-Sep-2010 Dan Gohman <gohman@apple.com> Revert r110916. This patch is buggy because the code inside the
inner loop doesn't update all the variables in the outer loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112665 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
26125c65b926fa02c9aa9f62ae462e533fd6d883 31-Aug-2010 Dan Gohman <gohman@apple.com> Revert r112432. It appears to be exposing a problem in the emacs build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112638 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f3bba4c1aefb1d260793813e60d045d76e52b6d2 31-Aug-2010 Dan Gohman <gohman@apple.com> Speculatively revert r112433.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112608 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d578a40853ab54f6172c2ca350626edacc45846c 29-Aug-2010 Dan Gohman <gohman@apple.com> Restructure the {A,+,B}<L> * {C,+,D}<L> folding so that it folds
all applicable addrecs before recursing on getMulExpr, instead of
recursing on getMulExpr for each one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112433 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b8fc62bc58d945a4e820ee3676c17793e8770b3a 29-Aug-2010 Dan Gohman <gohman@apple.com> Batch up subtracts along with adds, when analyzing long chains of
operations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112432 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c6a8e99fb34f039d5e410409f21cc03802059e59 29-Aug-2010 Dan Gohman <gohman@apple.com> Micro-optimize GroupByComplexity.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112431 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0f32ae3aa7e1020979e4537885f5a95bba073adc 29-Aug-2010 Dan Gohman <gohman@apple.com> Hold AddRec->getLoop() in a variable, to make the Mul code more consistent
with the Add code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112430 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
30cbc860f889262f0be8d94936a79fb502ecb6b1 29-Aug-2010 Dan Gohman <gohman@apple.com> Rename a variable, for consistency.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112429 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7e1fee7ece962e03471d0c7a253c3d23b3cf50ae 29-Aug-2010 Dan Gohman <gohman@apple.com> Use iterators instead of indices.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112428 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5bb307d5c8b58f5809482db25b344d9a6b2a5663 28-Aug-2010 Dan Gohman <gohman@apple.com> Fix an index calculation thinko.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112337 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
68ff776661be00138a9a5c9cce731a137e1dd2bb 27-Aug-2010 Dan Gohman <gohman@apple.com> When merging adjacent operands, scan ahead and merge all equal
adjacent operands at once, instead of just two at a time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
32527156b3f33466af15a43d3a1695fd9ee2d315 27-Aug-2010 Dan Gohman <gohman@apple.com> Make the {A,+,B}<L> + {C,+,D}<L> --> Other + {A+C,+,B+D}<L>
transformation collect all the addrecs with the same loop
add combine them at once rather than starting everything over
at the first chance.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112290 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e8ac3f3be4b4df619368bf46aa4ed91557b5f76e 27-Aug-2010 Dan Gohman <gohman@apple.com> Switch ScalarEvolution's main Value*->SCEV* map from std::map
to DenseMap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112281 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
67ef74e0e5863e32e4d581d5e197bf00cccddd01 27-Aug-2010 Dan Gohman <gohman@apple.com> Optimize SCEVComplexityCompare. Use a 3-way return instead of a 2-way
return to avoid needing two calls to test for equivalence, and sort
addrecs by their degree before examining their operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112267 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1895991a084d5d45d091a24542ad111946738e70 16-Aug-2010 Dan Gohman <gohman@apple.com> To create a copy of a SmallVector with an element removed from the
middle, copy the elements in two groups, rather than copying all the
elements and then doing an erase on the middle of the result. These
are SmallVectors, so we shouldn't expect to hit dynamic allocation
in the common case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111151 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0c5e95df571d854bf350414b2ea1fe2b84727937 16-Aug-2010 Dan Gohman <gohman@apple.com> Tidy whitespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111147 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
619d3324bd2f3bcfc6bb33d50dc16c211d0d6471 16-Aug-2010 Dan Gohman <gohman@apple.com> Add a comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111145 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8d9c7a67015d6e9413f96eca26633ad7ec74d013 16-Aug-2010 Dan Gohman <gohman@apple.com> Use const_iterator in a few places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111144 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2d16fc5ff03ae1e6ac219efe1776366cf211689f 16-Aug-2010 Dan Gohman <gohman@apple.com> Use iterators instead of indices in a few more places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111143 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e28d7922f7a3338b1d0dfec4158584d4dd6f4031 16-Aug-2010 Dan Gohman <gohman@apple.com> Micro-optimize SCEVConstant comparison.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111142 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2f199f9952b9dd62b5a0d0f4350b8fa780ebb9cc 16-Aug-2010 Dan Gohman <gohman@apple.com> Move SCEVNAryExpr's virtual member functions out of line, and convert
them to iterators.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111140 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
bb85409b510e18250c2345b57c050798a3b90213 16-Aug-2010 Dan Gohman <gohman@apple.com> Use iterators instead of indices in simple cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111138 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c4f77983d82675cc45b5819d1b0693787e6baad7 16-Aug-2010 Dan Gohman <gohman@apple.com> Avoid gratuitous inefficiency in ifndef NDEBUG code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111137 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d3f171d66fdcdca77d254084c718067fff887ee9 16-Aug-2010 Dan Gohman <gohman@apple.com> Make one getAddExpr call when analyzing a+b+c+d+e+... instead of one
for each add instruction. Ditto for Mul.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
57560da3f5cb09cc50f1381c142f32000f484ad5 16-Aug-2010 Dan Gohman <gohman@apple.com> Delete an unused function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111135 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0ad2c7ace8abe46a86724a0ad939515d23d5c402 13-Aug-2010 Dan Gohman <gohman@apple.com> Various optimizations. Don't compare two loops' depths
when they are the same loop. Don't compare two instructions'
loop depths when they are in the same block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9cba97886c9b6088ac35ecc6c3122e2c7665d6da 13-Aug-2010 Dan Gohman <gohman@apple.com> When testing whether one loop contains another, test this directly
rather than testing whether the loop contains the other's header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111039 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9f1fb42b7e6260bcc535cfd50df60b35e17672f8 13-Aug-2010 Dan Gohman <gohman@apple.com> Add a const.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111038 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
58a85b96b887f1abbdd3deec5c44844d24393077 13-Aug-2010 Dan Gohman <gohman@apple.com> When creating a symmetric SCEV with a constant operand, put
the constant operand on the left, as that's where ScalarEvolution
will end up canonicalizing to.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111037 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
71c4144076d35bd45f8a5103357532f958de6757 13-Aug-2010 Dan Gohman <gohman@apple.com> An add recurrence is loop-invariant in any loop inside of its
associated loop. This avoids potentially expensive traversals
of the add recurrence's operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111034 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
727356fc7d6898f1628f2a64930fe46b3540050d 12-Aug-2010 Dan Gohman <gohman@apple.com> Optimize ScalarEvolution::getAddExpr's operand factoring code by
having it finish processing all of the muliply operands before
starting the whole getAddExpr process over again, instead of
immediately after the first simplification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110916 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
918e76b8b5e1766db25004bafb8148387b5709e1 12-Aug-2010 Dan Gohman <gohman@apple.com> Hoist some loop-invariant code out of a hot loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110915 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
dc7692b1ad3b2f7eaa7f21504826af7ce1e3b573 12-Aug-2010 Dan Gohman <gohman@apple.com> Optimize ScalarEvolution::getAddExpr's duplicate operand detection
by having it finish processing the whole operand list before
starting the whole getAddExpr process over again, instead of
immediately after the first duplicate is found.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110914 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4ee87398e808534577ed1be52f2b48a6130b2c0e 11-Aug-2010 Dan Gohman <gohman@apple.com> When analyzing loop exit conditions combined with and and or, don't
make any assumptions about when the two conditions will agree on when
to permit the loop to exit. This fixes PR7845.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110758 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
af08a36bd6b9d32a5ea993849d43094fecbd5bed 11-Aug-2010 Dan Gohman <gohman@apple.com> Rename and reorder the arguments to isImpliedCond, for consistency and clarity.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110750 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
90c579de5a383cee278acc3f7e7b9d0a656e6a35 06-Aug-2010 Owen Anderson <resistor@mac.com> Reapply r110396, with fixes to appease the Linux buildbot gods.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1f74590e9d1b9cf0f1f81a156efea73f76546e05 06-Aug-2010 Owen Anderson <resistor@mac.com> Revert r110396 to fix buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9ccaf53ada99c63737547c0235baeb8454b04e80 06-Aug-2010 Owen Anderson <resistor@mac.com> Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier. Clean up APIs related to this change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ddd3a8899a31f858097bc482082a74b3f684b426 04-Aug-2010 Dan Gohman <gohman@apple.com> Fix a minor bug which resulted in intermediate calculations
using wider types than are necessary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110241 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ab37f50838350e1104579fbd1f7c8820473485a5 03-Aug-2010 Dan Gohman <gohman@apple.com> Make SCEVUnknown a CallbackVH, so that it can be notified directly
of Value deletions and RAUWs, instead of relying on ScalarEvolution's
Scalars map being notified, as that's complicated at best, and
insufficient in general.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110086 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ee56c42168f6c4271593f6018c4409b6a5910302 02-Aug-2010 Oscar Fuentes <ofv@wanadoo.es> Prefix `next' iterator operation with `llvm::'.

Fixes potential ambiguity problems on VS 2010.

Patch by nobled!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110029 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e6cbfa6b09e3e9ddf18449d1b64793e24af27c6b 29-Jul-2010 Eric Christopher <echristo@apple.com> Speculatively revert r109705 since it seems to be causing some build bot
angst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109718 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c6743207e20904008d2de016adfa6b0a9355c0e7 29-Jul-2010 Dan Gohman <gohman@apple.com> Factor out some of the code for updating old SCEVUnknown values, and
extend it to handle the case where multiple RAUWs affect a single
SCEVUnknown.

Add a ScalarEvolution unittest to test for this situation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109705 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
81f9121cda099f75e50485e79e8fdb423ae82792 28-Jul-2010 Dan Gohman <gohman@apple.com> Make SCEVCallbackVH::allUsesReplacedWith update the old SCEVUnknown
object, as it may still be referenced by SCEVs not cleaned up by the
use list traversal.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109570 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
59846aced20b23882a97b92da5d653dc3f3e8526 28-Jul-2010 Dan Gohman <gohman@apple.com> Make SCEVCallbackVH::allUsesReplacedWith unconditionally delete
the old value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109567 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
304a7a624255b2da91dd4b7da9a13b2658055b43 23-Jul-2010 Dan Gohman <gohman@apple.com> Micro-optimize SCEVComplexityCompare.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109267 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e72079ac69e34bdf795a28be534147df7dccb9b1 23-Jul-2010 Dan Gohman <gohman@apple.com> Add a const qualifier.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109266 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
96f1d8ebdd33b3f9bdb3b1163f36072c68599f42 22-Jul-2010 Gabor Greif <ggreif@gmail.com> mass elimination of reliance on automatic iterator dereferencing

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109103 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d13db2c59cc94162d6cf0a04187d408bfef6d4a7 22-Jul-2010 Owen Anderson <resistor@mac.com> Fix batch of converting RegisterPass<> to INTIALIZE_PASS().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
eb4152c192ad226a1dee825f1433277e1851edbc 20-Jul-2010 Dan Gohman <gohman@apple.com> Add a fast path for x - x.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108855 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f53462d2ea64f3ae78440b01b345298532acb9a5 15-Jul-2010 Dan Gohman <gohman@apple.com> Teach ScalarEvolution how to fold trunc(undef) and anyext(undef) to undef.
This helps LSR behave more consistently on bugpoint-reduced testcases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108451 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
06028bcce46555e84944b7f8b674c05f32b2f07b 30-Jun-2010 Dan Gohman <gohman@apple.com> In ScalarEvolution::forgetValue, eliminate any SCEVUnknown
entries associated with the value being erased in the
folding set map. These entries used to be harmless, because
a SCEVUnknown doesn't store any information about its Value*,
so having a new Value allocated at the old Value's address
wasn't a problem. But now that ScalarEvolution is storing more
information about values, this is no longer safe.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107316 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
70eff630085cb1585858344324c78c7418524795 30-Jun-2010 Dan Gohman <gohman@apple.com> Revert the part of r107257 which introduced new logic for using
nsw and nuw flags from IR Instructions. On further consideration,
this isn't valid.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b9f965144573d361b4908920b1858bf52d772f35 30-Jun-2010 Dan Gohman <gohman@apple.com> Improve ScalarEvolution's nsw and nuw preservation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107257 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8a18d6b48f9877dbb7fbb88cb294201b20b9fb05 30-Jun-2010 Dan Gohman <gohman@apple.com> When computing a new ConservativeResult, intersect it with
the old one instead of replacing it, to be more precise.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107256 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1104645eefa134ff3dd2c911d2aaa0dffb38f59f 30-Jun-2010 Dan Gohman <gohman@apple.com> Fix ScalarEvolution's tripcount computation for chains of loops
where each loop's induction variable's start value is the exit
value of a preceding loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107224 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7a64257f94202b1416bbd4981ada9076af273ee3 29-Jun-2010 Dan Gohman <gohman@apple.com> Just as its not safe to blindly transfer the nsw bit from an add
instruction to an add scev, it's not safe to blindly transfer the
inbounds flag from a gep instruction to an nsw on the scev for the
gep.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107117 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
420ab9102cc4493563f3a731ea39eec22ad4996c 25-Jun-2010 Dan Gohman <gohman@apple.com> Eliminate a redundant FoldingSet lookup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
eaf6cf28dd312704718d53155333b4d6d7c16c7c 24-Jun-2010 Dan Gohman <gohman@apple.com> Don't try to preserve pointer types in SCEVConstants; the old code
was over-complicated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106760 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1faa88280edb3eec934dcbd4a033b2162e01274f 24-Jun-2010 Dan Gohman <gohman@apple.com> Make the trunc code consistent with the zext and sext code in its
handling of pointer types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106757 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
605c14fb115e89a2bad97761ae57b55e8c28ffff 23-Jun-2010 Dan Gohman <gohman@apple.com> Replace ScalarEvolution's private copy of getLoopPredecessor
with LoopInfo's public copy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106603 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9d4588ffadfdf6c190758200b2ca69742f46d239 22-Jun-2010 Dan Gohman <gohman@apple.com> Allow "exhaustive" trip count evaluation on phi nodes with all
constant operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
403a8cdda5e76ea689693de16474650b4b0df818 21-Jun-2010 Dan Gohman <gohman@apple.com> Use A.append(...) instead of A.insert(A.end(), ...) when A is a
SmallVector, and other SmallVector simplifications.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106452 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b92654d9c9cc34c75463e40d822fea4ac53950b3 19-Jun-2010 Dan Gohman <gohman@apple.com> Fix ScalarEvolution's "exhaustive" trip count evaluation code to avoid
assuming that loops are in canonical form, as ScalarEvolution doesn't
depend on LoopSimplify itself. Also, with indirectbr not all loops can
be simplified. This fixes PR7416.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106389 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3bf63768e574a2065de1aebba12f6c2e80f4fb16 18-Jun-2010 Dan Gohman <gohman@apple.com> Revert r106304 (105548 and friends), which are the SCEVComplexityCompare
optimizations. There is still some nondeterminism remaining.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106306 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
78db186d2dbaf4745f7e4beab4029db40856b54b 18-Jun-2010 Dan Gohman <gohman@apple.com> Reapply 105540, 105542, and 105548, and revert r105732.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106304 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e0f0c7b024f4c884b0671cb4e137dffc92a53b5e 18-Jun-2010 Dan Gohman <gohman@apple.com> Reapply 105546.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106302 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c72f0c8c57a79fe9d32d9147ec3b8717ade6faa1 18-Jun-2010 Dan Gohman <gohman@apple.com> Reapply 105544.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106301 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
07587a450044e32b791baa012032f1cb11bfed88 18-Jun-2010 Dan Gohman <gohman@apple.com> Remove getIntegerSCEV; it's redundant with getConstant, and getConstant
is more consistent with the ConstantInt API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106281 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
27ed6a41ce4be84dfc812cb88e7bc56c39c15f4d 18-Jun-2010 Dan Gohman <gohman@apple.com> Simplify this code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106254 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1d451dff63e9c4241794a3645dfe4ee67efe5b22 09-Jun-2010 Evan Cheng <evan.cheng@apple.com> Revert 105540, 105542, 105544, 105546, and 105548 to unbreak bootstrapping.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105740 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
fd447eff22637c3d47ce709468ab50b6243d0e4c 07-Jun-2010 Dan Gohman <gohman@apple.com> The FoldingSet hash data includes pointer values, so it isn't
determinstic. Instead, give SCEV objects an arbitrary sequence
number.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105548 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5e5dd68c7f5115c245745c496ab3e4cd338a181c 07-Jun-2010 Dan Gohman <gohman@apple.com> Optimize this code somewhat by taking advantage of the fact
that the operands are sorted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105546 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1f23d63ddf6d931f687a37ddadb76c2f37ffbef6 07-Jun-2010 Dan Gohman <gohman@apple.com> Micro-optimize this, to speed up this hotspot in debug builds a little.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105544 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ef07158c11b6083578e6d533a1a69afe2e186903 07-Jun-2010 Dan Gohman <gohman@apple.com> Micro-optimize this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4d52c6d622811d00d40b914a4ebd1996b1eed95d 07-Jun-2010 Dan Gohman <gohman@apple.com> Optimize ScalarEvolution's SCEVComplexityCompare predicate: don't go
scrounging through SCEVUnknown contents and SCEVNAryExpr operands;
instead just do a simple deterministic comparison of the precomputed
hash data.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105540 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
700012231d58cd3f1bab21cb0e003d98253045a4 28-May-2010 Dan Gohman <gohman@apple.com> ConstantFoldConstantExpression can theoretically return null.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104948 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
acd8cab84341b8298b72c45c40483abf1e402662 04-May-2010 Dan Gohman <gohman@apple.com> Use the SCEVAddRecExpr::getPostIncExpr utility function instead
of doing the same thing manually.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102997 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c0ed0091dc1cd6d61019a1c2c73a0d956506ad00 04-May-2010 Dan Gohman <gohman@apple.com> Fix a copy+pasto.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
deff621abdd48bd70434bd4d7ef30f08ddba1cd8 04-May-2010 Dan Gohman <gohman@apple.com> Use getConstant instead of getIntegerSCEV. The two are basically the
same, now that getConstant has overloads consistent with ConstantInt::get.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102965 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f16c6803d72401aef50dfffded89edce28e184d3 03-May-2010 Dan Gohman <gohman@apple.com> Silence warnings about -1 being converted to an unsigned value.

Also, pass true for isSigned even when creating constants for unsigned
comparisons, because the point is to create an all-ones constant,
rather than UINT64_MAX, even for integers wider than 64 bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102946 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
34c3e36e6317b0ed448ccd2c567d5b088275fd7d 03-May-2010 Dan Gohman <gohman@apple.com> Use isTrueWhenEqual and isFalseWhenEqual instead of assuming that
SimplifyICmpOperands will simplify such cases to EQ or NE. This makes
the correcntess of the code independent on SimplifyICmpOperands doing
certain simplifications.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102927 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a189bae771262aa237ce983a89d1289a67682b68 03-May-2010 Dan Gohman <gohman@apple.com> In ScalarEvolution::print, don't bother printing out the SCEVs for
comparison instructions, since they aren't interesting, despite having
integer result types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102925 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3abb69c07fe6b161c6e7572c75e465955d9911e7 03-May-2010 Dan Gohman <gohman@apple.com> In SimplifyICmpOperands, avoid needlessly swapping the operands in the
case where both are addrecs in unrelated loops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
03557dc0ad0baf42259f298fd56c2c521a9500ad 03-May-2010 Dan Gohman <gohman@apple.com> Factor out the new <= and >= analysis code into SimplifyICmpOperands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102922 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8833c32108b026e803a4d1ddd6ab1badd3f9dbbc 30-Apr-2010 Dan Gohman <gohman@apple.com> Set isSigned to true when creating an all-ones integer constant, even
for unsigned purposes, so >64-bit integer values get a full all-ones
value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102739 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b6fd0b481c265449ffcd10c66fb1415cf9000a79 30-Apr-2010 Dan Gohman <gohman@apple.com> Silence compiler warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102734 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9f93d30a26ae9928f886ef7271efeafcea2a00a6 24-Apr-2010 Dan Gohman <gohman@apple.com> ScalarEvolution support for <= and >= loops.

Also, generalize ScalarEvolutions's min and max recognition to handle
some new forms of min and max that this change makes more common.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102234 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d19bba69ad92311c64c8d55d69c74543933e451e 24-Apr-2010 Dan Gohman <gohman@apple.com> Use SimplifyICmpOperands in isKnownPredicate too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102233 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d4da5af271eee5d0961a57e17a71283180566204 24-Apr-2010 Dan Gohman <gohman@apple.com> Update isImpliedCond to use the new SimplifyICmpOperands utility.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102232 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e979650fa5faf4b1253f623662a8d9c81a4a4fc3 24-Apr-2010 Dan Gohman <gohman@apple.com> Add a new utility function SimplifyICmpOperands. Much of this code is
refactored out of ScalarEvolution::isImpliedCond, which will be updated
to use this new utility routine soon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102229 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c6863989fc268ee0ff1469e4856e2e9404e67336 23-Apr-2010 Dan Gohman <gohman@apple.com> When it doesn't matter whether zero or sign extension is used,
use ScalarEvolutions "any" extend function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102156 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ddb3eafc32187af2ee2311a27344cb53d4307d63 22-Apr-2010 Dan Gohman <gohman@apple.com> Don't attempt to analyze values which are obviously undef. This fixes some
assertion failures in extreme cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a560fd28c01367ffd7b64bbeace856b50af1753c 21-Apr-2010 Dan Gohman <gohman@apple.com> Make ScalarEvolution::getConstant support pointer types, for consistency
with ScalarEvolution's overall approach to pointer types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a5145c8d5ad6433cd490ce2e19584256b380d6b3 16-Apr-2010 Dan Gohman <gohman@apple.com> Fix SCEVCommutativeExpr::print to be robust in the case of improper
expression canonicalization. Its job is to print what's there, not to
make judgements about it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101461 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
005752bbe72868b548bba93dbc1ea46ffe8e5b2c 15-Apr-2010 Dan Gohman <gohman@apple.com> Make getPredecessorWithUniqueSuccessorForBB return the unique successor
in addition to the predecessor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101374 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2c93e390723a17b97b59c3a0f6b4989767b7d86a 14-Apr-2010 Dan Gohman <gohman@apple.com> Add a comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101248 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
28287794d4e9e1e07742f8a937cfc2be8af627c6 13-Apr-2010 Dan Gohman <gohman@apple.com> Teach ScalarEvolution to simplify smax and umax when it can prove
that one operand is always greater than another.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101142 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3ab131243e0150854df2f94ea3f472cb7ca00236 13-Apr-2010 Dan Gohman <gohman@apple.com> Minor code micro-optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101141 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
bca091d5617ce78f300f9af4cb5515528b514147 13-Apr-2010 Dan Gohman <gohman@apple.com> Micro-optimize a few hot spots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101086 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6ab10f69a9804c1915202992e4afebea63604535 13-Apr-2010 Dan Gohman <gohman@apple.com> Add fast paths to ScalarEvolution::getSizeOf and getOffsetOf, as
they're used a lot by getNodeForGEP, which can be called a lot.
This speeds up -iv-users by around 15% on several testcases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101083 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
27dead44e0d198c71c317ff88ab02fc5f0fb947d 12-Apr-2010 Dan Gohman <gohman@apple.com> Generalize ScalarEvolution's PHI analysis to handle loops that don't
have preheaders or dedicated exit blocks, as clients may not otherwise
need to run LoopSimplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101030 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
646e047765a2d4c38555550fddde66d1e003aece 12-Apr-2010 Dan Gohman <gohman@apple.com> Rewrite the overflow checking in the get{Signed,Unsigned}Range code for
AddRecs so that it checks for overflow in the computation that it is
performing, rather than just checking hasNo{Signed,Unsigned}Wrap, since
those flags are for a different computation. This fixes a bug that
impacts an upcoming change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101028 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5ee60f75087021ab02fa72535593d598c3afe5e2 12-Apr-2010 Dan Gohman <gohman@apple.com> Fix indentation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101001 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
53c66eacc417c0113fba7159487b90005dc8f91e 12-Apr-2010 Dan Gohman <gohman@apple.com> Enhance ScalarEvolution::isKnownPredicate with support for
loop conditions which are invariants.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100995 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b64cf896f8c6648b2c2bce15107d2892b909f367 12-Apr-2010 Dan Gohman <gohman@apple.com> Minor code simplification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
bc7129f9dbc6651407134e80a4202adc2ef2511c 12-Apr-2010 Dan Gohman <gohman@apple.com> When creating a ConstantRange for [n,UINT_MAX], special case n == 0, because
ConstantRange(0, 0) creates an empty range rather than a full one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100993 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3948d0b8b0a71fabf25fceba1858b2b6a60d3d00 11-Apr-2010 Dan Gohman <gohman@apple.com> Rename isLoopGuardedByCond to isLoopEntryGuardedByCond, to emphasise
that it's only testing for the entry condition, not full loop-invariant
conditions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100979 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e05678132345eb8a632362dbd320ee7d36226e67 09-Apr-2010 Dan Gohman <gohman@apple.com> Add variants of ult, ule, etc. which take a uint64_t RHS, for convenience.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100824 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8ef5caa80a5f40ba34d02f32f6ba4b4601268f89 08-Apr-2010 Dan Gohman <gohman@apple.com> Revert this change from a while ago; ScalarEvolution shouldn't analyze
undef as 0, since it can't force other analyses to intepret the undef
in the same way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100749 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9553188fccbf0ae9c5b6bef26d0d2bd5feff8b59 18-Mar-2010 Dan Gohman <gohman@apple.com> Define placement new wrappers for BumpPtrAllocator and
RecyclingAllocator to allow client code to be simpler, and
simplify several clients.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98847 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c93b4cff89d85a13d4eaf1551af9fab276b88450 18-Mar-2010 Dan Gohman <gohman@apple.com> Add the ability to "intern" FoldingSetNodeID data into a
BumpPtrAllocator-allocated region to allow it to be stored in a more
compact form and to avoid the need for a non-trivial destructor call.

Use this new mechanism in ScalarEvolution instead of
FastFoldingSetNode to avoid leaking memory in the case where a
FoldingSetNodeID uses heap storage, and to reduce overall memory
usage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98829 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f9e64729afec646fe93b51417e66e552e8e630a4 18-Mar-2010 Dan Gohman <gohman@apple.com> Reapply r98755 with a thinko which miscompiled gengtype fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98793 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ebf78f18df84a63295c748148f54f091234ed099 17-Mar-2010 Dan Gohman <gohman@apple.com> Revert 98755, which may be causing trouble.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98762 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0afc29c3e6ba240ee187fd34ba1ecbe1175c879e 17-Mar-2010 Dan Gohman <gohman@apple.com> Change SCEVNAryExpr's operand array from a SmallVector to a plain
pointer and length, and allocate the arrays in ScalarEvolution's
BumpPtrAllocator, so that they get released when their owning
SCEV gets released. SCEVs are immutable, so they don't need to worry
about operand array resizing. This fixes a memory leak reported
in PR6637.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98755 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4ecbca558f8ee558dd0e84e079f16528fd9768f2 10-Mar-2010 Dan Gohman <gohman@apple.com> Avoid analyzing instructions in blocks not reachable from the entry block.
They are lots of trouble, and they don't matter. This fixes PR6559.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98103 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3f46a3abeedba8d517b4182de34c821d752db058 01-Mar-2010 Dan Gohman <gohman@apple.com> Spelling fixes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97453 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
85669637139089eaed8def1583ac04266c9654e2 25-Feb-2010 Dan Gohman <gohman@apple.com> Make LoopSimplify change conditional branches in loop exiting blocks
which branch on undef to branch on a boolean constant for the edge
exiting the loop. This helps ScalarEvolution compute trip counts for
loops.

Teach ScalarEvolution to recognize single-value PHIs, when safe, and
ForgetSymbolicName to forget such single-value PHI nodes as apprpriate
in ForgetSymbolicName.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97126 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e177c9a9bcd84ca654427b869900c858a9a48e1a 24-Feb-2010 Dan Gohman <gohman@apple.com> ConstantFoldInstOperands can theoretically return null if it
didn't fold anything.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97049 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8f767d987f5603b024054095beb75a87a8476757 24-Feb-2010 Dan Gohman <gohman@apple.com> Simplify this code; these casts aren't necessary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97048 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f6d009fb6fc19d9f7ee7cdc528bf8e83a758facc 24-Feb-2010 Dan Gohman <gohman@apple.com> Convert a few more backedge-taken count functions to use BackedgeTakenInfo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
454d26dc43207ec537d843229db6f5e6a302e23d 22-Feb-2010 Dan Gohman <gohman@apple.com> Remove unused variables and parameters.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96780 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
bc02853b8995b9c6402096912cd551f676679659 19-Feb-2010 Dan Gohman <gohman@apple.com> Add a comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96688 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
00cb5b724547a821516292fe5cded7c6a5358bda 19-Feb-2010 Dan Gohman <gohman@apple.com> Teach ScalarEvolution how to compute a tripcount for a loop with
true or false as its exit condition. These are usually eliminated by
SimplifyCFG, but the may be left around during a pass which wishes
to preserve the CFG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96683 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
45a2d7d44ae697e28df383d31455145fb754ac58 19-Feb-2010 Dale Johannesen <dalej@apple.com> recommit 96626, evidence that it broke things appears
to be spurious



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96662 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
efd9e9505167a398ba3c4924b09a47bd4d688e51 19-Feb-2010 Dale Johannesen <dalej@apple.com> Revert 96626, which causes build failure on ppc Darwin.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96653 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
aa11defd1c66dbde0c757c99791c4ae4d740fc3e 19-Feb-2010 Dan Gohman <gohman@apple.com> Indvars needs to explicitly notify ScalarEvolution when it is replacing
a loop exit value, so that if a loop gets deleted, ScalarEvolution
isn't stick holding on to dangling SCEVAddRecExprs for that loop. This
fixes PR6339.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96626 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1df9859c40492511b8aa4321eb76496005d3b75b 16-Feb-2010 Duncan Sands <baldrick@free.fr> There are two ways of checking for a given type, for example isa<PointerType>(T)
and T->isPointerTy(). Convert most instances of the first form to the second form.
Requested by Chris.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b0bc6c361da9009e8414efde317d9bbff755f6c0 15-Feb-2010 Duncan Sands <baldrick@free.fr> Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96223 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
50922bbe74cf7a22ecb1849014b7c5d9e3580a20 15-Feb-2010 Dan Gohman <gohman@apple.com> When testing whether a given SCEV depends on a temporary symbolic
name, test whether the SCEV itself is that temporary symbolic name,
in addition to checking whether the symbolic name appears as a
possibly-indirect operand.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96216 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
39125d8ef94cbadccd7339d3344e114dedaab12c 13-Feb-2010 Dan Gohman <gohman@apple.com> Override dominates and properlyDominates for SCEVAddRecExpr, as a
SCEVAddRecExpr doesn't necessarily dominate blocks merely dominated
by all of its operands. This fixes an abort compiling 403.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96056 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f451cb870efcf9e0302d25ed05f4cac6bb494e42 10-Feb-2010 Dan Gohman <gohman@apple.com> Fix "the the" and similar typos.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
32efba698df6aa35335eeb44d89288352d04746d 04-Feb-2010 Dan Gohman <gohman@apple.com> Change the argument to getIntegerSCEV to be an int64_t, rather
than int. This will make it more convenient for LSR, which does
a lot of things with int64_t offsets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95281 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8db08df5d3668e92cf4ba6f35743464c42fa986f 02-Feb-2010 Dan Gohman <gohman@apple.com> Various code simplifications.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95044 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4f8eea82d8967cffa85b9df6c9255717b059009e 01-Feb-2010 Dan Gohman <gohman@apple.com> Generalize target-independent folding rules for sizeof to handle more
cases, and implement target-independent folding rules for alignof and
offsetof. Also, reassociate reassociative operators when it leads to
more folding.

Generalize ScalarEvolution's isOffsetOf to recognize offsetof on
arrays. Rename getAllocSizeExpr to getSizeOfExpr, and getFieldOffsetExpr
to getOffsetOfExpr, for consistency with analagous ConstantExpr routines.

Make the target-dependent folder promote GEP array indices to
pointer-sized integers, to make implicit casting explicit and exposed
to subsequent folding.

And add a bunch of testcases for this new functionality, and a bunch
of related existing functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94987 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0f5efe56258f8cd6ceff4d7955a5d80144cd9cb0 28-Jan-2010 Dan Gohman <gohman@apple.com> Remove SCEVAllocSizeExpr and SCEVFieldOffsetExpr, and in their place
use plain SCEVUnknowns with ConstantExpr::getSizeOf and
ConstantExpr::getOffsetOf constants. This eliminates a bunch of
special-case code.

Also add code for pattern-matching these expressions, for clients that
want to recognize them.

Move ScalarEvolution's logic for expanding array and vector sizeof
expressions into an element count times the element size, to expose
the multiplication to subsequent folding, into the regular constant
folder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94737 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c9c36cb3d97e2aeb86b35e0ba168769d06f6f058 26-Jan-2010 Dan Gohman <gohman@apple.com> Make the unsigned-range code more consistent with the signed-range code,
and clean up some loose ends.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
155eec7fa9f39e02ffcdfb2fd646680bf20f4047 26-Jan-2010 Dan Gohman <gohman@apple.com> Fix a typo in a comment that Duncan noticed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94562 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
93dacadb4672c2054a8b8e77be4d721c6bda52e8 26-Jan-2010 Dan Gohman <gohman@apple.com> Rename ItCount to BECount, since it holds a backedge-taken count rather
than an iteration count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94549 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
52fddd3e36a9a78767decb0a0f7aa4071dcdbbdf 26-Jan-2010 Dan Gohman <gohman@apple.com> Fix the the ceiling-division used in computing the MaxBECount so that it doesn't
have trouble with an intermediate add overflowing. Also, be more conservative
about the case where the induction variable in an SLT loop exit can step past
the RHS of the SLT and overflow in a single step.

Make getSignedRange more aggressive, to recover for some common cases which
the above fixes pessimized.

This addresses rdar://7561161.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94512 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a10756ee657a4d43a48cca5c166919093930ed6b 21-Jan-2010 Dan Gohman <gohman@apple.com> Re-implement the main strength-reduction portion of LoopStrengthReduction.
This new version is much more aggressive about doing "full" reduction in
cases where it reduces register pressure, and also more aggressive about
rewriting induction variables to count down (or up) to zero when doing so
reduces register pressure.

It currently uses fairly simplistic algorithms for finding reuse
opportunities, but it introduces a new framework allows it to combine
multiple strategies at once to form hybrid solutions, instead of doing
all full-reduction or all base+index.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94061 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
67847538148ed956aaa14a07a77902fb991445f2 19-Jan-2010 Dan Gohman <gohman@apple.com> Add a comment and tidy up some whitespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93932 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1cd9275c8d612bd1c92fc7ba436b60aaead1efbf 19-Jan-2010 Dan Gohman <gohman@apple.com> Give ScalarEvolution access to the DominatorTree. It'll need this
to make more intellegent AddRec folding decisions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93930 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3073329c532aab96b58a322f2ac8bf93abefc60e 09-Jan-2010 Dan Gohman <gohman@apple.com> Use WriteAsOperand instead of getName() to print loop header names,
so that unnamed blocks are handled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93059 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
63c9463c62fce8cbe02176dfa2d73f375a06f1f2 23-Dec-2009 David Greene <greened@obbligato.org> Remove dump routine and the associated Debug.h from a header. Patch up
other files to compensate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92075 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
25e0e87f8519914ea8f755a1a131d30655f5a174 23-Dec-2009 David Greene <greened@obbligato.org> Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92067 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
355b4f3c199990feb0e8a1d50e3bbc159eca7e7b 19-Dec-2009 Dan Gohman <gohman@apple.com> Fix a spello in a comment that Nick spotted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91742 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
28680d33eeafba7bf0e935200e20360c7dc27bde 19-Dec-2009 Dan Gohman <gohman@apple.com> Make this comment more precise.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
59de33ef3934eb98f0c5dfbfb2c56fb4b80bda56 18-Dec-2009 Dan Gohman <gohman@apple.com> Revert this use of NUW/NSW also. Overflow-undefined multiplication isn't
associative either.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91701 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3a5d409f3c2eccf1d1f0a4616023760829a4db67 18-Dec-2009 Dan Gohman <gohman@apple.com> Revert this use of NSW; this one isn't actually safe. NSW addition
is not reassociative.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2df72c144164cbb06e505f3af506e1bb69053e73 18-Dec-2009 Dan Gohman <gohman@apple.com> Delete an unused variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91659 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d281ed2d03654b9cdb290a2d7c73dfe7b826e554 18-Dec-2009 Dan Gohman <gohman@apple.com> Preserve NSW information in more places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91656 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
92329c7fbe572892c17aa2d2542a10e3ea16132f 18-Dec-2009 Dan Gohman <gohman@apple.com> Add Loop contains utility methods for testing whether a loop
contains another loop, or an instruction. The loop form is
substantially more efficient on large loops than the typical
code it replaces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91654 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5d984917a4408cce585c8786fc813b1d0d9fa920 18-Dec-2009 Dan Gohman <gohman@apple.com> Whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91651 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c6501b13c0ffc9b0a01bb1d8771afa70afa59281 23-Nov-2009 Nick Lewycky <nicholas@mxc.ca> Remove dead LLVMContext argument.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89641 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1ba3b6c5654ac6c0cf6ff278e0130c6f2f5ef97d 10-Nov-2009 Dan Gohman <gohman@apple.com> Pass the (optional) TargetData object to ConstantFoldInstOperands
and ConstantFoldCompareInstOperands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86626 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8f73deaa8732a556046bf4ac6207be55972e3b74 10-Nov-2009 Chris Lattner <sabre@nondot.org> fix ConstantFoldCompareInstOperands to take the LHS/RHS as
individual operands instead of taking a temporary array


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7b550ccfc5a3346c17e0390a59e2d6d19bc52705 06-Nov-2009 Chris Lattner <sabre@nondot.org> remove a bunch of extraneous LLVMContext arguments
from various APIs, addressing PR5325.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86231 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
076124ef26ff67f88663bd11f3b4d6b3d3bb3a9d 01-Nov-2009 Douglas Gregor <dgregor@apple.com> Reverting 85714, 85715, 85716, which are breaking the build

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2166f6229042a4d3d65847ebe0d453cd664682ef 01-Nov-2009 Dan Gohman <gohman@apple.com> Add a function to Passes.h to allow clients to create instances
of the ScalarEvolution pass without needing to #include ScalarEvolution.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85716 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4c7279ac726e338400626fca5a09b5533426eb6a 31-Oct-2009 Dan Gohman <gohman@apple.com> Rename forgetLoopBackedgeTakenCount to forgetLoop, because it
clears out more information than just the stored backedge taken count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85664 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f5a86f45e75ec744c203270ffa03659eb0a220c1 25-Oct-2009 Nick Lewycky <nicholas@mxc.ca> Remove includes of Support/Compiler.h that are no longer needed after the
VISIBILITY_HIDDEN removal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6726b6d75a8b679068a58cb954ba97cf9d1690ba 25-Oct-2009 Nick Lewycky <nicholas@mxc.ca> Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.
Chris claims we should never have visibility_hidden inside any .cpp file but
that's still not true even after this commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7a721956f886d465f920d06bebb64c0f0b328c39 09-Oct-2009 Dan Gohman <gohman@apple.com> Revert r83606 and add comments explaining why it isn't safe.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83649 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4db3581a288dcd7e56f0a1ecdc2316cd85e183c7 09-Oct-2009 Dan Gohman <gohman@apple.com> Preserve HasNSW and HasNUW when constructing SCEVs for Add and Mul
instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83606 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3645b01002e7ac244c1f3d163e5e350df21d869d 09-Oct-2009 Dan Gohman <gohman@apple.com> Add the ability to track HasNSW and HasNUW on more kinds of SCEV expressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83601 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6e70e31810464289a9e9b37e0345847e3ca5d5cf 27-Sep-2009 Dan Gohman <gohman@apple.com> Add a properlyDominates member function to ScalarEvolution.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82898 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1f96e67f78110d0ac5b30a32375097a28f869c63 17-Sep-2009 Dan Gohman <gohman@apple.com> Teach ScalarEvolution how to reason about no-wrap flags on loops
where the induction variable has a non-unit stride, such as {0,+,2}, and
there are expressions such as {1,+,2} inside the loop formed with
or or add nsw operators.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82151 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e7125f4babb536df3a2573b6166954da7753c6b8 03-Sep-2009 Dan Gohman <gohman@apple.com> Remove references to expression "handles", which are no longer used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80918 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a5505cb9c992cb4bde5656fb6bd14d89b8f1a744 31-Aug-2009 Dan Gohman <gohman@apple.com> Don't use an iterator which is potentially invalidated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
42214899082bfb5b6f8c6a09d355fec9ef4a0e82 31-Aug-2009 Dan Gohman <gohman@apple.com> Extend the ValuesAtScope cache to cover all expressions, not just
SCEVUnknowns, as the non-SCEVUnknown cases in the getSCEVAtScope code
can also end up repeatedly climing through the same expression trees,
which can be unusably slow when the trees are very tall.

Also, add a quick check for SCEV pointer equality to the main
SCEV comparison routine, as the full comparison code can be expensive
in the case of large expression trees.

These fix compile-time problems in some pathlogical cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80623 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
041de42d42f67ab6bb3d012805621e5b7adcc7d9 25-Aug-2009 Dan Gohman <gohman@apple.com> Don't assume that two identical instructions that read from memory
will always return the same value. This isn't currently necessary,
since this code doesn't currently ever get called under circumstances
where it would matter, but it may some day.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
26812320b7bf27fe50e8bf51623a560f0eba449b 25-Aug-2009 Dan Gohman <gohman@apple.com> Teach ScalarEvolution about GlobalAliases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80014 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9661c13c37d017df6f91a399c0160b82e8a6c39f 24-Aug-2009 Chris Lattner <sabre@nondot.org> remove a few dead insertion methods.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79882 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
45cfe545ec8177262dabc70580ce05feaa1c3880 23-Aug-2009 Chris Lattner <sabre@nondot.org> Change Pass::print to take a raw ostream instead of std::ostream,
update all code that this affects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79830 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5078f84c82814e4d33846f9ef54281619d362f8a 20-Aug-2009 Dan Gohman <gohman@apple.com> Rename hasNoUnsignedOverflow and hasNoSignedOverflow to hasNoUnsignedWrap
and hasNoSignedWrap, for consistency with the nuw and nsw properties.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79539 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4c0d5d5db876b0628bdf6a2174263a1c0a9130e2 20-Aug-2009 Dan Gohman <gohman@apple.com> Various comment and whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79533 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8255573835970e7130ba93271972172fb335f2ec 19-Aug-2009 Dan Gohman <gohman@apple.com> Use hasDefinitiveInitializer() instead of testing the same thing
by hand, and fix a few places that were using hasInitializer() that
appear to depend on the initializer value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79441 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c40f17b08774c2dcc5787fd83241e3c64ba82974 18-Aug-2009 Dan Gohman <gohman@apple.com> Generalize ScalarEvolution to be able to analyze GEPs when
TargetData is not present. It still uses TargetData when available.
This generalization also fixed some limitations in the TargetData
case; the attached testcase covers this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1d0be15f89cb5056e20e2d24faa8d6afb1573bca 13-Aug-2009 Owen Anderson <resistor@mac.com> Push LLVMContexts through the IntegerType APIs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78948 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8a11c98b1d569c87183e0f94ffd8604b9659d3ac 08-Aug-2009 Andreas Bolka <a@bolka.at> Fix copy-pasto.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78426 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a7235ea7245028a0723e8ab7fd011386b3900777 31-Jul-2009 Owen Anderson <resistor@mac.com> Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
debcb01b0f0a15f568ca69e8f288fade4bfc7297 30-Jul-2009 Owen Anderson <resistor@mac.com> Move types back to the 2.5 API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77516 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
baf3c404409d5e47b13984a7f95bfbd6d1f2e79e 29-Jul-2009 Owen Anderson <resistor@mac.com> Move ConstantExpr to 2.5 API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77494 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
07ad19b509530b43e6a9acc5c1285cb560dd7198 27-Jul-2009 Dan Gohman <gohman@apple.com> Fix wording in comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77193 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
bc3d77a0df8f863956cd681131b7258e91ba6ce8 25-Jul-2009 Dan Gohman <gohman@apple.com> SCEV objects are no longer reference-counted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77080 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
19378d622eebdf94a582555076eab7ba8d5c20ea 25-Jul-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
eb490a7aa34c873b1bc401eb2c45a4d71a62be37 25-Jul-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
fef8bb24de86ff41d09a7787c6c52b058a853e39 25-Jul-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
eed707b1e6097aac2bb6b3d47271f6300ace7f2e 25-Jul-2009 Owen Anderson <resistor@mac.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d1e5db6c7c718edaa0c44e4a758f2cd4f62cdd68 24-Jul-2009 Dan Gohman <gohman@apple.com> Fix whitespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76929 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e922c0201916e0b980ab3cfe91e1413e68d55647 22-Jul-2009 Owen Anderson <resistor@mac.com> Get rid of the Pass+Context magic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76702 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0f4b285a5b86b1e9c6e27bb46028dfbb77bb5db4 22-Jul-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a16b5764e3a39d37178864592d7bf7c483676079 21-Jul-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c2b015e4c0151ca7144438afd98e6f7091656e5d 21-Jul-2009 Dan Gohman <gohman@apple.com> Whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76523 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c268e7c51ef8149a98e64b64b6e51e486043ab6b 21-Jul-2009 Dan Gohman <gohman@apple.com> Minor code simplification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76521 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f117ed462c17bcebe7a0f420885e2d7d55465912 21-Jul-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4500e9eb803616416dc1c8bbc8a7f230c2a0bff2 21-Jul-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0d5bae41fb86188d62dbc39de629ae0de71f93e0 21-Jul-2009 Dan Gohman <gohman@apple.com> Minor code simplification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76496 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
746f3b1a9ba22d9b9622240814899417941d2480 21-Jul-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f2411744214dad8c71044aac2977ca77e9ebf028 20-Jul-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ca178908c8dc2303a1fb54a8a93bab0f0b964e11 17-Jul-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
001dbfebcbbded8c8e74b19e838b50da2b6c6fb5 16-Jul-2009 Owen Anderson <resistor@mac.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
850f791abc3ffc3f5fb73712df2f4a2d4cc0b998 16-Jul-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9adc0abad3c3ed40a268ccbcee0c74cb9e1359fe 15-Jul-2009 Owen Anderson <resistor@mac.com> Move EVER MORE stuff over to LLVMContext.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75703 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c23197a26f34f559ea9797de51e187087c039c42 14-Jul-2009 Torok Edwin <edwintorok@gmail.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
69fcae91a4c46af5c13be1618c7592e95597b327 14-Jul-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a653fc5f6bdfa016ba703c9b6d520b697c987517 14-Jul-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
385396221bc244d6592a60133c55874ff57571ac 14-Jul-2009 Owen Anderson <resistor@mac.com> Move more functionality over to LLVMContext.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75559 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c902e136d1f15f54d215f853a4a378531fc601e5 14-Jul-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ddf9f99a9face1bdfc51a5107508a64432d86ad1 14-Jul-2009 Dan Gohman <gohman@apple.com> Fix a few assertion strings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75530 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f5074ec9634d51472bc6e2114deea0afb6677dd8 14-Jul-2009 Dan Gohman <gohman@apple.com> Whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75525 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ba70188f895647f0a56bd69717ec3a0f7ed717df 14-Jul-2009 Dan Gohman <gohman@apple.com> Fix an 80-column violation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75524 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
85b05a2e60e0e696739167b52cc7cc3e7cf390c0 13-Jul-2009 Dan Gohman <gohman@apple.com> Reapply 75252, with a fix to avoid the infinite recursion case. The
check for avoiding re-analyzing a widening cast needed to happen
earlier, as getSCEV itself may result in a isLoopGuardedByCond query.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75511 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
73c6b7127aff4499e4d6a2edb219685aee178ee1 13-Jul-2009 Owen Anderson <resistor@mac.com> Move more functionality over to LLVMContext.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75497 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
69fbc7f477c21ce1d8ae5a4aa8a701e47aa2d163 13-Jul-2009 Dan Gohman <gohman@apple.com> Move the memoization check for SCEVSignExtendExpr and
SCEVZeroExtendExpr ahead of the most expensive analysis. This
speeds up analysis and helps avoid pathologically bad behavior
on the testcase in PR4534.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75496 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c050fd94c29e31414591e3a18aa20049e6b3a84f 13-Jul-2009 Dan Gohman <gohman@apple.com> Convert SCEV from FoldingSetNode to FastFoldingSetNode. This eliminates
a bunch of redundent code in Profile methods, and prepares for upcoming
changes to do improved memoization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75494 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0a5372ed3e8cda10d724feda3c1a1c998db05ca0 13-Jul-2009 Owen Anderson <resistor@mac.com> Begin the painful process of tearing apart the rat'ss nest that is Constants.cpp and ConstantFold.cpp.
This involves temporarily hard wiring some parts to use the global context. This isn't ideal, but it's
the only way I could figure out to make this process vaguely incremental.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75445 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d0cca2415099e80bd11e6b2090896719b07afd93 11-Jul-2009 Nick Lewycky <nicholas@mxc.ca> Revert r75252 which was causing some crashes at compile time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75384 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c25e7581b9b8088910da31702d4ca21c4734c6d7 11-Jul-2009 Torok Edwin <edwintorok@gmail.com> assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75379 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1afdc5f3565f09d33de888fede895540059dca4c 10-Jul-2009 Dan Gohman <gohman@apple.com> Remove ScalarEvolution::hasSCEV, which isn't being used, and which
breaks encapsulation. Also remove a dead prototype for setSCEV.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75272 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1b342583f6fc42f548912632f6aa24fc6e11986a 10-Jul-2009 Dan Gohman <gohman@apple.com> Generalize ScalarEvolution's cast-folding code to support more kinds
of loops. Add several new functions to for working with ScalarEvolution's
add-hoc value-range analysis functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75252 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
59ae6b99872953761dfda5984801d23a66692673 08-Jul-2009 Dan Gohman <gohman@apple.com> Make the code that updates ScalarEvolution's internal state in response
to a loop deletion more thorough. Don't prune the def-use tree search at
instructions that don't have SCEVs computed, because an instruction with
a user that has a computed SCEV may itself lack a computed SCEV. Also,
remove loop-related values from the ValuesAtScopes and
ConstantEvolutionLoopExitValues maps as well.

This fixes a regression in 483.xalancbmk.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75030 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0bba49cebc50c7bd4662a4807bcb3ee7f42cb470 07-Jul-2009 Dan Gohman <gohman@apple.com> Change all SCEV* to SCEV *.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74918 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
07cf79ef537caff6d39145f190a28a336e629b6f 07-Jul-2009 Owen Anderson <resistor@mac.com> "LLVMContext* " --> "LLVMContext *"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74878 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
76f600b205606a055ec35e7d3fd1a99602329d67 07-Jul-2009 Owen Anderson <resistor@mac.com> Finish LLVMContext-ing lib/Analysis. This required pushing LLVMContext's through the ValueTracking API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74873 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
508955156a25a9abc470a29e1760aa176d341cf9 06-Jul-2009 Owen Anderson <resistor@mac.com> Thread LLVMContext through the constant folding APIs, which touches a lot of files.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74844 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d1ec98923e2eee1fb4e6cd1f91b80210f021e301 04-Jul-2009 Nick Lewycky <nicholas@mxc.ca> When comparing constants, consider a less wide constant to be "less complex"
than a wider one, before trying to compare their contents which will crash
if their sizes are different.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74792 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c39f44b521eaa05804f55d1f4b8c2a178953f3c6 30-Jun-2009 Dan Gohman <gohman@apple.com> Minor code cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74551 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
099879687f898bdad5d5ff4d74efe0c2e5e284d1 29-Jun-2009 Dan Gohman <gohman@apple.com> Use getSCEV instead of getUnknown to create a SCEV for a
Constant. This lets ConstantInts be handled as SCEVConstant instead
of SCEVUnknown, as getUnknown no longer has special-case code for
ConstantInt and friends. This usually doesn't affect the final
output, since the constants end up getting folded later, but it
does make intermediate expressions more obvious in many cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
cffddcd72620d76e160c25780277c26d6792ca2c 29-Jun-2009 Dan Gohman <gohman@apple.com> Don't cache PHI exit values from exhaustive evaluations, because
an individual exhaustive evaluation reflects only the exit value
implied by an individual exit, which may differ from the actual
exit value of the loop if there are other exits. This fixes PR4477.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74447 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
23737e04235b6cab4c51546887397a9e53bf757c 29-Jun-2009 Dan Gohman <gohman@apple.com> Simplify this code, and avoid using APInt(). This fixes
(otherwise harmless) uninitialized value warnings that
Duncan found with gcc-4.4.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74437 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1c34375f79b7786351c27ae45f0412cfdfa004ed 27-Jun-2009 Dan Gohman <gohman@apple.com> Convert ScalarEvolution to use BumpPtrAllocator and FoldingSet, instead
of a team of individual allocations and a team of std::maps.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74393 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9a80b459ed5c6c55f4e20e443e86c459e89170c9 27-Jun-2009 Dan Gohman <gohman@apple.com> Fix ScalarEvolution::getAddRecExpr's code which canonicalized the
nesting order of nested AddRec expressions to skip the transformation
if it would introduce an AddRec with operands not loop-invariant
with respect to its loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74343 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e890eead222abf84fc171b28891a68b65e9addf5 27-Jun-2009 Dan Gohman <gohman@apple.com> Fix SCEVAddRecExpr::isLoopInvariant to test if all of its operands
are loop invariant, not just the start operand.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9311ef6a916cb5d95056842b26848fd56bcc0ebc 24-Jun-2009 Dan Gohman <gohman@apple.com> Minor whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74074 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e5aceed168799af9c109308e84c4845aa6fbe77a 24-Jun-2009 Dan Gohman <gohman@apple.com> Simplify [su]max(MAX, n) to MAX. This comes up in loop tripcount
computations in loops with multiple exits.

Adjust the testcase for PR4436 so that the relevant portion isn't
optimized away.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74073 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
64a845e8361b7f27dc06b069ecd71c83927a654f 24-Jun-2009 Dan Gohman <gohman@apple.com> Delete some orphaned comments, fix some 80-column violations,
and tidy up a few other formatting issues.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74060 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
40a5a1b39ee1cd40ff9d04740386b667fb27b340 24-Jun-2009 Dan Gohman <gohman@apple.com> Extend ScalarEvolution's multiple-exit support to compute exact
trip counts in more cases.

Generalize ScalarEvolution's isLoopGuardedByCond code to recognize
And and Or conditions, splitting the code out into an
isNecessaryCond helper function so that it can evaluate Ands and Ors
recursively, and make SCEVExpander be much more aggressive about
hoisting instructions out of loops.

test/CodeGen/X86/pr3495.ll has an additional instruction now, but
it appears to be due to an arbitrary register allocation difference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74048 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
62849c065ebfd214298e3fcb0028422d24af68bb 24-Jun-2009 Dan Gohman <gohman@apple.com> Teach GetMinSignBits about SCEVAddExprs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6bbcba18db6d1f4bc0f0157df41cc02627bc4aa9 24-Jun-2009 Dan Gohman <gohman@apple.com> Move the special cases for constants out of getUnknown and into
createSCEV. Also, recognize UndefValue in createSCEV.

Change getIntegerSCEV's comment to avoid mentioning FP types,
and re-implement it in terms of getConstant instead of getUnknown.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74041 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b8be8b70a2789f1ccb12ce4e68e54e5992d7e5a0 24-Jun-2009 Dan Gohman <gohman@apple.com> Use ScalarEvolution::getConstant instead of getUnknown to create
SCEVConstants. This cleanup is a step toward letting getUnknown
be simpler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74037 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
aa551ae10e0cac338a9fa1ff9e20571eae07aac2 24-Jun-2009 Dan Gohman <gohman@apple.com> Include the maximum trip count expression in ScalarEvolution's print output.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74035 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4d289bf4af88759be173a1a809bf8c092d729764 24-Jun-2009 Dan Gohman <gohman@apple.com> Add an isAllOnesValue utility function, similar to isZero and isOne.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74032 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
91380b7239a3d09236b6fab64ba31b7ce0e0cb13 23-Jun-2009 Dan Gohman <gohman@apple.com> Fix a bug in the trip-count computation with And/Or. If either of the
sides is CouldNotCompute, the resulting exact count must be CouldNotCompute.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73920 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
753ad615f96c3d56d6f17983bdba88012e88677c 22-Jun-2009 Owen Anderson <resistor@mac.com> Remove the parent pointer from SCEV, since it did not end up being needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73907 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
372b46cad9f745859f542f9d2216991585ae83f4 22-Jun-2009 Owen Anderson <resistor@mac.com> SCEVHandle is no more!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73906 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d32f5bf22d175c7e176c626c66fd7de71c240b65 22-Jun-2009 Dan Gohman <gohman@apple.com> Fix some typos that Duncan noticed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73903 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
08367b61638b4d446ebab69e2aad6431daa77ba7 22-Jun-2009 Owen Anderson <resistor@mac.com> Banish global state from ScalarEvolution! SCEV uniquing is now done by tables attached to the ScalarEvolution pass.
This also throws out the SCEV reference counting scheme, as the the SCEVs now have a lifetime controlled by the
ScalarEvolution pass.

Note that SCEVHandle is now a no-op, and will be remove in a future commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73892 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
60e9b0708a8ce3a7b7eaee9bdceebb2c712514e1 22-Jun-2009 Dan Gohman <gohman@apple.com> Make use of getUMinFromMismatchedTypes when computing backedge-taken
counts for loops with multiple exits, replacing more conservative code
which only handled constants. This is derived from a patch by
Nick Lewycky.

This also fixes llc aborts in ClamAV and others, as
getUMinFromMismatchedTypes takes care of balancing the types before
working with them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c9759e80f45e5690c3ed3b69c2e9ffd5a1bffd9c 22-Jun-2009 Dan Gohman <gohman@apple.com> Add a getUMinFromMismatchedTypes helper function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73883 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f9a9a9928cc977970d9852292b1c139074ecf055 22-Jun-2009 Dan Gohman <gohman@apple.com> Factor out code for computing umin and smin for SCEV expressions into
helper functions. Based on a patch by Nick Lewycky.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a334aa7a106d5ebb971862f25daaadad48d96235 22-Jun-2009 Dan Gohman <gohman@apple.com> Teach ScalarEvolution how to analyze loops with multiple exit
blocks, and also exit blocks with multiple conditions (combined
with (bitwise) ands and ors). It's often infeasible to compute an
exact trip count in such cases, but a useful upper bound can often
be found.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
743ab498d8cc4e828c79a68a6184eb8aeb95b4a1 22-Jun-2009 Dan Gohman <gohman@apple.com> Delete an unused variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73865 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
51f53b7f5a0e859ceef995c61667905166b96f1b 22-Jun-2009 Dan Gohman <gohman@apple.com> Fix ScalarEvolution's backedge-taken count computations to check for
overflow when computing a integer division to round up.

Thanks to Nick Lewycky for noticing this!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73862 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
763bad1a2b2c913fe1f3489d6ab450762a1aa5e3 20-Jun-2009 Dan Gohman <gohman@apple.com> Generalize isLoopGuardedByCond's checking to consider two
SCEVUnknowns with identical Instructions to be equal. This allows
it to analze cases such as the attached testcase, where the front-end
has cloned the loop controlling expression. Along with r73805, this
lets IndVarSimplify eliminate all the sign-extend casts in the
loop in the attached testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73807 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3964acc2f44ee02cdd4e2a54a5232537bdf3ee73 20-Jun-2009 Dan Gohman <gohman@apple.com> Use ScalarEvolution's new GetMinSignBits and GetMinLeadingZeros
in the loop backedge-taken count computation of the maximum
possible trip count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73805 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2c364ad4a65737f3bda876f86eba0061ecbd5470 20-Jun-2009 Dan Gohman <gohman@apple.com> Make GetMinTrailingZeros a member function of ScalarEvolution,
so that it can access the TargetData member (when available) and
use ValueTracking.h information to compute information for
SCEVUnknown Values.

Also add GetMinLeadingZeros and GetMinSignBits functions,
with minimal implementations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73794 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0c689c5e051228616e301d54a8ea11ebee5caa4a 19-Jun-2009 Dan Gohman <gohman@apple.com> Make ScalarEvolution::print print getSCEVAtScope values for
expressions, when interesting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4a7893b4527819aae229f539ab9c3eeecc6a10e2 19-Jun-2009 Owen Anderson <resistor@mac.com> Add a parent pointer to SCEV, in preparation for getting rid of the global uniquing tables. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73728 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
30fb512e95f6a01f0c9c3426c2263ee0458de8e8 18-Jun-2009 Dan Gohman <gohman@apple.com> Recognize n != 0 ? n : 1 as umax(n, 1). Previously only ULT/UGT/ULE/UGE
comparisons were recognized for umax, but instcombine canonicalizes
unsigned comparisons with zero to this simpler form.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6864db6fac4b9e0c857966e529961c0f31da5814 18-Jun-2009 Dan Gohman <gohman@apple.com> Update a comment to reflect the code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73704 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9e7d9883b0fbbce54f19936d3d4c870b17b5a758 18-Jun-2009 Dan Gohman <gohman@apple.com> Fix trailing whitespace from ScalarEvolution::print.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73666 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
820528331fbcc0db2149edc0b143753665bc00bf 18-Jun-2009 Dan Gohman <gohman@apple.com> Teach ScalarEvolution how to recognize another xor(and(x, C), C) case.
If C is a single bit and the and gets analyzed as a truncate and
zero-extend, the xor can be represnted as an add.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73664 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
fc3641b07a95f649424ee5009a4bed001b5bea62 18-Jun-2009 Dan Gohman <gohman@apple.com> Delete unnecessary braces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73663 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3034c106753595f564d5852a2d4398f0acb16b32 17-Jun-2009 Dan Gohman <gohman@apple.com> Fix ScalarEvolution's Xor handling to not assume that an And
that gets recognized with a SCEVZeroExtendExpr must be an And
with a low-bits mask. With r73540, this is no longer the case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73594 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
61ffa8e37394faca53167b4bbeb3866404745f3a 16-Jun-2009 Dan Gohman <gohman@apple.com> Instcombine's ShrinkDemandedConstant may strip bits out of constants,
obscuring what would otherwise be a low-bits mask. Use ComputeMaskedBits
to compute what ShrinkDemandedConstant knew about to reconstruct a
low-bits mask value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73540 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6de29f8d960505421d61c80cdb738e16720b6c0e 16-Jun-2009 Dan Gohman <gohman@apple.com> Support vector casts in more places, fixing a variety of assertion
failures.

To support this, add some utility functions to Type to help support
vector/scalar-independent code. Change ConstantInt::get and
ConstantFP::get to support vector types, and add an overload to
ConstantInt::get that uses a static IntegerType type, for
convenience.

Introduce a new getConstant method for ScalarEvolution, to simplify
common use cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73431 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
bd59d7b603c364da52097f171a110a19c886f7bb 15-Jun-2009 Dan Gohman <gohman@apple.com> Implement more aggressive folding of add operand lists when
they contain multiplications of constants with add operations.
This helps simplify several kinds of things; in particular it
helps simplify expressions like ((-1 * (%a + %b)) + %a) to %b,
as expressions like this often come up in loop trip count
computations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73361 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7f7c4366ca61b3dceea4e37b187e5e1d4447e1b8 15-Jun-2009 Dan Gohman <gohman@apple.com> Check for the short-circuiting condition before performing
the potentially expensive erase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73359 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4dfad295475387211012f17bf640a9f8330872be 15-Jun-2009 Dan Gohman <gohman@apple.com> Do compare constant SCEV values in SCEVComplexityCompare, because
even though the order doesn't matter at the top level of an expression,
it does matter when the constant is a subexpression of an n-ary
expression, because n-ary expressions are sorted lexicographically.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73358 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a82752c9eb5fbdd1b7276fde7349ac9453eb5a75 15-Jun-2009 Dan Gohman <gohman@apple.com> Convert several parts of the ScalarEvolution framework to use
SmallVector instead of std::vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73357 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2ce84c8d4784dfd24458a63db8d531917d2f8ba5 13-Jun-2009 Dan Gohman <gohman@apple.com> Add a ScalarEvolution::getAnyExtendExpr utility function for performing
extension with unspecified bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73293 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
86fbf2fe4cae21febffa4bb2f64cd0c2ee834694 06-Jun-2009 Dan Gohman <gohman@apple.com> Rename UnknownValue to CouldNotCompute, since it holds an instance of
SCEVCouldNotCompute, and not SCEVUnknown.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72999 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5c06f61e577f2c10ea0e6dd78f568fe58910fbbe 06-Jun-2009 Devang Patel <dpatel@apple.com> Simplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72970 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c965ee223c6077250525048106726e12b59072ac 05-Jun-2009 Dan Gohman <gohman@apple.com> Remove some unnecessary #includes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72948 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
91bb61a1e2c96f727726c2fe7962df3e18ef5416 26-May-2009 Dan Gohman <gohman@apple.com> For the return type of SCEVUDivExpr, use the RHS' type instead of
that of the LHS. It doesn't matter for correctness, but the LHS
is more likely than the RHS to be a pointer type in exotic cases,
and it's more tidy to have it return the integer type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72424 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6c0866ca8373da318741cc90ad7afd1bda22bb1b 25-May-2009 Dan Gohman <gohman@apple.com> Various comment fixes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72376 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d594e6f0345b3e1e4b640a7099596ca613da16d6 25-May-2009 Dan Gohman <gohman@apple.com> Change ScalarEvolution::getSCEVAtScope to always return the original value
in the case where a loop exit value cannot be computed, instead of only in
some cases while using SCEVCouldNotCompute in others. This simplifies
getSCEVAtScope's callers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a3035a69f95734ff549f3e12d950bf65400329f7 20-May-2009 Dan Gohman <gohman@apple.com> Teach SCEV::isLoopInvariant and SCEV::hasComputableLoopEvolution
about the convention from LoopInfo that a null Loop* means the entire
function body.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72152 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1959b7562e57f8394496e761486f23b187ac3f1b 19-May-2009 Dan Gohman <gohman@apple.com> Make SCEVCallbackVH a private nested class inside ScalarEvolution, as
it's an implementation detail.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72122 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5be18e84766fb495b0bde3c8244c1df459a18683 19-May-2009 Dan Gohman <gohman@apple.com> Teach SCEVExpander to expand arithmetic involving pointers into GEP
instructions. It attempts to create high-level multi-operand GEPs,
though in cases where this isn't possible it falls back to casting
the pointer to i8* and emitting a GEP with that. Using GEP instructions
instead of ptrtoint+arithmetic+inttoptr helps pointer analyses that
don't use ScalarEvolution, such as BasicAliasAnalysis.

Also, make the AddrModeMatcher more aggressive in handling GEPs.
Previously it assumed that operand 0 of a GEP would require a register
in almost all cases. It now does extra checking and can do more
matching if operand 0 of the GEP is foldable. This fixes a problem
that was exposed by SCEVExpander using GEPs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72093 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8c562e2d25d319f8bde7a1a60142203f316a2883 18-May-2009 Daniel Dunbar <daniel@zuster.org> Silence Release-Asserts warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72011 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
10978bd5918689334d44cd30e5cfe06588b6014d 18-May-2009 Dan Gohman <gohman@apple.com> Teach ScalarEvolution to recognize x^-1 in the case where non-demanded
bits have been stripped out by instcombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72010 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0bac95e2e2044b574f3aea14a3fdb31c1b95240f 18-May-2009 Dan Gohman <gohman@apple.com> Delete a redundant 'else'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72009 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8ea94524ed4dee3238689f49f28e616fb183514c 18-May-2009 Dan Gohman <gohman@apple.com> Fix ScalarEvolution::isLoopGuardedByCond to accept a null Loop*, for
consistency with other routines that use a null Loop* to mean code
not contained by any loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72008 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5183caebc199afcdd26f544862c7117c96c2f150 18-May-2009 Dan Gohman <gohman@apple.com> Minor code cleanups. Do more of the work before the if statements
instead of within their controlling expressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72007 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f78a978d4674c5163663170d8d162479a96d014f 18-May-2009 Dan Gohman <gohman@apple.com> Add assertion checks to the SCEV operator creation methods to catch
type mismatches.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
859b4824eeb2d88c441e855afe3dd7827dfd62a4 18-May-2009 Dan Gohman <gohman@apple.com> Make ScalarEvolution::isLoopGuardedByCond work even when the edge
entering a loop is a non-split critical edge.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72004 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
70a1fe704831f9b842be0b2a2af5f7082b0e540c 18-May-2009 Dan Gohman <gohman@apple.com> Add an isOne() utility function to ScalarEvolution, similar to isZero()
and similar to ConstantInt's isOne().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
467c430316b7a5b6fa8069531ca8d603b1e1197f 13-May-2009 Dan Gohman <gohman@apple.com> Add three new helper routines, getNoopOrZeroExtend,
getNoopOrSignExtend, and getTruncateOrNoop. These are similar
to getTruncateOrZeroExtend etc., except that they assert that
the conversion is either not widening or narrowing, as
appropriate. These will be used in some upcoming fixes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
efb9fbfdab6cab88146792a5db79315313270c7f 12-May-2009 Dan Gohman <gohman@apple.com> When forgetting SCEVs for loop PHIs, don't forget SCEVUnknown values.
These values aren't analyzable, so they don't care if more information
about the loop trip count can be had. Also, SCEVUnknown is used for
a PHI while the PHI itself is being analyzed, so it needs to be left
in the Scalars map. This fixes a variety of subtle issues.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71533 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
42a5875e107a5dea72745574b0215d9bcdf6deb4 12-May-2009 Dan Gohman <gohman@apple.com> Fix GetMinTrailingZeros for SCEVSignExtend and SCEVZeroExtendExpr to
return the correct value when the cast operand is all zeros. This ought
to be pretty rare, because it would mean that the regular SCEV folding
routines missed a case, though there are cases they might legitimately
miss. Also, it's unlikely anything currently using GetMinTrailingZeros
cares about this case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71532 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
361e54d433e67db5d6b6455f7fd098de8c01f882 09-May-2009 Eli Friedman <eli.friedman@gmail.com> Allow scalar evolution to compute iteration counts for loops with a
pointer-based condition. This fixes PR3171.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71354 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
777d2306b36816a53bc1ae1244c0dc7d998ae691 09-May-2009 Duncan Sands <baldrick@free.fr> Rename PaddedSize to AllocSize, in the hope that this
will make it more obvious what it represents, and stop
it being confused with the StoreSize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71349 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c63a62735ba8b2e9011d48afde52e4c67df6f902 09-May-2009 Dan Gohman <gohman@apple.com> Don't attempt to handle unsized types in ScalarEvolution's GEP analyzer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71302 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b0285932ab915cacb5534ee4fccd18584c28ab56 09-May-2009 Dan Gohman <gohman@apple.com> Fix bogus overflow checks by replacing them with actual
overflow checks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71284 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
728c7f3059916fb0e0f98b4e9e45210fbd3f4340 08-May-2009 Dan Gohman <gohman@apple.com> Fold trunc casts into add-recurrence expressions, allowing the
add-recurrence to be exposed. Add a new SCEV folding rule to
help simplify expressions in the presence of these extra truncs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71264 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
fb791608115b5193419549b02825ed4337fd3a37 08-May-2009 Dan Gohman <gohman@apple.com> Fix another bug in r71252. This code supports GetElementPtr
constant exprs as well as instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71262 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6bce643c36e7263aada5058f08cd242b4ce6b87d 08-May-2009 Dan Gohman <gohman@apple.com> Add memoization for getSCEVAtScope results for instructions
which are not analyzed with SCEV techniques, which can require
brute-forcing through a large number of instructions. This
fixes a massive compile-time issue on 400.perlbench (in
particular, the loop in MD5Transform).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
66a7e857aa5843da3a7d0f52aa09a5935cf565dc 08-May-2009 Dan Gohman <gohman@apple.com> Make the SCEV* form of getSCEVAtScope public, to allow ScalarEvolution
clients to use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71258 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e810b0d430d989545094cfd080fcd8038f9b31a3 08-May-2009 Dan Gohman <gohman@apple.com> Fix an error from r71252.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71255 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
26466c0eb3451c5c953b3cca8940359152c4f8e3 08-May-2009 Dan Gohman <gohman@apple.com> Factor out the code for creating SCEVs for GEPs into a
separate function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71252 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
185cf0395c9d7d72ea12ce4d316a6cb2eab9115e 08-May-2009 Dan Gohman <gohman@apple.com> Implement several new SCEV folding rules for UDiv SCEVs.
This fixes an old FIXME, and is needed by some upcoming changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71247 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a6b35e201f4588e3321a6e754357a571461687b3 07-May-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
72861308d5fd60bc0d45a9683da054d4884980ee 07-May-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6ee2f3d840fd06f29aa3c5b64a5d0643fd02cef3 07-May-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ecb403a9d3a340009c266d05cfca2bd778c7b156 07-May-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0a8eb57c3d57a79f382b8db32059ea3689f7a076 07-May-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
35738ac150afafe2359268d4b2169498c6c98c5f 05-May-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
bf2176a00092540e18e8922487975cabefed8265 05-May-2009 Dan Gohman <gohman@apple.com> Fix an 80-column violation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70925 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
92fa56eb58cf8c5f1f076cb14e850f8373e56b9c 05-May-2009 Dan Gohman <gohman@apple.com> Fix doxygen comment syntax.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
622ed671b90d449496d582b3a03c7aad1e98324a 05-May-2009 Dan Gohman <gohman@apple.com> Constify a bunch of SCEV-using code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70919 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f9a77b77c2324b2ca5c644909ebda387daf82fe3 03-May-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
db6fa2964176c34f0e878e101427c28782c93419 02-May-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
fb7d35f22a958747dd3ae8861ae3ce018146131c 02-May-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9032b78c987d08b9e1dd25b6ab94b305e717832e 01-May-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
99243b38300a4cccb3ba23698be5faa5e12ee965 01-May-2009 Dan Gohman <gohman@apple.com> Fix an 80-column violation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70550 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
10b9479f555b27521062d1303ed43e11b69f7873 01-May-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e3d12854b810c3116a0cd9480f5aeb008ab06101 01-May-2009 Torok Edwin <edwintorok@gmail.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3d739fe3756bf67be23c2ca54ec7b04bef89bfe0 30-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a1af757e0af9c2fb5ade4b06408e1adfa0425c6c 30-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4acd12a0cbe6d1e478e13feefbc67c654e552e68 30-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d9c1c85c2acb6fb2003c6053ea1114e7aee68774 30-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
eb3948be16c37396fb3c50ef2c51f7f2da9c34d9 30-Apr-2009 Dan Gohman <gohman@apple.com> Implement getSCEVAtScope for SCEV cast expressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70422 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ac70ceafbcb6761f32634f981de4cca1a5faa417 30-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
36b8e53fe069862627cd06d82767a4253e24638d 29-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c9cf35055f7b0fd5814836686b4a550dc69bd11c 29-Apr-2009 Dale Johannesen <dalej@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f0aa4850ceb61695500437c26e609c4ec394157a 29-Apr-2009 Dan Gohman <gohman@apple.com> Update comments to reflect the current code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70357 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
01ecca20bf0f35d1fb464f098ac4bacbfeb06735 27-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d6c329532bed7a60f760b3a009b3582c624bc270 27-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2c73d5fb9e3d68c96bb2242bbbf2930a8db10343 25-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5cd28fad15b3bab840dac5ecdc2bdfde4f74816a 23-Apr-2009 Nick Lewycky <nicholas@mxc.ca> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
20900cae35c0d18eed449a985d452a74c98ecdb2 22-Apr-2009 Dan Gohman <gohman@apple.com> Simplify trivial cast-of-cast SCEVs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69809 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f8a8be86e3972608741c1e1ecb89ec3c6f570552 22-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
578ccf81e5b94965e3ce8b4eadb6834e39f5f41d 21-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4ee29af754f3b81ce90a5aa8f540b1f4a790191c 21-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
59d0704c8f38c279670c5d555a44e5b33696ca89 21-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
84923602fdc2a81957e5dee178d5737ad8e72f55 21-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a682430653a7726bba36f60a36ef4117cfc89438 21-Apr-2009 Dan Gohman <gohman@apple.com> Usage getAnalysisToUpdate for TargetData, per PR760.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69645 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
af79fb5f47b0088c6a8973a7fdbaea96973a429d 21-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
fb17fd2cdf35f8ad0b9e0e7e1b06a186fce442f8 21-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b7ef72963b2215ca23c27fa8ea777bada06994d0 21-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f4ccfcb70402b34ee55e0b5820cf287b95a8762f 18-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8170a6849ed370059676f94d8a00ae652873a394 16-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2d1be87ee40a4a0241d94448173879d9df2bc5b3 16-Apr-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
46bdfb0e6bb9de86b19562fc52fddefd7014cf73 24-Feb-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f5a309e989b8d2199cb542793e9edf48395d9fed 18-Feb-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
60f8a63e2502d57e879bf52a4a48505b74fa9716 17-Feb-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5a6c1a840ad343c0ed2fa54a0edb50b61f828f0f 17-Feb-2009 Evan Cheng <evan.cheng@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c2390b14c91764cba6e4394d05e58e387a7dfb19 12-Feb-2009 Dan Gohman <gohman@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
237d873439ed170e0d9608920d45d11d05bb5e5f 25-Jan-2009 Nick Lewycky <nicholas@mxc.ca> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d1f5fabd15c340273dc118dab95e97a3e76c4f87 16-Jan-2009 Nick Lewycky <nicholas@mxc.ca> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
789558db70d9513a017c11c5be30945839fdff1c 13-Jan-2009 Nick Lewycky <nicholas@mxc.ca> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
87f333641a24975e4c4ef01ec0f0b89dfd184c51 03-Jan-2009 Nick Lewycky <nicholas@mxc.ca> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ae285bf5a631e7dd24cce087eca78353ff231a9c 02-Jan-2009 Nick Lewycky <nicholas@mxc.ca> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1447f5ca1f59fdbe885df36c74e868267297a59d 16-Dec-2008 Nick Lewycky <nicholas@mxc.ca> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8bdc6920cdd1fd51e5af1537462c30c06203fe85 12-Dec-2008 Nick Lewycky <nicholas@mxc.ca> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
277a147f87b671b8545952367fd7aaafc1614e5d 11-Dec-2008 Nick Lewycky <nicholas@mxc.ca> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a9d50c00f1a9976cf183290e72d58bc4b607edd2 09-Dec-2008 Evan Cheng <evan.cheng@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0bed364307fa5c009239e65352ed36cb451953a7 09-Dec-2008 Nick Lewycky <nicholas@mxc.ca> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4a3136444e7a79a9d0e8c9c67940fa4dcd8f73fe 06-Dec-2008 Nick Lewycky <nicholas@mxc.ca> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1bdd93a3dcd16de259011c5b4326512a77e5337d 03-Dec-2008 Dale Johannesen <dalej@apple.com> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
48dd644109d97a76288f0b5045f6aa6a3c075732 02-Dec-2008 Nick Lewycky <nicholas@mxc.ca> Add a new SCEV representing signed division.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60407 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
dd643f26c43d162e905a07bf0826680aa10f7161 18-Nov-2008 Nick Lewycky <nicholas@mxc.ca> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
130fea2ca0ea21286fbdfd22a977b723e4242f3a 18-Nov-2008 Duncan Sands <baldrick@free.fr> Remove unused variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59515 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d72a81ee647b4474e2d1307335e520b871666507 16-Nov-2008 Nick Lewycky <nicholas@mxc.ca> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
89d0a4dd8446bba2a233d76043d9151fd40a27d0 11-Nov-2008 Devang Patel <dpatel@apple.com> Silence unused variable warning.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59064 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8f4d5eb9e543d22df61a98c4115ed81887213333 03-Nov-2008 Nick Lewycky <nicholas@mxc.ca> 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
/external/llvm/lib/Analysis/ScalarEvolution.cpp
cb8f1b5b8b9f1131f3d53015345c395905fe62db 13-Oct-2008 Nick Lewycky <nicholas@mxc.ca> Disallow the construction of SCEVs with could-not-compute operands. Catch CNCs
returned by BinomialCoefficient and don't try to operate with them. This
replaces the previous fix for PR2857.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57431 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
26e4b216c0c065dece616c1c9931252e2a0e40c6 04-Oct-2008 Nick Lewycky <nicholas@mxc.ca> Allow the construction of SCEVs with SCEVCouldNotCompute operands, by
implementing folding. Fixes PR2857.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57049 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
70ff4cf1baf8cce04b38752ea485425782fb07b8 16-Sep-2008 Dan Gohman <gohman@apple.com> Finally re-apply r46959. This is made feasible by the combination
of r56230, r56232, and r56246.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56247 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
81b28ceab6bd0ed6a784b7dc952ddb0b03fc6de7 16-Sep-2008 Dan Gohman <gohman@apple.com> Improve instcombine's handling of integer min and max in two ways:
- Recognize expressions like "x > -1 ? x : 0" as min/max and turn them
into expressions like "x < 0 ? 0 : x", which is easily recognizable
as a min/max operation.
- Refrain from folding expression like "y/2 < 1" to "y < 2" when the
comparison is being used as part of a min or max idiom, like
"y/2 < 1 ? 1 : y/2". In that case, the division has another use, so
folding doesn't eliminate it, and obfuscates the min/max, making it
harder to recognize as a min/max operation.

These benefit ScalarEvolution, CodeGen, and anything else that wants to
recognize integer min and max.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56246 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
fd6edef87b66c1c9bdef1ac562e13e59b9cd851a 16-Sep-2008 Dan Gohman <gohman@apple.com> Teach ScalarEvolution to consider loop preheaders in the search for
an if statement that guards a loop, to allow indvars to avoid smax
operations in more situations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56232 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8dae138d06df9cecbee421ef645d0b74f9ac13d7 14-Sep-2008 Dan Gohman <gohman@apple.com> Fix WriteAsOperand to not emit a leading space character. Adjust
its callers to emit a space character before calling it when a
space is needed.

This fixes several spurious whitespace issues in
ScalarEvolution's debug dumps. See the test changes for
examples.

This also fixes odd space-after-tab indentation in the output
for switch statements, and changes calls from being printed like
this:
call void @foo( i32 %x )
to this:
call void @foo(i32 %x)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3837218ea0ed343da0f4d9c0fa0b290e00c52619 12-Aug-2008 Dan Gohman <gohman@apple.com> Extend ScalarEvolution's executesAtLeastOnce logic to be able to
continue past the first conditional branch when looking for a
relevant test. This helps it avoid using MAX expressions in
loop trip counts in more cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d9cc749318cc9ab4f36efe8a44201a72adbda2b2 08-Aug-2008 Dan Gohman <gohman@apple.com> Canonicalize nested AddRecs in by nesting them in order of loop depth.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54545 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b42a6261225e5a1b9a75b9aa11732944046d7999 05-Aug-2008 Eli Friedman <eli.friedman@gmail.com> PR2621: Improvements to the SCEV AddRec binomial expansion. This
version uses a new algorithm for evaluating the binomial coefficients
which is significantly more efficient for AddRecs of more than 2 terms
(see the comments in the code for details on how the algorithm works).
It also fixes some bugs: it removes the arbitrary length restriction for
AddRecs, it fixes the silent generation of incorrect code for AddRecs
which require a wide calculation width, and it fixes an issue where we
were incorrectly truncating the iteration count too far when evaluating
an AddRec expression narrower than the induction variable.

There are still a few related issues I know of: I think there's
still an issue with the SCEVExpander expansion of AddRec in terms of
the width of the induction variable used. The hack to avoid generating
too-wide integers shouldn't be necessary; instead, the callers should be
considering the cost of the expansion before expanding it (in addition
to not expanding too-wide integers, we might not want to expand
expressions that are really expensive, especially when optimizing for
size; calculating an length-17 32-bit AddRec currently generates about 250
instructions of straight-line code on X86). Also, for long 32-bit
AddRecs on X86, CodeGen really sucks at scheduling the code. I'm planning on
filing follow-up PRs for these issues.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54332 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1fbffe0cef92ee284f44cfef3ce0db7ec7d86f18 30-Jul-2008 Eli Friedman <eli.friedman@gmail.com> Another SCEV issue from PR2607; essentially the same issue, but this
time applying to the implicit comparison in smin expressions. The
correct way to transform an inequality into the opposite
inequality, either signed or unsigned, is with a not expression.

I looked through the SCEV code, and I don't think there are any more
occurrences of this issue.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54194 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
068acc3caa113db0925766d327bf9cae6a9eb885 30-Jul-2008 Eli Friedman <eli.friedman@gmail.com> Fix for PR2607: SCEV miscomputing the loop count for loops with an
SGT exit condition. Essentially, the correct way to flip an inequality
in 2's complement is the not operator, not the negation operator.
That said, the difference only affects cases involving INT_MIN.

Also, enhance the pre-test search logic to be a bit smarter about
inequalities flipped with a not operator, so it can eliminate the smax
from the iteration count for simple loops.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54184 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9e13cbc171f4c5c3f74b097243eff7cb0b3b942b 21-Jul-2008 Nick Lewycky <nicholas@mxc.ca> Revert r53812 -- premature. LegalizeTypes isn't actually on yet!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53816 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2ceb40f3da2290d37e9a4faa35bd5199e5dc90d5 21-Jul-2008 Nick Lewycky <nicholas@mxc.ca> Switch on the use of arbitrary precision integers in scalar evolution. This will
bail after 256-bits to avoid producing code that the backends can't handle.
Previously, we capped it at 64-bits, preferring to miscompile in those cases.

This change also reverts much of r52248 because the invariants the code was
expecting are now being met.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53812 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8b82c49084e83a1df47ac1f1e21f2a072d2e4781 20-Jul-2008 Wojciech Matyjewicz <wmatyjewicz@fastmail.fm> This header isn't necessary now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53811 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
de0f2382e4aa99c921216574ce97f09c3d145d0f 20-Jul-2008 Wojciech Matyjewicz <wmatyjewicz@fastmail.fm> Fix PR2088. Use modulo linear equation solver to compute loop iteration
count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53810 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8ae38e15161696cae57aa1ec725ec4391d1e4c77 15-Jul-2008 Nick Lewycky <nicholas@mxc.ca> Correct this inversion!
I swear that didn't show up in svn diff...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53587 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
86dae65baa8b4362bc309bd0105a788c567729d8 15-Jul-2008 Nick Lewycky <nicholas@mxc.ca> Fix up comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53586 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
59cff12f8880797518c8c37f068fe75cfdc54536 12-Jul-2008 Nick Lewycky <nicholas@mxc.ca> Stop creating extraneous smax/umax in SCEV. This removes a regression where we
started complicating many loops ('for' loops, in fact).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53508 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b0b046848faad8e87d02c82d03b5b7b1ba74e041 09-Jul-2008 Nick Lewycky <nicholas@mxc.ca> Remove getValueRange from SCEV. It wasn't doing anything there anyways, and a
more complete version is now available from the LoopVR pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53269 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
01eaf803cafe218b9323caa0e785b340e5d34eea 07-Jul-2008 Nick Lewycky <nicholas@mxc.ca> Handle 'lshr' instruction with SCEVUDiv object.
Comment the xor %x, -1 case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53167 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6c459a28ecb8d33e4b59ab2db1f9a58a2d06824b 22-Jun-2008 Dan Gohman <gohman@apple.com> Generalize createSCEV to be able to form SCEV expressions from
ConstantExprs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
cfeb6a450632f2a6cd05302633c8c2b8c90cfdfd 18-Jun-2008 Dan Gohman <gohman@apple.com> Move LSR's private isZero function to a public SCEV member
function, and make use of it in several places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6f8abf929ac173872cc50aff767bc25f2a07a523 13-Jun-2008 Nick Lewycky <nicholas@mxc.ca> Crash less. The i64 restriction in BinomialCoefficient caused some problems
with code that was expecting different bit widths for different values.

Make getTruncateOrZeroExtend a method on ScalarEvolution, and use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52248 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
04b35e8532d82b6777a667e09db153e9fb73e071 26-May-2008 Nick Lewycky <nicholas@mxc.ca> Don't treat values as signed when looking at loop steppings in HowForToNonZero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51560 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
844731a7f1909f55935e3514c9e713a62d67662e 13-May-2008 Dan Gohman <gohman@apple.com> Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
08de613d2dec7a5c3aa55d2a46fddb07dccf3051 06-May-2008 Nick Lewycky <nicholas@mxc.ca> Fix typo and indentation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50706 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a0c8fc6f28808a6b859d45c7e2d3391e3e8d2963 20-Apr-2008 Dale Johannesen <dalej@apple.com> (re)fix handling of UGT. Pointed out by Nick Lewycky.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49991 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
02a260aa11a2e1b2c14335274d3c42ca3f3eabc0 20-Apr-2008 Chris Lattner <sabre@nondot.org> Switch to using Simplified ConstantFP::get API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49977 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
cf363181c1b98c0982010cf5714e31b7277bdd2a 18-Apr-2008 Dale Johannesen <dalej@apple.com> Fix a scalar evolution bug. Reversing everything
does not work because of 0; 2>0 but -2U is also >0.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49928 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f7b37b2d0e28cd2f2ecc03e3e6e470353dca5725 14-Apr-2008 Dan Gohman <gohman@apple.com> In the special case, call the comparison function instead of
manually performing the comparison. This allows the special
case to work correctly even in the case where someone is
experimenting with a different comparison function :-).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49670 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4f4c28f75f74fe557efb63feaf5f4f8bf639dcd5 20-Mar-2008 Devang Patel <dpatel@apple.com> Restore isCFGOnly property of various analysis passes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48579 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c758209153ca0f6da6737f25ada269c573fba456 19-Mar-2008 Devang Patel <dpatel@apple.com> PassInfo keep tracks whether a pass is an analysis pass or not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48554 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b9a905781ee8ee49660c6733530d42dece94d12a 25-Feb-2008 Evan Cheng <evan.cheng@apple.com> Temporarily reverting 46959.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47542 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
39442afb36cfe39315accc36eb2e8355689f0882 21-Feb-2008 Nick Lewycky <nicholas@mxc.ca> Simplify this code, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47434 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3b71165b32dd631e2a3e5d27fa10c5d6c08d19e2 21-Feb-2008 Nick Lewycky <nicholas@mxc.ca> GlobalValues are Constants, remove redundant code. Also fix typo in a comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47433 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ae9f3a3b7c915f725aef5a7250e88eaeddda03c6 20-Feb-2008 Anton Korobeynikov <asl@math.spbu.ru> Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
178f20a685bb456444eb1989b91326690c42e421 20-Feb-2008 Nick Lewycky <nicholas@mxc.ca> Use getConstant for ConstantInts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47361 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3e6307698084e7adfc10b739442ae29742beefd0 20-Feb-2008 Nick Lewycky <nicholas@mxc.ca> Add 'umax' similar to 'smax' SCEV. Closes PR2003.

Parse reversed smax and umax as smin and umin and express them with negative
or binary-not SCEVs (which are really just subtract under the hood).

Parse 'xor %x, -1' as (-1 - %x).

Remove dead code (ConstantInt::get always returns a ConstantInt).

Don't use getIntegerSCEV(-1, Ty). The first value is an int, then it gets
passed into a uint64_t. Instead, create the -1 directly from
ConstantInt::getAllOnesValue().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47360 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a65ee03bb28fc9016cad3f725bd141428eb4d8a0 13-Feb-2008 Wojciech Matyjewicz <wmatyjewicz@fastmail.fm> Fix typo. Thanks to Duncan for noticing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47062 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3a4cbe2a41f2c4233df2f061d7bcd45d7b46e1a1 13-Feb-2008 Wojciech Matyjewicz <wmatyjewicz@fastmail.fm> Add comments as per review feedback.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47061 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7b5b76835a608155a94f6b08ea9c6091cb070815 12-Feb-2008 Wojciech Matyjewicz <wmatyjewicz@fastmail.fm> Fix PR2002. Suppose n is the initial value for the induction
variable (with step 1) and m is its final value. Then, the correct trip
count is SMAX(m,n)-n. Previously, we used SMAX(0,m-n), but m-n may
overflow and can't in general be interpreted as signed.

Patch by Nick Lewycky.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47007 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a089b104218c46803a1af374f6c441df885e54c2 11-Feb-2008 Wojciech Matyjewicz <wmatyjewicz@fastmail.fm> If the LHS of the comparison is a loop-invariant we also want to move it
to the RHS. This simple change allows to compute loop iteration count
for loops with condition similar to the one in the testcase (which seems
to be quite common).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46959 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e3320a1bcce3f6653e109cc86ee1011b0a61d808 11-Feb-2008 Wojciech Matyjewicz <wmatyjewicz@fastmail.fm> Fix PR1798 - an error in the evaluation of SCEVAddRecExpr at an
arbitrary iteration.

The patch:
1) changes SCEVSDivExpr into SCEVUDivExpr,
2) replaces PartialFact() function with BinomialCoefficient(); the
computations (essentially, the division) in BinomialCoefficient() are
performed with the apprioprate bitwidth necessary to avoid overflow;
unsigned division is used instead of the signed one.

Computations in BinomialCoefficient() require support from the code
generator for APInts. Currently, we use a hack rounding up the
neccessary bitwidth to the nearest power of 2. The hack is easy to turn
off in future.

One remaining issue: we assume the divisor of the binomial coefficient
formula can be computed accurately using 16 bits. It means we can handle
AddRecs of length up to 9. In future, we should use APInts to evaluate
the divisor.

Thanks to Nicholas for cooperation!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46955 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
fa9b80eb64127b3d9691e18537975635520e51e9 31-Jan-2008 Dan Gohman <gohman@apple.com> Avoid unnecessarily casting away const, fixing a FIXME.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46591 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
aeb5e5cdb7f8544c679642068492f74a14eca60e 02-Jan-2008 Nick Lewycky <nicholas@mxc.ca> Don't be rude, emit debugging info where asked to.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45485 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4ee451de366474b9c228b4e5fa573795a715216d 29-Dec-2007 Chris Lattner <sabre@nondot.org> Remove attribution from file headers, per discussion on llvmdev.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f286f6fd93d569befe6e77c94a947e6e04e95685 10-Dec-2007 Chris Lattner <sabre@nondot.org> Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.
Reimplement the xform in Analysis/ConstantFolding.cpp where we can use
targetdata to validate that it is safe. While I'm in there, fix some const
correctness issues and generalize the interface to the "operand folder".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44817 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c54c561c9f7270c055dd7ba75a3a003b771a42d9 25-Nov-2007 Nick Lewycky <nicholas@mxc.ca> Add new SCEV, SCEVSMax. This allows LLVM to analyze do-while loops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44319 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8314a0cd0ff3a1bb86bf8ab7ec6e35b232c6cb37 23-Nov-2007 Chris Lattner <sabre@nondot.org> simplify some code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44295 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
42b5e08e7123aefbc6e93b547f44e3ed7604526f 23-Nov-2007 Chris Lattner <sabre@nondot.org> Fix a bug where we'd try to find a scev value for a bitcast operand,
even though the bitcast operand did not have integer type. This fixes
PR1814.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44286 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
83bb0055fdac3c6234c4178cd429e6a917d06c4e 22-Nov-2007 Nick Lewycky <nicholas@mxc.ca> Instead of calculating constant factors, calculate the number of trailing
bits. Patch from Wojciech Matyjewicz.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44268 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6e801dc6c0a7b04e154f5fbb3a2b04cc355d194d 20-Nov-2007 Nick Lewycky <nicholas@mxc.ca> Small cleanup. Use APInt::getHighBitsSet method instead of shift left.
"setcc" -> "icmp op" in comments. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44249 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
cf96db2c1dc21a74a13faa74b8bb2f9a937fc6c9 20-Nov-2007 Nick Lewycky <nicholas@mxc.ca> Be more careful when transforming | to +. Patch from Wojciech Matyjewicz.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44248 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4e1a0e386c6861a697b0cd2e13a33ac4dd60e17d 15-Nov-2007 Anton Korobeynikov <asl@math.spbu.ru> Reverted r44163 per request


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44177 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
65e2da3b4d6925bf30693595a524a3a43acc1f17 15-Nov-2007 Nick Lewycky <nicholas@mxc.ca> Fix handling of overflow in loop calculation by adding new UDiv SCEV. This SCEV
is disabled in the sense that it will refuse to create one from a UDiv
instruction, until the code is better tested.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44163 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
246b2564d3bbbafe06ebf6a67745cd24141b5cb4 22-Oct-2007 Dan Gohman <gohman@apple.com> Move the SCEV object factors from being static members of the individual
SCEV subclasses to being non-static member functions of the ScalarEvolution
class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43224 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9a2f93121b31bf6345d1552bdc43037f89714d86 27-Sep-2007 Nick Lewycky <nicholas@mxc.ca> Build the correct range for loops with unusual bounds. Fix from Jay Foad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42394 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
43421b3dd70af5b70e71816521f37502c397cc65 06-Sep-2007 Dale Johannesen <dalej@apple.com> Next round of APFloat changes.
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double. Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41747 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b7211a2ce13a0365e0e1dd2f27adda2ee3d1288b 21-Aug-2007 Devang Patel <dpatel@apple.com> Use SmallVector instead of std::vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41207 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d6dac0eebc2c9c2d9107db9b2e1bdfd231bac535 06-Aug-2007 Nick Lewycky <nicholas@mxc.ca> Let scalar-evolution analyze loops with an unsigned comparison for the exit
condition. Fixes 1597.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40867 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
06323bfe034797be1f835459845f83a28400f707 06-Aug-2007 Nick Lewycky <nicholas@mxc.ca> Don't assume it's safe to transform a loop just because it's dominated by any
comparison. Fixes bug 1598.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
eefdebe002ede066bf80859e72aec831cfd1d92d 16-Jul-2007 Nick Lewycky <nicholas@mxc.ca> Handle decrementing loops properly. Fixes PR1533.

Always pass the constant as the second parameter to HowManyLessThans.

Remove obsolete "isSigned" parameter.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39893 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9a6ae965d69b131d692de8fc69545b6c7aaea0b2 09-Jul-2007 Dan Gohman <gohman@apple.com> Move the APInt form of SCEVUnknown::getIntegerSCEV to SCEVConstant::get, and
use SCEVConstant::get instead of SCEVUnknown::get when constructing a SCEV
for a ConstantInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38457 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5cec4db6ae13a41d04d86f37e347fc5b5997c948 19-Jun-2007 Dan Gohman <gohman@apple.com> Rename ScalarEvolution::deleteInstructionFromRecords to
deleteValueFromRecords and loosen the types to all it to accept
Value* instead of just Instruction*, since this is what
ScalarEvolution uses internally anyway. This allows more flexibility
for future uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37657 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f50cd749e1504cea64a432757d49831ab0e23c70 18-Jun-2007 Dan Gohman <gohman@apple.com> In SCEVAddExpr::get, skip over any cast operands before looking for nested
add operands after constant operands. The recent change to recognize
sign-extend expressions caused this to be exposed more often.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37628 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d19534add90a2a894af61523b830887097bb780b 15-Jun-2007 Dan Gohman <gohman@apple.com> Add a SCEV class and supporting code for sign-extend expressions.

This created an ambiguity for expandInTy to decide when to use
sign-extension or zero-extension, but it turns out that most of its callers
don't actually need a type conversion, now that LLVM types don't have
explicit signedness. Drop expandInTy in favor of plain expand, and change
the few places that actually need a type conversion to do it themselves.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37591 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
51e844b60168d019a293daddf19bd291c706dc3f 06-Jun-2007 Nick Lewycky <nicholas@mxc.ca> Optimize this test. Firstly, only Instructions may use other Instructions.
Secondly, checking whether removal succeeded tells you whether it was in
the map to begin with.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37469 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9d0332f7b4d8aa8e07544506eb26d1e155c3745a 06-Jun-2007 Nick Lewycky <nicholas@mxc.ca> Fix PR1487 and Transforms/IndVar/2007-06-06-DeleteDanglesPtr.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1997473cf72957d0e70322e2fe6fe2ab141c58a6 03-May-2007 Devang Patel <dpatel@apple.com> Drop 'const'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36662 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3e15bf33e024b9df9e89351a165acfdb1dde51ed 02-May-2007 Devang Patel <dpatel@apple.com> Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36652 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c718288f4939258a51ec5ae0c5be7b1a05eb6898 02-May-2007 Lauro Ramos Venancio <lauro.venancio@gmail.com> Fix build error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36648 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
794fd75c67a2cdc128d67342c6d88a504d186896 01-May-2007 Devang Patel <dpatel@apple.com> Do not use typeinfo to identify pass in pass manager.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3e35c8d15e6981ab759820e84ffcb945bfcef71b 16-Apr-2007 Reid Spencer <rspencer@reidspencer.com> Revert last patch. It was already fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36102 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b4a7fea7fde104a8c81fffb1cf7b8227af8fc845 16-Apr-2007 Reid Spencer <rspencer@reidspencer.com> For PR1336:
Fix a div-by-zero bug noticed by APInt. This fixes:
test/Transforms/IndVarsSimplify/exit_value_tests.llx


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
fe560b8c8529bd2380452a9713eb591c545c4301 15-Apr-2007 Chris Lattner <sabre@nondot.org> Fix a nasty bug introduced when apint'ified. This fixes
Transforms/IndVarsSimplify/exit_value_tests.llx


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36081 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
414de4df41bba7f9e2b06723ae2ddae51dac3e0f 07-Apr-2007 Zhou Sheng <zhousheng00@gmail.com> Eliminate unnecessary APInt construction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35740 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
fdc1e16dcf358cd5e0ff1cf36735630854a268e4 07-Apr-2007 Zhou Sheng <zhousheng00@gmail.com> Make APInt variables do the computation stuffs instead of
ConstantExpr::getXX if possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35738 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8342836d70e94361a88d431a68a6da0ae0a9e219 07-Apr-2007 Zhou Sheng <zhousheng00@gmail.com> Eliminate unnecessary zext/trunc stuffs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35737 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2811f2a67069be9a1fab05c1fe152098bd8b5028 02-Apr-2007 Chris Lattner <sabre@nondot.org> Treat xor of signbit like an add.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35586 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0797605204a0726a2f3f726ae4431445b5d40ca9 04-Mar-2007 Reid Spencer <rspencer@reidspencer.com> Guard further against APInt operations with operands of unequal bit width.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34897 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9b4aeb3cc13d875ccfce1b81f21aaf93d6471e47 02-Mar-2007 Reid Spencer <rspencer@reidspencer.com> Fix an unequal bitwidth issue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34831 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
cae5754619433aed7be74abbf1c0551a82d369cb 02-Mar-2007 Reid Spencer <rspencer@reidspencer.com> Prefer non-virtual calls to ConstantInt::isZero over virtual calls to
Constant::isNullValue() in situations where it is possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34821 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
35fa43907e2ea751ad35bfbaab8c4d3511422c14 01-Mar-2007 Reid Spencer <rspencer@reidspencer.com> Make it possible to create an SCEVUnknown from an APInt as well as an int.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34816 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c7cd7a0bb1debf6e71c71e63c595059a306177dd 01-Mar-2007 Reid Spencer <rspencer@reidspencer.com> Construct ConstantInt with simpler constructor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34795 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e479ef0b411f2cd9134bd1f6e8b9f12e05089d40 01-Mar-2007 Reid Spencer <rspencer@reidspencer.com> Fix last night's 445.gobmk breakage which was caused by comparison of
APInt's of unequal bitwidth.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34790 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a6e8a955d6ab82911a1909fac7a9f4256a4d090e 01-Mar-2007 Reid Spencer <rspencer@reidspencer.com> Remove the "isSigned" parameters from ConstantRange. It turns out they
are not needed as the results are the same with or without it.

Patch by Nicholas Lewycky.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34782 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e8019bb1fc46069109dadd5b1c48e86a912bf990 01-Mar-2007 Reid Spencer <rspencer@reidspencer.com> APIntify various computations in ScalarEvolution


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34780 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6263cbada2c24811b7b7f8705c5e2b8c5a13461e 01-Mar-2007 Reid Spencer <rspencer@reidspencer.com> For PR1205:
Make GetConstantFactor compute its result using an APInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34765 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c6aedf70b3a7d0478b8882bf79b985a48d78d37e 28-Feb-2007 Reid Spencer <rspencer@reidspencer.com> For PR1205:
Adjust to changes in ConstantRange interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34762 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
581b0d453a63f7f657248f80317976995262be11 28-Feb-2007 Reid Spencer <rspencer@reidspencer.com> For PR1205:
Remove ConstantInt from ConstantRange interface and adjust its users to
compensate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34758 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
dc5c1597014fa5c47c94db2b9fd424d2266053db 28-Feb-2007 Reid Spencer <rspencer@reidspencer.com> For PR1205:
First round of ConstantRange changes. This makes all CR constructors use
only APInt and not use ConstantInt. Clients are adjusted accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34756 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
832254e1c2387c0cbeb0a820b8315fbe85cb003a 02-Feb-2007 Reid Spencer <rspencer@reidspencer.com> Changes to support making the shift instructions be true BinaryOperators.
This feature is needed in order to support shifts of more than 255 bits
on large integer types. This changes the syntax for llvm assembly to
make shl, ashr and lshr instructions look like a binary operator:
shl i32 %X, 1
instead of
shl i32 %X, i8 1
Additionally, this should help a few passes perform additional optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2e3a1d137cf1e426ec44621329e02d6e283d0bb8 31-Jan-2007 Chris Lattner <sabre@nondot.org> The local "ConstantFold" method is now just a watered down version of
ConstantFoldInstOperands. Switch to ConstantFoldInstOperands and remove
ConstantFold.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33683 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
72d88ae5447a3929c97e88f4c806213847b5d988 31-Jan-2007 Chris Lattner <sabre@nondot.org> adjust to constant folding api changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c10305743c313558405079452138f03124e87581 19-Jan-2007 Reid Spencer <rspencer@reidspencer.com> For PR1043:
This is the final patch for this PR. It implements some minor cleanup
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask -> IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120.

Patch by Sheng Zhou.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33370 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1b30754ba9ced4d87bf2b3699ec4908b57f474ed 15-Jan-2007 Jeff Cohen <jeffc@jolt-lang.org> Unbreak VC++ build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33242 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
42a75517250017a52afb03a0ade03cbd49559fe5 15-Jan-2007 Chris Lattner <sabre@nondot.org> rename Type::isIntegral to Type::isInteger, eliminating the old Type::isInteger.
rename Type::getIntegralTypeMask to Type::getIntegerTypeMask.

This makes naming much more consistent. For example, there are now no longer any
instances of IntegerType that are not considered isInteger! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33225 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b2f3e703bcde5833ff5910922f7a5313cc6b1c64 15-Jan-2007 Chris Lattner <sabre@nondot.org> Update code to eliminate calls to isInteger, calling isIntegral instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33220 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
192e4037445f4141cd44c0080e3eeb2718d41466 14-Jan-2007 Chris Lattner <sabre@nondot.org> Fix PR1101 and Analysis/ScalarEvolution/trip-count.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33193 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ef3baf0979091b873f593c1e214974e488c93b9b 12-Jan-2007 Chris Lattner <sabre@nondot.org> don't discriminate against bool


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33128 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
579dca12c2cfd60bc18aaadbd5331897d48fec29 12-Jan-2007 Reid Spencer <rspencer@reidspencer.com> Implement review feedback for the ConstantBool->ConstantInt merge. Chris
recommended that getBoolValue be replaced with getZExtValue and that
get(bool) be replaced by get(const Type*, uint64_t). This implements
those changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33110 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4fe16d607d11e29d742208894909733f5ad01f8f 11-Jan-2007 Reid Spencer <rspencer@reidspencer.com> Rename BoolTy as Int1Ty. Patch by Sheng Zhou.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33076 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6b6b6ef1677fa71b1072c2911b4c1f9524a558c9 11-Jan-2007 Zhou Sheng <zhousheng00@gmail.com> For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33073 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e7ca042730a233591cece04f177209923e6fb478 08-Jan-2007 Reid Spencer <rspencer@reidspencer.com> Convert uses of getPrimitiveSize that should be getPrimitiveSizeInBits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8b0e3602e2b54162e892bddac90b4ab2e13ee0de 07-Jan-2007 Chris Lattner <sabre@nondot.org> Fix PR1015 and Transforms/IndVarsSimplify/2007-01-06-TripCount.ll, a
miscompilation of Qt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32974 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f82188c9ced9938fe805511d960cf11a829c7b58 07-Jan-2007 Chris Lattner <sabre@nondot.org> cast of int to bool no longer does a compare, rendering this fixme
obsolete


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32972 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c5b206b6be61d0d933b98b6af5e22f42edd48ad1 31-Dec-2006 Reid Spencer <rspencer@reidspencer.com> For PR950:
This patch replaces signed integer types with signless ones:
1. [US]Byte -> Int8
2. [U]Short -> Int16
3. [U]Int -> Int32
4. [U]Long -> Int64.
5. Removal of isSigned, isUnsigned, getSignedVersion, getUnsignedVersion
and other methods related to signedness. In a few places this warranted
identifying the signedness information from other sources.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32785 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e4d87aa2de6e52952dca73716386db09aad5a8fd 23-Dec-2006 Reid Spencer <rspencer@reidspencer.com> For PR950:
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and
been replaced with ICmpInst and FCmpInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32751 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d3773507188d550a3ce5be09662235cf23679811 21-Dec-2006 Reid Spencer <rspencer@reidspencer.com> Add a FIXME about signedness.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32732 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2e20d39493aa58dfe7b1f9e8890215f0dedc038f 21-Dec-2006 Reid Spencer <rspencer@reidspencer.com> Add some comments about things that can go away once signless types are in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32727 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3b27d68c6af2582df0962557f1fe5c3f70f46e3f 19-Dec-2006 Chris Lattner <sabre@nondot.org> eliminate static ctors from Statistics


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
75de5ab9f58b84aa99c2a9133572ce1d997ec1a8 19-Dec-2006 Chris Lattner <sabre@nondot.org> Fix a bug in GetConstantFactor for affine expressions, in which the existing
code was wrong for things like 3+4*i.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32662 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d977d8651a5cd26a3e1088267f31cade405f2adf 13-Dec-2006 Reid Spencer <rspencer@reidspencer.com> Replace inferred getCast(V,Ty) calls with more strict variants.
Rename getZeroExtend and getSignExtend to getZExt and getSExt to match
the the casting mnemonics in the rest of LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b6ba3e6d85c99d959b243a1d0331b9b6d3fb7a44 12-Dec-2006 Reid Spencer <rspencer@reidspencer.com> Get even more accurate on the casting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32478 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4da49122f3f3c8da68a52723d846b88c72166a68 12-Dec-2006 Reid Spencer <rspencer@reidspencer.com> Change inferred getCast into specific getCast. Passes all tests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32469 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a17f03980f88f23be3298d4128b9c02ebb360f31 12-Dec-2006 Chris Lattner <sabre@nondot.org> teach scev to analyze X*4|1 like X*4+c. This allows us to produce:

LBB1_1: #bb
movdqa (%esi), %xmm2
movaps %xmm2, %xmm3
punpcklbw %xmm0, %xmm3
movaps %xmm3, %xmm4
punpcklwd %xmm0, %xmm4
cvtdq2ps %xmm4, %xmm4
mulps %xmm1, %xmm4
movaps %xmm4, (%edi)
leal 1(,%eax,4), %ebx
shll $4, %ebx
punpckhwd %xmm0, %xmm3
cvtdq2ps %xmm3, %xmm3
mulps %xmm1, %xmm3
movaps %xmm3, (%edx,%ebx)
leal 2(,%eax,4), %ebx
shll $4, %ebx
punpckhbw %xmm0, %xmm2
movaps %xmm2, %xmm3
punpcklwd %xmm0, %xmm3
cvtdq2ps %xmm3, %xmm3
mulps %xmm1, %xmm3
movaps %xmm3, (%edx,%ebx)
leal 3(,%eax,4), %ebx
shll $4, %ebx
punpckhwd %xmm0, %xmm2
cvtdq2ps %xmm2, %xmm2
mulps %xmm1, %xmm2
movaps %xmm2, (%edx,%ebx)
addl $64, %edi
incl %eax
addl $16, %esi
cmpl %ecx, %eax
jne LBB1_1 #bb

instead of:

LBB1_1: #bb
movdqa (%esi), %xmm2
movaps %xmm2, %xmm3
punpcklbw %xmm0, %xmm3
movaps %xmm3, %xmm4
punpcklwd %xmm0, %xmm4
cvtdq2ps %xmm4, %xmm4
mulps %xmm1, %xmm4
movaps %xmm4, (%edi)
leal 1(,%eax,4), %ebx
shll $4, %ebx
punpckhwd %xmm0, %xmm3
cvtdq2ps %xmm3, %xmm3
mulps %xmm1, %xmm3
movaps %xmm3, (%edx,%ebx)
leal 2(,%eax,4), %ebx
shll $4, %ebx
punpckhbw %xmm0, %xmm2
movaps %xmm2, %xmm3
punpcklwd %xmm0, %xmm3
cvtdq2ps %xmm3, %xmm3
mulps %xmm1, %xmm3
movaps %xmm3, (%edx,%ebx)
leal 3(,%eax,4), %ebx
shll $4, %ebx
punpckhwd %xmm0, %xmm2
cvtdq2ps %xmm2, %xmm2
mulps %xmm1, %xmm2
movaps %xmm2, (%edx,%ebx)
addl $64, %edi
incl %eax
addl $16, %esi
cmpl %ecx, %eax
jne LBB1_1 #bb

for a testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
82e8a8ffe4cab2df8f8f1da9825e7814210bb568 11-Dec-2006 Chris Lattner <sabre@nondot.org> clarify some comments, simplify some checks, fix:
Regression/Transforms/IndVarsSimplify/2006-12-10-BitCast.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32420 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e81561909d128c6e2d8033cb5465a49b2596b26a 07-Dec-2006 Bill Wendling <isanbard@gmail.com> Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ac0b6ae358944ae8b2b5a11dc08f52c3ed89f2da 06-Dec-2006 Chris Lattner <sabre@nondot.org> Detemplatize the Statistic class. The only type it is instantiated with
is 'unsigned'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
315d05542cbe0e5fe769122324328b268ce4497c 05-Dec-2006 Reid Spencer <rspencer@reidspencer.com> Finally get the casting right in this file. Also, remove some unnecessary
casting because sdiv doesn't require operand signs to match any more.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32240 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7858b336f23405a96ee25de1b9071aeaf270bd77 05-Dec-2006 Reid Spencer <rspencer@reidspencer.com> Bail on the getInferredCast idea. Remove the function and convert
remaining uses to more specific casts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32231 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
09906f3e1a1dc40be1f4a1381d0aaafed6657a8e 04-Dec-2006 Reid Spencer <rspencer@reidspencer.com> Fix comment grammaro


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32198 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
14bab5db2d2a7b597ae7272e9c809d68ed3343b6 04-Dec-2006 Reid Spencer <rspencer@reidspencer.com> Fix inferred casts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32180 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
97af751deb9b26fd42fbcee082da9ccc4ded5b45 02-Dec-2006 Jeff Cohen <jeffc@jolt-lang.org> Unbreak VC++ build.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32113 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6f81b510217bd87f265cca054c5d9885250d8525 28-Nov-2006 Bill Wendling <isanbard@gmail.com> Removed some of the iostream #includes. Moved towards converting to using
llvm streams


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31983 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3da59db637a887474c1b1346c1f3ccf53b6c4663 27-Nov-2006 Reid Spencer <rspencer@reidspencer.com> For PR950:
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d6c3422e3126927840683574a658a0deada903f0 08-Nov-2006 Jim Laskey <jlaskey@mac.com> Remove redundant <cmath>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31561 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0a783f783ca05c961234385f5b269d4cf03dbbdb 02-Nov-2006 Reid Spencer <rspencer@reidspencer.com> For PR950:
Replace the REM instruction with UREM, SREM and FREM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31369 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
48d8a70d22eb166a917946d7ed69061e91e9cd12 01-Nov-2006 Reid Spencer <rspencer@reidspencer.com> Make ScalarEvolution actually use a ZeroExtend expression instead of
having SCZeroExtendExpr be equivalent to SCTruncate


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31355 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1628cec4d7fce310d9cde0bcc73997e5a71692c4 26-Oct-2006 Reid Spencer <rspencer@reidspencer.com> For PR950:
Make necessary changes to support DIV -> [SUF]Div. This changes llvm to
have three division instructions: signed, unsigned, floating point. The
bytecode and assembler are bacwards compatible, however.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31195 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b83eb6447ba155342598f0fabe1f08f5baa9164a 20-Oct-2006 Reid Spencer <rspencer@reidspencer.com> For PR950:
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31063 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b336409673c614843cc19b8f61db6afb9d8c5ac3 04-Oct-2006 Chris Lattner <sabre@nondot.org> Fix some more static dtor issues.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30724 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
003cbf35f4d9feebf0f1508c85b69b87645727cd 29-Sep-2006 Chris Lattner <sabre@nondot.org> Eliminate ConstantBool::True and ConstantBool::False. Instead, provide
ConstantBool::getTrue() and ConstantBool::getFalse().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30666 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5d8925c7c506a54ebdfb0bc93437ec9f602eaaa0 28-Aug-2006 Chris Lattner <sabre@nondot.org> Eliminate RegisterAnalysis. RegisterPass now does all that is necessary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29921 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a4f0b3a084d120cfc5b5bb06f64b222f5cb72740 27-Aug-2006 Chris Lattner <sabre@nondot.org> s|llvm/Support/Visibility.h|llvm/Support/Compiler.h|


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29911 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
9525528a7dc5462b6374d38c81ba5c07b11741fe 29-Jun-2006 Chris Lattner <sabre@nondot.org> Use hidden visibility to make symbols in an anonymous namespace get
dropped. This shrinks libllvmgcc.dylib another 67K


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28975 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
97156e7984887461a7d4b3d60fe9eaef856b5140 26-Apr-2006 Chris Lattner <sabre@nondot.org> Implement Transforms/IndVarsSimplify/complex-scev.ll, a case where we didn't
recognize some simple affine IV's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27982 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
1f239300d341c0d5d94516f8d0c41cdd31fae54b 04-Apr-2006 Chris Lattner <sabre@nondot.org> Signed shr by a constant is not the same as sdiv by 2^k


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27395 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
60a05cc118763c680834a61280f48530482a1f86 01-Apr-2006 Chris Lattner <sabre@nondot.org> Fix Transforms/IndVarsSimplify/2006-03-31-NegativeStride.ll and
PR726 by performing consistent signed division, not consistent unsigned
division when evaluating scev's. Do not touch udivs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27326 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7238210e1fe2f5a950087f78465e0f7af22ccd69 23-Jan-2006 Chris Lattner <sabre@nondot.org> Add explicit iostream #includes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25513 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a11564335749cd259d8a1391be34c1abbe302c42 27-Oct-2005 John Criswell <criswell@uiuc.edu> Move some constant folding code shared by Analysis and Transform passes
into the LLVMAnalysis library.
This allows LLVMTranform and LLVMTransformUtils to be archives and linked
with LLVMAnalysis.a, which provides any missing definitions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24036 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
bed21de39b2f085a38bee2285d1600efba8150bd 29-Sep-2005 Chris Lattner <sabre@nondot.org> wrap a long line


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23507 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ff2006aa7421eaf2ce0b6282783c30ed87a2115e 16-Aug-2005 Chris Lattner <sabre@nondot.org> Fix Transforms/LoopStrengthReduce/2005-08-15-AddRecIV.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22797 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
db25de496c1bd9047acc9f6ab825a92a7b5dd497 16-Aug-2005 Chris Lattner <sabre@nondot.org> Teach LLVM to know how many times a loop executes when constructed with
a < expression, e.g.: for (i = m; i < n; ++i)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22793 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
05bd374b1f22b74baf1dc087c8c2d128c1e299aa 10-Aug-2005 Chris Lattner <sabre@nondot.org> Fix an obvious oops


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22742 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
a0740fbcc735eb87d7fe5111d302e4b8245120b6 10-Aug-2005 Chris Lattner <sabre@nondot.org> implement two helper methods


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22736 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2b37d7cf28b1382420b5e4007042feeb66d21ac8 21-Apr-2005 Misha Brukman <brukman+llvm@gmail.com> Remove trailing whitespace


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21416 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6128690c629380291b7185f09cd82ed5244c8a41 06-Apr-2005 Chris Lattner <sabre@nondot.org> Don't make this require loopsimplify. It works BETTER with loop simplify
but should not require it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21123 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
bac5b463965e0e07c7114c5466f35ede0d410e10 09-Mar-2005 Chris Lattner <sabre@nondot.org> Export two methods for getting -X and A-B.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20527 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7192e501eb85fae5d3502e919a76e51eef99ed70 27-Feb-2005 Chris Lattner <sabre@nondot.org> DCE a dead function


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20339 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7ffc07dcf7a0afc5e70e799f26de75750a8008d5 26-Feb-2005 Chris Lattner <sabre@nondot.org> 1 + 100 + 51 == 152, not 52.
If we fold three constants together (c1+c2+c3), make sure to keep
LHSC updated, instead of reusing (in this case), the 1 instead of the
partial sum.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20337 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2352fec2054c89c9720f014936e9f7a685894ccb 17-Feb-2005 Chris Lattner <sabre@nondot.org> Scary typo that fixes Regression/Transforms/IndVarsSimplify/2005-02-17-TruncateExprCrash.ll
and PR515.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20224 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4dc534c7fe93743f28c093dde9332cdb9d8edfa3 13-Feb-2005 Chris Lattner <sabre@nondot.org> Correct the recursive PHI node handling routines in a way that CANNOT induce
infinite loops (using the new replaceSymbolicValuesWithConcrete method).

This patch reverts this patch:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050131/023830.html

... which was an attempted fix for this problem. Unfortunately, that patch
caused test/Regression/Transforms/IndVarsSimplify/exit_value_tests.llx to fail
and slightly castrated the entire analysis. This patch fixes it right.

This patch is dedicated to jeffc, for making me deal with this. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20146 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
caa7c19fb4ca60e21dc8fa9b10c736a05a9f9c22 01-Feb-2005 Chris Lattner <sabre@nondot.org> Fix a problem where we could infinitely recurse on phi nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19955 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ce9653ce449f1409815547e1bf60abcd1332d2c9 07-Dec-2004 Reid Spencer <rspencer@reidspencer.com> For PR387:\
Make only one print method to avoid overloaded virtual warnings when \
compiled with -Woverloaded-virtual


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18589 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6a1a78a478fc1b0f6a1b236cb5cd0cb95e0f42d4 04-Dec-2004 Chris Lattner <sabre@nondot.org> This patch prevents an infinite recursion while compiling 103.su2cor.

All SPEC CFP 95 programs now work, though the JIT isn't loading -lf2c right
so they aren't testing correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18499 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
219c1418153d9b85035957b0e15af75e42f65854 25-Oct-2004 Chris Lattner <sabre@nondot.org> Patch to support MSVC, contributed by Morten Ofstad


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17214 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
673e02b0c37e7a7fa6ffc67bc5e4813a3ce2806d 12-Oct-2004 Chris Lattner <sabre@nondot.org> This nutty patch has been in my tree since before 1.3 went out, and it needs
to go in. This patch allows us to compute the trip count of loops controlled
by values loaded from constant arrays. The cannonnical example of this is
strlen when passed a constant argument:

for (int i = 0; "constantstring"[i]; ++i) ;
return i;

In this case, it will compute that the loop executes 14 times, which means
that the exit value of i is 14. Because of this, the loop gets DCE'd and
we are happy. This also applies to anything that does similar things, e.g.
loops like this:

const float Array[] = { 0.1, 2.1, 3.2, 23.21 };
for (int i = 0; Array[i] < 20; ++i)

and is actually fairly general.

The problem with this is that it almost never triggers. The reason is that
we run indvars and the loop optimizer only at compile time, which is before
things like strlen and strcpy have been inlined into the program from libc.
Because of this, it almost never is used (it triggers twice in specint2k).

I'm committing it because it DOES work, may be useful in the future, and
doesn't slow us down at all. If/when we start running the loop optimizer
at link-time (-O4?) this will be very nice indeed :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16926 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
4a2b23e189cacb3c7afbfe3c38690768a01390ef 11-Oct-2004 Chris Lattner <sabre@nondot.org> Fix SingleSource/Benchmarks/McGill/chomp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16912 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
20aa474f8fbebde588edc101b90e834df28ce4ce 03-Sep-2004 Alkis Evlogimenos <alkis@evlogimenos.com> Fixes to make LLVM compile with vc7.1.

Patch contributed by Paolo Invernizzi!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16152 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
551ccae044b0ff658fe629dd67edd5ffe75d10e8 02-Sep-2004 Reid Spencer <rspencer@reidspencer.com> Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16137 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e840434755e2165ac20ec55e9d5ff3d2defac2d2 18-Jul-2004 Reid Spencer <rspencer@reidspencer.com> bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14942 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
5aa20212cc8dd1008d05915bf23dd02143fc5de9 24-Jun-2004 Chris Lattner <sabre@nondot.org> Remove distasteful method which is really part of the indvars pass


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14359 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
541ad5e19e3e91b843efa5406319c95be0b7287c 20-Jun-2004 Chris Lattner <sabre@nondot.org> REALLY fix PR378: crash in scalar evolution analysis


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14275 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
2d58452f39662d87f441d8c760f3b6f8f9635e0c 20-Jun-2004 Chris Lattner <sabre@nondot.org> Fix a bug in my change last night that caused a few test failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14270 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
8d741b8befcd631384085612d873857157b44577 20-Jun-2004 Chris Lattner <sabre@nondot.org> Do not sort SCEV objects by address: instead sort by complexity and group
by address. This prevents the resultant SCEV objects from depending on
where in memory other scev objects happen to live.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14263 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
6ffe551f657c948d6a473a198ecbd1188bf9ce45 27-Apr-2004 Chris Lattner <sabre@nondot.org> Changes to fix up the inst_iterator to pass to boost iterator checks. This
patch was graciously contributed by Vladimir Prus.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13185 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
b06432c2761ecb84f4149544b56362ac00ef68be 23-Apr-2004 Chris Lattner <sabre@nondot.org> Eliminate all of the SCEV Expansion code which is really part of the
IndVars pass, not part of SCEV *analysis*.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13134 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
45a1cf87d4e473981d9761240a07d3ca383f845a 19-Apr-2004 Chris Lattner <sabre@nondot.org> It's not just a printer, it's actually an analysis too


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13064 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
f1ab4b4eac5603d19c20f4a508f93a118a52bdd5 19-Apr-2004 Chris Lattner <sabre@nondot.org> Change the ExitBlocks list from being explicitly contained in the Loop
structure to being dynamically computed on demand. This makes updating
loop information MUCH easier.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13045 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
3221ad0db784a8c8d6ce3029e2632216764b5533 18-Apr-2004 Chris Lattner <sabre@nondot.org> Add the ability to compute exit values for complex loop using unanalyzable
operations. This allows us to compile this testcase:

int main() {
int h = 1;
do h = 3 * h + 1; while (h <= 256);
printf("%d\n", h);
return 0;
}

into this:

int %main() {
entry:
call void %__main( )
%tmp.6 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([4 x sbyte]* %.str_1, long 0, long 0), int 364 ) ; <int> [#uses=0]
ret int 0
}

This testcase was taken directly from 256.bzip2, believe it or not.

This code is not as general as I would like. Next up is to refactor it
a bit to handle more cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13019 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
7980fb9007b7e13446053daa6a5110aeeb7016dd 17-Apr-2004 Chris Lattner <sabre@nondot.org> Add the ability to compute trip counts that are only controlled by constants
even if the loop is using expressions that we can't compute as a closed-form.
This allows us to calculate that this function always returns 55:

int test() {
double X;
int Count = 0;
for (X = 100; X > 1; X = sqrt(X), ++Count)
/*empty*/;
return Count;
}

And allows us to compute trip counts for loops like:

int h = 1;
do h = 3 * h + 1; while (h <= 256);

(which occurs in bzip2), and for this function, which occurs after inlining
and other optimizations:

int popcount()
{
int x = 666;
int result = 0;
while (x != 0) {
result = result + (x & 0x1);
x = x >> 1;
}
return result;
}

We still cannot compute the exit values of result or h in the two loops above,
which means we cannot delete the loop, but we are getting closer. Being able to
compute a constant trip count for these two loops will allow us to unroll them
completely though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
c598517c24c2ee87acafd67643b9a19bda8514af 16-Apr-2004 Brian Gaeke <gaeke@uiuc.edu> Include <cmath> for compatibility with gcc 3.0.x (the system compiler on
Debian.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12986 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0a7f98c80d5addb504a6f04ebab19f12b89cc448 15-Apr-2004 Chris Lattner <sabre@nondot.org> Factor a bunch of classes out into a public header


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12958 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
0aa84fdd043a7c790be512e10f4e38b43627da81 15-Apr-2004 Chris Lattner <sabre@nondot.org> Unbreak the build


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12956 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e9fc96e7cc437d5f697e9205556099e875c4fc4e 15-Apr-2004 Chris Lattner <sabre@nondot.org> Implement a FIXME: if we're going to insert a cast, we might as well only
insert it once!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12955 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
16011e6201a11ec16968c27a6f62ebf32537969f 14-Apr-2004 Chris Lattner <sabre@nondot.org> This is a trivial tweak to the addrec insertion code: insert the increment
at the bottom of the loop instead of the top. This reduces the number of
overlapping live ranges a lot, for example, eliminating a spill in an important
loop in 183.equake with linear scan.

I still need to make the exit comparison of the loop use the post-incremented
version of this variable, but this is an easy first step.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12952 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
627018b4b3ff566eb6eba487c93e76d9ae1f46ea 07-Apr-2004 Chris Lattner <sabre@nondot.org> Fix a bug Brian found.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12754 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ea9e005ce617d48d061a30c04956380952ec1a6d 05-Apr-2004 Chris Lattner <sabre@nondot.org> Sparc don't got not "sqrtl", bum bum bum


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12670 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
bb2aff1e18d6f5abb934ab2d3ea1cfb89729239c 05-Apr-2004 Misha Brukman <brukman+llvm@gmail.com> Kill warnings during an optimized compile where assert() disappears.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12669 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
ddd947f21a8ef355412a83dc34ce452afe7c3597 05-Apr-2004 Chris Lattner <sabre@nondot.org> Fix PR312 and IndVarsSimplify/2004-04-05-InvokeCastCrash.llx


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12668 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
e34c0b48a07ea4f03f81cd46986486c8fe065e7e 03-Apr-2004 Chris Lattner <sabre@nondot.org> Add a break in the default case


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12639 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
d18d9dcd2866ef91ee42daf68e32b638e7825211 02-Apr-2004 Chris Lattner <sabre@nondot.org> Comment out debugging printouts


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12623 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp
53e677abadadf71ef33f2f69533a32c1fa3d168f 02-Apr-2004 Chris Lattner <sabre@nondot.org> Add a new analysis


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12619 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolution.cpp