History log of /external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
cd81d94322a39503e4a3e87b6ee03d4fcb3465fb 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/ScalarEvolutionExpander.cpp
dce4a407a24b04eebc6a376f8e62b41aaa7b071f 29-May-2014 Stephen Hines <srhines@google.com> Update LLVM for 3.5 rebase (r209712).

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

Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
4d4bbaf997c16f9e79503bd640306d784efd090e 25-Oct-2013 Andrew Trick <atrick@apple.com> Fix SCEVExpander: don't try to expand quadratic recurrences outside a loop.

Partial fix for PR17459: wrong code at -O3 on x86_64-linux-gnu
(affecting trunk and 3.3)

When SCEV expands a recurrence outside of a loop it attempts to scale
by the stride of the recurrence. Chained recurrences don't work that
way. We could compute binomial coefficients, but would hve to
guarantee that the chained AddRec's are in a perfectly reduced form.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193438 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
341562b9fb6574b1c9492e52cec24106cd31ce51 01-Oct-2013 Benjamin Kramer <benny.kra@googlemail.com> SCEVExpander: Fix a regression I introduced by to eagerly adding RAII objects.

PR17425.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191741 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
d4278821665aa97f5fc0d19a32ff1fb39a22d395 30-Sep-2013 Benjamin Kramer <benny.kra@googlemail.com> Convert manual insert point restores to the new RAII object.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191675 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
19046ec19c4931f025cd4730eb43e9203ada6bb7 18-Aug-2013 Hal Finkel <hfinkel@anl.gov> Fix SCEVExpander creating distinct duplicate PHI entries

This fixes SCEVExpander so that it does not create multiple distinct induction
variables for duplicate PHI entries. Specifically, given some code like this:

do.body6: ; preds = %do.body6, %do.body6, %if.then5
%end.0 = phi i8* [ undef, %if.then5 ], [ %incdec.ptr, %do.body6 ], [ %incdec.ptr, %do.body6 ]
...

Note that it is legal to have multiple entries for a basic block so long as the
associated value is the same. So the above input is okay, but expanding an
AddRec in this loop could produce code like this:

do.body6: ; preds = %do.body6, %do.body6, %if.then5
%indvar = phi i64 [ %indvar.next, %do.body6 ], [ %indvar.next1, %do.body6 ], [ 0, %if.then5 ]
%end.0 = phi i8* [ undef, %if.then5 ], [ %incdec.ptr, %do.body6 ], [ %incdec.ptr, %do.body6 ]
...
%indvar.next = add i64 %indvar, 1
%indvar.next1 = add i64 %indvar, 1

And this is not legal because there are two PHI entries for %do.body6 each with
a distinct value.

Unfortunately, I don't have an in-tree test case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
6f71dd765ae9e1d1d0ba01d98a05627ffe3bfc8a 14-Jul-2013 Andrew Trick <atrick@apple.com> Remove a bunch of old SCEVExpander FIXME's for preserving NoWrap.

The great thing about the SCEVAddRec No-Wrap flag (unlike nsw/nuw) is
that is can be preserved while normalizing (reassociating and
factoring).

The bad thing is that is can't be tranfered back to IR, which is one
of the reasons I don't like the concept of SCEVExpander.

Sorry, I can't think of a direct way to test this, which is why these
were FIXMEs for so long. I just think it's a good time to finally
clean it up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186273 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
409443b1c6415e55c2bd4f0662e14cbc52d16686 14-Jul-2013 Andrew Trick <atrick@apple.com> Teach indvars to generate nsw/nuw flags when widening an induction variable.

Fixes PR16600.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186272 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
1ba5769676bb14078ddbdb9760523619726800c0 14-Jan-2013 Andrew Trick <atrick@apple.com> SCEVExpander fix. RAUW needs to update the InsertedExpressions cache.

Note that this bug is only exposed because LTO fails to use TTI.

Fixes self-LTO of clang. rdar://13007381.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172462 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
e4ba75f43e2ab1480d119d2d4eb878256274e0fb 07-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Switch the SCEV expander and LoopStrengthReduce to use
TargetTransformInfo rather than TargetLowering, removing one of the
primary instances of the layering violation of Transforms depending
directly on Target.

This is a really big deal because LSR used to be a "special" pass that
could only be tested fully using llc and by looking at the full output
of it. It also couldn't run with any other loop passes because it had to
be created by the backend. No longer is this true. LSR is now just
a normal pass and we should probably lift the creation of LSR out of
lib/CodeGen/Passes.cpp and into the PassManagerBuilder. =] I've not done
this, or updated all of the tests to use opt and a triple, because
I suspect someone more familiar with LSR would do a better job. This
change should be essentially without functional impact for normal
compilations, and only change behvaior of targetless compilations.

The conversion required changing all of the LSR code to refer to the TTI
interfaces, which fortunately are very similar to TargetLowering's
interfaces. However, it also allowed us to *always* expect to have some
implementation around. I've pushed that simplification through the pass,
and leveraged it to simplify code somewhat. It required some test
updates for one of two things: either we used to skip some checks
altogether but now we get the default "no" answer for them, or we used
to have no information about the target and now we do have some.

I've also started the process of removing AddrMode, as the TTI interface
doesn't use it any longer. In some cases this simplifies code, and in
others it adds some complexity, but I think it's not a bad tradeoff even
there. Subsequent patches will try to clean this up even further and use
other (more appropriate) abstractions.

Yet again, almost all of the formatting changes brought to you by
clang-format. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171735 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
a04a4a79ea365d1ba96ed4b5861e879b267162e2 19-Oct-2012 Nadav Rotem <nrotem@apple.com> revert r166264 because the LTO build is still failing

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166340 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
239fd44f7a68aae4b2e8b6f1738ef9e8fd4ddc01 19-Oct-2012 Benjamin Kramer <benny.kra@googlemail.com> SCEVExpander: Don't crash when trying to merge two constant phis.

Just constant fold them so they can't cause any trouble. Fixes PR12627.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166286 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
725f1d12801109a3b1d081a6e1c9e44426b2cf34 19-Oct-2012 Nadav Rotem <nrotem@apple.com> recommit the patch that makes LSR and LowerInvoke use the TargetTransform interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166264 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
3b9a911efcf280950f878a050728450423875639 18-Oct-2012 Bob Wilson <bob.wilson@apple.com> Temporarily revert the TargetTransform changes.

The TargetTransform changes are breaking LTO bootstraps of clang. I am
working with Nadav to figure out the problem, but I am reverting it for now
to get our buildbots working.

This reverts svn commits: 165665 165669 165670 165786 165787 165997
and I have also reverted clang svn 165741

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166168 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
e3d0e86919730784faaddcb5d9b0257c39b0804b 11-Oct-2012 Nadav Rotem <nrotem@apple.com> Add a new interface to allow IR-level passes to access codegen-specific information.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165665 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
c8e41c591741b3da1077f7000274ad040bef8002 23-Jul-2012 Sylvestre Ledru <sylvestre@debian.org> Fix a typo (the the => the)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160621 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
e08c32249fca32cd7b122024a4ca252fcb235694 14-Jul-2012 Andrew Trick <atrick@apple.com> LSR Fix: check SCEV expression safety before expansion.

All SCEV expressions used by LSR formulae must be safe to
expand. i.e. they may not contain UDiv unless we can prove nonzero
denominator.

Fixes PR11356: LSR hoists UDiv.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160205 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
3de8ad8bf9081fcb7ec0600fd2a8d1ce809f556d 22-May-2012 Andrew Trick <atrick@apple.com> LSR fix: add a missing phi check during IV hoisting.

Fixes PR12898: SCEVExpander crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157263 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
23b6ec906a081259dad4672ec386ddfb52cd0d9f 27-Feb-2012 Rafael Espindola <rafael.espindola@gmail.com> Fix this assert. IP can point to an instruction with strange dominance
properties (invoke). Just assert that the instruction we return dominates
the insertion point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151511 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
32c185eb272d2aabc0162b5f01cf1369b70d8fe1 26-Feb-2012 Rafael Espindola <rafael.espindola@gmail.com> And update the comment...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151472 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
5b04cfb78514cf4dbed4b989a3b07310a91df7f7 26-Feb-2012 Rafael Espindola <rafael.espindola@gmail.com> Enable the assert that got all this dominator work started.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151471 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
c9ae8cc24c70dda33b68cacf01d2feeeb836f6f2 26-Feb-2012 Rafael Espindola <rafael.espindola@gmail.com> Change the implementation of dominates(inst, inst) to one based on what the
verifier does. This correctly handles invoke.
Thanks to Duncan, Andrew and Chris for the comments.
Thanks to Joerg for the early testing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151469 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
7481d07a076420e192f95c22e4866c4aee243c80 23-Feb-2012 Rafael Espindola <rafael.espindola@gmail.com> Fix typo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151238 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
b84d540bc9d70de00b791d0e0deab410d6ba3ad5 22-Feb-2012 Rafael Espindola <rafael.espindola@gmail.com> Improve comment. Thanks for Andrew for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151127 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
919a503458c18472984c7c37b305110c9ba3a782 22-Feb-2012 Rafael Espindola <rafael.espindola@gmail.com> Semantically revert 151015. Add a comment on why we should be able to assert
the dominance once the dominates method is fixed and why we can use the builder's
insertion point.
Fixes pr12048.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151125 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
e16da6c0209de26f96d2dc71b4ea1ed6fc50c564 21-Feb-2012 Rafael Espindola <rafael.espindola@gmail.com> s/the the/the/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151079 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
705b48d960dff1a96ac40d0cf932eb465b9a550a 21-Feb-2012 Rafael Espindola <rafael.espindola@gmail.com> Use more idiomatic assert.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151026 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
161fb5d936e8feb730b5598243e20c76d3dc62f7 21-Feb-2012 Rafael Espindola <rafael.espindola@gmail.com> Avoid warning on non assert builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151025 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
4b04578d65e38cdb5077de2498889e4a174ccdfd 21-Feb-2012 Rafael Espindola <rafael.espindola@gmail.com> It turns out that with the current scev organization ReuseOrCreateCast cannot
know where users will be added. Because of this, it cannot use
Builder.GetInsertPoint at all.

This patch
* removes the FIXME about adding the assert.
* adds a comment explaining hy we don't have one.
* removes a broken logic that only works for some callers and is not needed
since r150884.
* adds an assert to caller that would have caught the bug fixed by r150884.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151015 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
f3b32b35729a431c38877c22e353ac7cbee22e4b 18-Feb-2012 Rafael Espindola <rafael.espindola@gmail.com> Temporarily disable this assert. Looks like it found a similar issue when
building bullet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
ef4c80e07baf02dd2a8f08db49c5634a06d3ca1e 18-Feb-2012 Rafael Espindola <rafael.espindola@gmail.com> Don't skip debug instructions when looking for the insertion point of
the cast. If we do, we can end up with

inst1
--------------- < Insertion point
dbg inst
new inst

instead of the desired

inst1
new inst
--------------- < Insertion point
dbg inst

Another option would be for InsertNoopCastOfTo (or its callers) to move the
insertion point and we would end up with

inst1
dbg inst
new inst
--------------- < Insertion point

but that complicates the callers. This fixes PR12018 (and firefox's build).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
b5c26ef9da16052597d59a412eaae32098aa1be0 20-Jan-2012 Andrew Trick <atrick@apple.com> SCEVExpander fixes. Affects LSR and indvars.

LSR has gradually been improved to more aggressively reuse existing code, particularly existing phi cycles. This exposed problems with the SCEVExpander's sloppy treatment of its insertion point. I applied some rigor to the insertion point problem that will hopefully avoid an endless bug cycle in this area. Changes:

- Always used properlyDominates to check safe code hoisting.

- The insertion point provided to SCEV is now considered a lower bound. This is usually a block terminator or the use itself. Under no cirumstance may SCEVExpander insert below this point.

- LSR is reponsible for finding a "canonical" insertion point across expansion of different expressions.

- Robust logic to determine whether IV increments are in "expanded" form and/or can be safely hoisted above some insertion point.

Fixes PR11783: SCEVExpander assert.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148535 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
dd1f22f25d8496b10cfddedb63d674dd39897bb0 14-Jan-2012 Andrew Trick <atrick@apple.com> Fix a corner case hit by redundant phi elimination running after LSR.

Fixes PR11761: bad IR w/ redundant Phi elim


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148177 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
64925c55c65f9345a69fb67db07aa62cfb723577 10-Jan-2012 Andrew Trick <atrick@apple.com> Enable LSR IV Chains with sufficient heuristics.

These heuristics are sufficient for enabling IV chains by
default. Performance analysis has been done for i386, x86_64, and
thumbv7. The optimization is rarely important, but can significantly
speed up certain cases by eliminating spill code within the
loop. Unrolled loops are prime candidates for IV chains. In many
cases, the final code could still be improved with more target
specific optimization following LSR. The goal of this feature is for
LSR to make the best choice of induction variables.

Instruction selection may not completely take advantage of this
feature yet. As a result, there could be cases of slight code size
increase.

Code size can be worse on x86 because it doesn't support postincrement
addressing. In fact, when chains are formed, you may see redundant
address plus stride addition in the addressing mode. GenerateIVChains
tries to compensate for the common cases.

On ARM, code size increase can be mitigated by using postincrement
addressing, but downstream codegen currently misses some opportunities.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147826 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
139f333f88fb9e0c39dfa3b56fd2a26b33837b70 07-Jan-2012 Andrew Trick <atrick@apple.com> Cleanup comments and argument types related to my previous replaceCongruentPhis checkin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147709 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
ee98aa87434d9d49a8e4dab41d873888ac9c4805 07-Jan-2012 Andrew Trick <atrick@apple.com> Extended replaceCongruentPhis to handle mixed phi types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147707 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
3326ec18423716da3a768caae2691e7858913548 06-Jan-2012 Andrew Trick <atrick@apple.com> SCEVExpander: hoistStep should check strict dominance.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147683 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
0f8cd56bfdd32af4edb253654db02fb3143b25a8 02-Jan-2012 Andrew Trick <atrick@apple.com> Fix SCEVExpander to handle loops with no preheader when LSR gives it a
"phony" insertion point.

Fixes rdar://10619599: "SelectionDAGBuilder shouldn't visit PHI nodes!" assert


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147439 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
ba3c0bc364a31bfbcc570504aae2172914b1fe9f 20-Dec-2011 Andrew Trick <atrick@apple.com> LSR: Fix another corner case in expansion of postinc users.

Fixes PR11571: Instruction does not dominate all uses


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146950 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
19154f457696f286b4a597179fa07e3b38ea0310 14-Dec-2011 Andrew Trick <atrick@apple.com> LSR: Fold redundant bitcasts on-the-fly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146597 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
553fe05f236f46fe27b7fcfa822b06367d50183e 30-Nov-2011 Andrew Trick <atrick@apple.com> LSR: handle the expansion of phi operands that use postinc forms of the IV.

Fixes PR11431: SCEVExpander::expandAddRecExprLiterally(const llvm::SCEVAddRecExpr*): Assertion `(!isa<Instruction>(Result) || SE.DT->dominates(cast<Instruction>(Result), Builder.GetInsertPoint())) && "postinc expansion does not dominate use"' failed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145482 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
365c9f1ff55bef134c6b9707f7df44d680ddabea 15-Oct-2011 Andrew Trick <atrick@apple.com> Fix SCEVExpander assert during LSR: "argument of incompatible type".

Just because we're dealing with a GEP doesn't mean we can assert the
SCEV has a pointer type. The fix is simply to ignore the SCEV pointer
type, which we really didn't need.
Fixes PR11138 webkit crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142058 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
48ba0e45ed68689ce7b384578e6272410e4e23fe 13-Oct-2011 Andrew Trick <atrick@apple.com> Reapply r141870, SCEV expansion of post-inc.

Speculatively reapply to see if this test case still crashes on
linux. I may have fixed it in my last checkin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141895 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
753e02ad5d7042bc6bf175c676327ae9486a8341 13-Oct-2011 Andrew Trick <atrick@apple.com> Revert r141870. The test case crashes on linux with data corruption. A deeper issue was exposed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141873 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
b00175913a24b7d8bdca96c1fded582bd1a071cb 13-Oct-2011 Andrew Trick <atrick@apple.com> LSR: Reuse the post-inc expansion of expressions.

This avoids unnecessary expansion of expressions and allows the SCEV
expander to work on expression DAGs, not just trees.
Fixes PR11090.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141870 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
204494149b6f846e8f173f525b129f5508076049 11-Oct-2011 Andrew Trick <atrick@apple.com> Move replaceCongruentIVs into SCEVExapander and bias toward "expanded"
IVs.

Indvars previously chose randomly between congruent IVs. Now it will
bias the decision toward IVs that SCEVExpander likes to create. This
was not done to fix any problem, it's just a welcome side effect of
factoring code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141633 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
94794dd8d38d2572896625fc58e6b0f37809edfa 08-Oct-2011 Andrew Trick <atrick@apple.com> Add an extra safety check in front of the optimization in r141442.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141470 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
c5701910604cdf65811fabd31d41e38f1d1d4eb1 08-Oct-2011 Andrew Trick <atrick@apple.com> LSR should only reuse phis that match its formula.

Fixes rdar://problem/5064068


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141442 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
a9390a4d5f5d568059a80970d22194b165d097a7 27-Sep-2011 Benjamin Kramer <benny.kra@googlemail.com> Stop emitting instructions with the name "tmp" they eat up memory and have to be uniqued, without any benefit.

If someone prefers %tmp42 to %42, run instnamer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140634 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
a4c86ab073d4b7a36477fc7c54c9d52499f04586 24-Aug-2011 Bill Wendling <isanbard@gmail.com> Skip the landingpad instruction when determining the insertion point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138481 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
5b6f42f57e730c2d968c313a27fa505a3c3e5efa 16-Aug-2011 Bill Wendling <isanbard@gmail.com> Use the getFirstInsertionPt() method instead of getFirstNonPHI + an 'isa<>'
check for a LandingPadInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137745 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
05d0023a95a11cde1247920d61d26cc82216f566 16-Aug-2011 Bill Wendling <isanbard@gmail.com> A few places where we want to skip the landingpad instruction for insertion.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137712 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
0a2a60ace9b79164b71794ce7ff981171c61e442 22-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert IRBuilder::CreateGEP and IRBuilder::CreateInBoundsGEP to use
ArrayRef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135761 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
dab3d29605a5c83db41b28176273ef55961120c1 21-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert ConstantExpr::getGetElementPtr and
ConstantExpr::getInBoundsGetElementPtr to use ArrayRef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
93a896e2e36480d55de3bab53e68581e08526344 17-Jul-2011 Benjamin Kramer <benny.kra@googlemail.com> Silence compiler warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135358 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
d152d03a476b8d0d4b26577db26e2ba76034b0f3 16-Jul-2011 Andrew Trick <atrick@apple.com> Fix SCEVEXpander to handle arbitrary phi expansion. Includes two
related bug fixes and corresponding assertions for uninitialized data
and missing NULL check. Test cases will be included with the new LFTR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135333 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
c5ecbdc1896f1cc089372feef3191ace2f840898 05-Jul-2011 Devang Patel <dpatel@apple.com> Preserve debug loc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134441 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
dc8e546048db2f7ff5656742b2b26975098a11a0 28-Jun-2011 Andrew Trick <atrick@apple.com> Cleanup. Fix a stupid variable name.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133995 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
5e7645be4c9dd2193add44d30b5fef8036d7a3ce 28-Jun-2011 Andrew Trick <atrick@apple.com> SCEVExpander: give new insts a name that identifies the reponsible pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133992 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
df3ad6697bb849e514c0881ca8700ea36678cbda 22-Jun-2011 Devang Patel <dpatel@apple.com> New binops need debug loc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133642 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
3ecfc861b4365f341c5c969b40e1afccde676e6f 30-Mar-2011 Jay Foad <jay.foad@gmail.com> Remove PHINode::reserveOperandSpace(). Instead, add a parameter to
PHINode::Create() giving the (known or expected) number of operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
d8b4fb4aab4d6fedb2b14bed1b846451b17bde7c 30-Mar-2011 Jay Foad <jay.foad@gmail.com> (Almost) always call reserveOperandSpace() on newly created PHINodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128535 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
a7a841adb89efa6ad3b35e9d4bcccccfb8ca146a 04-Mar-2011 Dan Gohman <gohman@apple.com> When decling to reuse existing expressions that involve casts, ignore
bitcasts, which are really no-ops here. This fixes slowdowns on
MultiSource/Applications/aha and others.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127031 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
0cbe91ba3bd84a5ef68a1d0de5df6e955690b0a4 02-Mar-2011 Dan Gohman <gohman@apple.com> Don't re-use existing addrec expansions if they contain casts.
This fixes PR9259.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126812 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
6ebfd72f37325a1ebceb53e5ecad524d359d8d0b 26-Jul-2010 Dan Gohman <gohman@apple.com> Fix SCEVExpander::visitAddRecExpr so that it remembers the induction variable
it inserted rather than using LoopInfo::getCanonicalInductionVariable to
rediscover it, since that doesn't work on non-canonical loops. This fixes
infinite recurrsion on such loops; PR7562.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109419 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
133e295b363c89b6a3da7aba3ac5ae6332429e46 20-Jul-2010 Dan Gohman <gohman@apple.com> Simplify this code; LoopInfo::getCanonicalInductionVariable will only
find integer induction variables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108853 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
7c58dbd88c36c5d6c411ea6c046ddcff4c5841e9 20-Jul-2010 Dan Gohman <gohman@apple.com> Make getOrInsertCanonicalInductionVariable guarantee that its
result is a PHINode*.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
bb5d92741b2835eff25e4524bc6a5b0fb4fda855 16-Jul-2010 Dan Gohman <gohman@apple.com> Fix the order that SCEVExpander considers add operands in so that
it doesn't miss an opportunity to form a GEP, regardless of the
relative loop depths of the operands. This fixes rdar://8197217.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
19e5ada58a8a07d3d6d67312550f6d0791d84c3c 09-Jul-2010 Gabor Greif <ggreif@gmail.com> remove useless cast and fix typos in comment

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107989 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
f64f9cf7ec39ae91bca84dc6ad3c8fc3343b358a 09-Jul-2010 Gabor Greif <ggreif@gmail.com> cache result of operator*

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107988 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
7656018c2268285907cfdc106071462a01a73878 09-Jul-2010 Gabor Greif <ggreif@gmail.com> cache result of operator*

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107976 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
204b7cad7a7395f5fa841619215fa3280b3b4f02 30-Jun-2010 Dan Gohman <gohman@apple.com> Simplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107248 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
6f5fed253f58645bf45448893a585ffbd9914989 20-Jun-2010 Dan Gohman <gohman@apple.com> Restore a call to rememberInstruction which was accidentally dropped
in refactoring.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106398 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
485c43fc478d5e16c55e14cb2586b56cc1c4c91f 19-Jun-2010 Dan Gohman <gohman@apple.com> Factor out duplicated code for reusing and inserting casts into
a helper function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106388 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
08f55d02da2cd24f3b4297259ef6429b8bf1ef97 16-Jun-2010 Jim Grosbach <grosbach@apple.com> A few more places where SCEVExpander bits need to skip over debug intrinsics
when iterating through instructions. Yet more work for rdar://7797940

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106149 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
25fcaff409f5c4c6da08f148ffb9404a71e8e4a7 05-Jun-2010 Dan Gohman <gohman@apple.com> LSR needs to remember inserted instructions even in postinc mode, because
there could be multiple subexpressions within a single expansion which
require insert point adjustment. This fixes PR7306.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105510 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
948c8a3e3d7349c67e5d9231d9e99b2692623630 26-Apr-2010 Dan Gohman <gohman@apple.com> When checking whether the special handling for an addrec increment which
doesn't dominate the header is needed, don't check whether the increment
expression has computable loop evolution. While the operands of an
addrec are required to be loop-invariant, they're not required to
dominate any part of the loop. This fixes PR6914.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102389 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
b35798347ea87b8b6d36155b211016a7769f01ab 15-Apr-2010 Dan Gohman <gohman@apple.com> Fix a bunch of namespace polution.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101376 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
f8d0578e4cbd5922696c92f5068c5513d8e8d60e 09-Apr-2010 Dan Gohman <gohman@apple.com> When emitting code for an add, don't force a SCEVUnknown wrapper around
a hoisted intermediate result if the intermediate result isn't an
Instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
53b73a283e0a0339f7a273775ee21ebcc220b089 09-Apr-2010 Dan Gohman <gohman@apple.com> Add a comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100874 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
448db1cdef5872713ef77beffacf502ae3450cd7 08-Apr-2010 Dan Gohman <gohman@apple.com> Generalize IVUsers to track arbitrary expressions rather than expressions
explicitly split into stride-and-offset pairs. Also, add the
ability to track multiple post-increment loops on the same expression.

This refines the concept of "normalizing" SCEV expressions used for
to post-increment uses, and introduces a dedicated utility routine for
normalizing and denormalizing expressions.

This fixes the expansion of expressions which are post-increment users
of more than one loop at a time. More broadly, this takes LSR another
step closer to being able to reason about more than one loop at a time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100699 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
e059ee832ca36d65a5fb87b0ac5bcdb0490b15cb 23-Mar-2010 Dan Gohman <gohman@apple.com> Don't back past debug info intrinsics; SCEVExpander's strategy
for ignoring debug info intrinsics everywhere else is to advance
past them, and it needs to be consistent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99332 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
6c7ed6b54949949806797bafdf545fbfecb2cef5 19-Mar-2010 Dan Gohman <gohman@apple.com> Fix more places to more thoroughly ignore debug intrinsics. This fixes
use-before-def errors in SCEVExpander-produced code in sqlite3 when debug
info with optimization is enabled, though the testcases for this are
dependent on use-list order.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99001 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
768069ee7a11756b9ba658a4395faa802fc71548 09-Mar-2010 Dale Johannesen <dalej@apple.com> Another place where debug info affected codegen.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98026 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
621e06f9dfef66fdd65218c8bdc8936cc1d734e3 06-Mar-2010 Dale Johannesen <dalej@apple.com> Fix another case where LSR was affected by debug info.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97865 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
8d50ea760322630dbb9ab6436ca356b279adee10 05-Mar-2010 Dale Johannesen <dalej@apple.com> Fix a case where LSR is sensitive to debug info.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97830 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
087bd1e3a12893873761736bf0f905a350e9e708 03-Mar-2010 Dan Gohman <gohman@apple.com> Make SCEVExpander and LSR more aggressive about hoisting expressions out
of loops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97642 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
ed78dbafd05ccc9dd4eb6e9e4d750d8aaacbe43a 03-Mar-2010 Dan Gohman <gohman@apple.com> Revert r97580; that's not the right way to fix this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97639 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
c4f7ec85ecb760fff2b702c6deb06506b968ba4f 02-Mar-2010 Dan Gohman <gohman@apple.com> When expanding an expression such as (A + B + C + D), sort the operands
by loop depth and emit loop-invariant subexpressions outside of loops.
This speeds up MultiSource/Applications/viterbi and others.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97580 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
069d6f3396856655d5d4ba155ee16eb0209d38b0 02-Mar-2010 Dan Gohman <gohman@apple.com> Non-affine post-inc SCEV expansions have more code which must be
emitted after the increment. Make sure the insert position
reflects this. This fixes PR6453.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
9feae9f0de032c66d01d16399a4c5296e38870e3 17-Feb-2010 Dan Gohman <gohman@apple.com> Fix SCEVExpander's existing PHI reuse checking to recognize the
case where there are loop-invariant instructions somehow left
inside the loop, and in a position where they won't dominate
the IV increment position.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96448 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
22e621908fdb121474f4806f15ec5c0ce2efeb0a 16-Feb-2010 Dan Gohman <gohman@apple.com> When reusing an existing PHI node in a loop, be even more
strict about the requirements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96301 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
455985501381777db03534c925a35e261e356395 15-Feb-2010 Dan Gohman <gohman@apple.com> When restoring a saved insert location, check to see if the saved
insert location has become an "inserted" instruction since the time
it was saved. If so, advance to the first non-"inserted" instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96203 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
1d826a76f591afea445489b9a5485c345e66bf87 14-Feb-2010 Dan Gohman <gohman@apple.com> In rememberInstruction, if the value being remembered is the
current insertion point, advance the current insertion point.
This avoids a use-before-def situation in a testcase extracted
from clang which is difficult to reduce to a reasonable-sized
regression test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96151 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
0a799ab15801d4ebf68eeb151d6375a799c87d9a 12-Feb-2010 Dan Gohman <gohman@apple.com> Fix a case of mismatched types in an Add that turned up in 447.dealII.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96007 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
572645cf84060c0fc25cb91d38cb9079918b3a88 12-Feb-2010 Dan Gohman <gohman@apple.com> Reapply the new LoopStrengthReduction code, with compile time and
bug fixes, and with improved heuristics for analyzing foreign-loop
addrecs.

This change also flattens IVUsers, eliminating the stride-oriented
groupings, which makes it easier to work with.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95975 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
150dfa87113e51881c75676edd8e3549eb702d99 28-Jan-2010 Dan Gohman <gohman@apple.com> Check Type::isSized before calling ScalarEvolution::getAllocSizeExpr,
rather than after.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94742 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
c37e3d5d7cd9576711204dfd0240edefba2df4c7 21-Jan-2010 Dan Gohman <gohman@apple.com> When re-using an existing cast for a user, it's still necessary to call
rememberInstruction so that future users of that user will be inserted
in the correct position. This fixes the Darwin selfhost.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94070 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
3abf905b50f33340ae81913da81b0eda96fa4616 19-Jan-2010 Dan Gohman <gohman@apple.com> Fix a typo and an 80-column violation in comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
eb35699e642f2c021f04154bdb4bd90a1afb3baa 04-Dec-2009 Bob Wilson <bob.wilson@apple.com> Fix a comment typo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90511 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
7896c9f436a4eda5ec15e882a7505ba482a2fcd0 03-Dec-2009 Chris Lattner <sabre@nondot.org> improve portability to avoid conflicting with std::next in c++'0x.
Patch by Howard Hinnant!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90365 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
ac53a0b272452013124bfc70480aea5e41b60f40 06-Oct-2009 Duncan Sands <baldrick@free.fr> Introduce and use convenience methods for getting pointer types
where the element is of a basic builtin type. For example, to get
an i8* use getInt8PtrTy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83379 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
f3f1be6f065d1b90afe80ca80c9d6473c10deb5a 28-Sep-2009 Dan Gohman <gohman@apple.com> When extending the operands of an addrec, iterate through all
the operands, rather than trying to partition them into a start
and a step. This handles non-affine add recurrences correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83011 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
83d577490b1473213b6973236110c28e59127956 27-Sep-2009 Dan Gohman <gohman@apple.com> Fix SCEVExpander's canonical addrec expansion code to work on loops that
aren't in canonical loop-simplify form, since it doesn't itself depend
on LoopSimplify. This means handling loops without preheaders and loops
with multiple backedges.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82905 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
c70c37794fbff2c615d4f9dc3b6adf9583b855dc 26-Sep-2009 Dan Gohman <gohman@apple.com> Fix a case where ScalarEvolution was expanding pointer arithmetic
to inttoptr/ptrtoint unnecessarily.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82864 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
d6aa02de1076c801ac41295156a2379637976918 28-Jul-2009 Dan Gohman <gohman@apple.com> Teach instcombine to respect and preserve inbounds. Add inbounds
to a few tests where it is required for the expected transformation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77290 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
13c5e35222afe0895f0c5e68aa9f22f134ea437a 20-Jul-2009 Dan Gohman <gohman@apple.com> Update this comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76438 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
0196dc5733bf3c6a71f7de1f631f2c43e5809fd9 14-Jul-2009 Dan Gohman <gohman@apple.com> Fix the expansion of umax and smax in the case where one or more of
the operands have pointer type, so that the resulting type matches
the original SCEV type, and so that unnecessary ptrtoints are
avoided in common cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
5001c21712f2e52fd6254461b2b2edb9a5823d23 30-Jun-2009 Dan Gohman <gohman@apple.com> Minor formatting, whitespace, and 80-column fixes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74492 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
267a385342f2e7388f178b327dd87c5f29afd51b 27-Jun-2009 Dan Gohman <gohman@apple.com> Change SCEVExpander to use an IRBuilder to emit instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74391 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
667d787c0a21cf3f5dfcde03ca471162ba35b614 27-Jun-2009 Dan Gohman <gohman@apple.com> Incorporate the insertion point into the key of SCEVExpander's CSE map.
This helps it avoid reusing an instruction that doesn't dominate all
of the users, in cases where the original instruction was inserted
before all of the users were known. This may result in redundant
expansions of sub-expressions that depend on loop-unpredictable values
in some cases, however this isn't very common, and it primarily impacts
IndVarSimplify, so GVN can be expected to clean these up.

This eliminates the need for IndVarSimplify's FixUsesBeforeDefs,
which fixes several bugs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74352 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
469f3cdc13851914f3a766cbd8f701cf8431caca 23-Jun-2009 Dan Gohman <gohman@apple.com> Fix a few minor issues that were exposed by the removal of SCEVHandle.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73910 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
4d8414f42033a5e744e8e60d2ca188b424c76168 13-Jun-2009 Dan Gohman <gohman@apple.com> Teach SCEVExpander's visitAddRecExpr to reuse an existing canonical
induction variable when the addrec to be expanded does not require
a wider type. This eliminates the need for IndVarSimplify to
micro-manage SCEV expansions, because SCEVExpander now
automatically expands them in the form that IndVarSimplify considers
to be canonical. (LSR still micro-manages its SCEV expansions,
because it's optimizing for the target, rather than for
other optimizations.)

Also, this uses the new getAnyExtendExpr, which has more clever
expression simplification logic than the IndVarSimplify code it
replaces, and this cleans up some ugly expansions in code such as
the included masked-iv.ll testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73294 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
92fcdcac543653a62949fe9e5a7bd008500c1380 09-Jun-2009 Dan Gohman <gohman@apple.com> Use expandCodeFor instead of expand when the result will be
immediately casted. At present, this is just a minor code
simplification. In the future, the expansion code may be able
to make better choices if it knows what the desired result
type will be.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73137 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
1d09de3eca23267855e28297fcb40de3632ea47b 05-Jun-2009 Dan Gohman <gohman@apple.com> Move SCEVExpander::getOrInsertCanonicalInductionVariable out of line.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
f1a80489d6e9c76f52d9e6f59103a4fb2062e057 27-May-2009 Dan Gohman <gohman@apple.com> Add braces around an array initializer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72453 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
4a4f767235dac50965fc266fb822d9a2e37d5212 27-May-2009 Dan Gohman <gohman@apple.com> Teach SCEVExpander to avoid creating over-indexed GEP indices when
possible. For example, it now emits

%p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 2, i64 %tmp, i64 1

instead of the equivalent but less obvious

%p.2.ip.1 = getelementptr [3 x [3 x double]]* %p, i64 0, i64 %tmp, i64 19


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72452 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
f876ad0a70c5c3bb402de2766237410f041700e6 26-May-2009 Dan Gohman <gohman@apple.com> In cases where a pointer value is an operand of a multiplication or
division operation, don't attempt to use the operation's value as
the base of a getelementptr. This fixes PR4271.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72422 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
3790fb0c036acaa4db50aff83dd8b3bf51f8af6a 24-May-2009 Torok Edwin <edwintorok@gmail.com> Instead of clearing the rewriter, don't attempt to rewrite dead phi nodes.
Also fix 80 column violation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72371 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
fb5a3419f351056e0f599699d276bcab412d2cce 24-May-2009 Dan Gohman <gohman@apple.com> Fix this code for hosts where std::vector doesn't have .data().
Use &Ops[0] instead, which is safe since Ops will never be empty here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72368 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
453aa4fbf1083cc7f646a0ac21e2bcc384a91ae9 24-May-2009 Dan Gohman <gohman@apple.com> Generalize SCEVExpander::visitAddRecExpr's GEP persuit, and avoid
sending SCEVUnknowns to expandAddToGEP. This avoids the need for
expandAddToGEP to bend the rules and peek into SCEVUnknown
expressions.

Factor out the code for testing whether a SCEV can be factored by
a constant for use in a GEP index. This allows it to handle
SCEVAddRecExprs, by recursing.

As a result, SCEVExpander can now put more things in GEP indices,
so it emits fewer explicit mul instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
b679de2a21f5ecbae81b444290d72af93aa5b0b3 24-May-2009 Torok Edwin <edwintorok@gmail.com> The rewriter may hold references to instructions that are deleted because they are trivially dead.
Fix by clearing the rewriter cache before deleting the trivially dead
instructions.
Also make InsertedExpressions use an AssertingVH to catch these
bugs easier.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
0d56b06f86d6e1707aec9c7e1fd13f6e5301c209 22-May-2009 Dan Gohman <gohman@apple.com> Fix a thinko in the code that adapted SCEVMulExpr operands for
use in expanding SCEVAddExprs with GEPs. The operands of a
SCEVMulExpr need to be multiplied together, not added.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72250 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
278b49af8a08f6ab6c486a3cfc7a9c1c1acd2b23 19-May-2009 Dan Gohman <gohman@apple.com> Create ConstantExpr GEPs the correct way. This fixes
MultiSource/Benchmarks/Prolangs-C/football and a variety of other
failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72120 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
cf5ab820227dedd77fb91d0904b6dc3694a7c196 01-May-2009 Dan Gohman <gohman@apple.com> Actually insert inserted instructions into the InsertedValues map.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70557 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
80dcdee0f48820ecea86c15768324945bb0d68d1 01-May-2009 Dan Gohman <gohman@apple.com> Short-circuit inttoptr-ptrtoint constant expressions; these aren't
always folded by the regular constant folder because it doesn't have
TargetData information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70553 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
752ec7da506f5d41c08bd37e195750b57550ce68 23-Apr-2009 Dan Gohman <gohman@apple.com> Change SCEVExpander's expandCodeFor to provide more flexibility
with the persistent insertion point, and change IndVars to make
use of it. This fixes a bug where IndVars was holding on to a
stale insertion point and forcing the SCEVExpander to continue to
use it.

This fixes PR4038.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69892 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
e2a17468d1e47ef430933b7a91c5c1c4669d7d8d 22-Apr-2009 Devang Patel <dpatel@apple.com> Fix cut-n-pasto.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69816 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
aabb04f52714ceb271dba7da18f757a4365bb4ac 22-Apr-2009 Dan Gohman <gohman@apple.com> SCEVExpander's InsertCastOfTo knows how to move existing cast
instructions in order to avoid inserting new ones. However, if
the cast instruction is the SCEVExpander's InsertPt, this
causes subsequently emitted instructions to be inserted near
the cast, and not at the location of the original insert point.
Fix this by adjusting the insert point in such cases.
This fixes PR4009.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
6cdc727f2d7f68734526ef078f4632798ad40791 22-Apr-2009 Dan Gohman <gohman@apple.com> Use BasicBlock::iterator instead of Instruction* for insert points,
to better handle inserting instructions at the end of a block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69807 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
890f92b744fb074465bc2b7006ee753a181f62a4 18-Apr-2009 Dan Gohman <gohman@apple.com> Use more const qualifiers with SCEV interfaces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69450 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
4d177592f265ec5cc1148bd2c35f4b268c4956c4 16-Apr-2009 Dan Gohman <gohman@apple.com> Handle a pointer type correctly in SCEVExpander::visitAddRecExpr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69310 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
6524d3ab0e93cfaa1da4293428a5b0b4f106606d 16-Apr-2009 Dan Gohman <gohman@apple.com> Fix SCEVExpander::visitSMaxExpr and SCEVExpander::visitUMaxExpr to
not create ICmpInsts with operands of different types. This fixes
a regression in Applications/d/make_dparser.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69294 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
f04fa483b83227c570bc58e1684ea096430a6697 16-Apr-2009 Dan Gohman <gohman@apple.com> Teach SCEVExpander::InsertCastOfTo to avoid creating inttoptr-of-ptrtoint
and ptrtoint-of-inttoptr expressions. This fixes a regression in 300.twolf.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69293 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
e9324f360590793576d15d9e15c21a4c19ef8d1c 13-Oct-2008 Gabor Greif <ggreif@gmail.com> do not use deprecated interfaces

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57433 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
6177fd4fcee4d82692c47e33754ffe285c38cc69 08-Jul-2008 Nick Lewycky <nicholas@mxc.ca> Expand SCEVUDiv of power of 2 to a lshr instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53217 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
17f1972c770dc18f5c7c3c95776b4d62ae9e121d 22-Jun-2008 Dan Gohman <gohman@apple.com> Use SCEVAddRecExpr::isAffine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
11f6d3b478c4fa09d126833c57fbac1d795ead31 22-Jun-2008 Dan Gohman <gohman@apple.com> Move a few more SCEVExpander methods out-of-line.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52612 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
e24fa64d52330626553298f56ba5aa702624c282 18-Jun-2008 Dan Gohman <gohman@apple.com> Move SCEVExpander::visitAddExpr out-of-line.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52464 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
8a08769bad43a22fae2845bb0ba0fd1266cd55c8 15-Jun-2008 Wojciech Matyjewicz <wmatyjewicz@fastmail.fm> Fix PR2434. When scanning for exising binary operator to reuse don't
take into account the instrucion pointed by InsertPt. Thanks to it,
returning the new value of InsertPt to the InsertBinop() caller can be
avoided. The bug was, actually, in visitAddRecExpr() method which wasn't
correctly handling changes of InsertPt. There shouldn't be any
performance regression, as -gvn pass (run after -indvars) removes any
redundant binops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52291 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
5d2bc857ec1ae11ec2ea85e596f3712d02fd2c2b 14-Jun-2008 Wojciech Matyjewicz <wmatyjewicz@fastmail.fm> Change 'while' loop to 'do' loop.

Add a safety measure. It isn't safe to assume in ScalarEvolutionExpander that
all loops are in canonical form (but it should be safe for loops that have
AddRecs).
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52275 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
7cbd8a3e92221437048b484d5ef9c0a22d0f8c58 16-May-2008 Gabor Greif <ggreif@gmail.com> API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. Legacy interfaces will be in place for some time. (Merge from use-diet branch.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51200 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
051a950000e21935165db56695e35bade668193b 06-Apr-2008 Gabor Greif <ggreif@gmail.com> API changes for class Use size reduction, wave 1.
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49277 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
3913187bf6135e6a71260c65eed664095c8f9ce9 09-Feb-2008 Wojciech Matyjewicz <wmatyjewicz@fastmail.fm> We should check that existing cast operation has the appropriate opcode before we reuse it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46908 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
693f541526cdd5f084adc5b8a5a5b290401a0b8e 14-Sep-2007 Dan Gohman <gohman@apple.com> Change "tmp." to "tmp" for temporaries created by ScalarEvolutionExpander
for consistency with many other transforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41957 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
96fea337d27357e9b62abbf3d2d5ce29f1c8e870 20-Aug-2007 Anton Korobeynikov <asl@math.spbu.ru> - Use correct header for SCEV inside LoopPass.cpp
- Move SCEVExpander::expand() out-of-line workarounding possible toolchain bug


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41197 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
0f0eb18addc94bf3d8179fbce162c8c4622b9866 15-Jun-2007 Dan Gohman <gohman@apple.com> Fold a binary operator with constant operands when expanding code for a SCEV.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37602 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
b1b2f0bc44d01b33198a3aa51a64f79bad01378f 18-Apr-2007 Chris Lattner <sabre@nondot.org> Be more careful when inserting reused instructions. This fixes CodeGen/Generic/2007-04-17-lsr-crash.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36231 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
7fec90ebf4ebe7aa73a6dd7d275c255587c041ad 13-Apr-2007 Chris Lattner <sabre@nondot.org> CSE simple binary expressions when they are inserted. This makes LSR produce
less huge code that needs to be cleaned up by sdisel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35959 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
4d050d73210d15d8a86ee5967c417ddb5bee4543 01-Mar-2007 Reid Spencer <rspencer@reidspencer.com> Avoid a potential assert out if the loop increment is > 64 bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34798 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
24d6da5fedcf39891f7d8c5b031c01324b3db545 21-Jan-2007 Reid Spencer <rspencer@reidspencer.com> For PR970:
Clean up handling of isFloatingPoint() and dealing with PackedType.
Patch by Gordon Henriksen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33415 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
3ba68b9eef2851dae8a9d1b18928c6fa2e3c5f87 13-Dec-2006 Reid Spencer <rspencer@reidspencer.com> Change the interface to SCEVExpander::InsertCastOfTo to take a cast opcode
so the decision of which opcode to use is pushed upward to the caller.
Adjust the callers to pass the expected opcode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32535 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
10292555f391bf9fa0e8ee78da35757e9b7e49f2 04-Dec-2006 Reid Spencer <rspencer@reidspencer.com> Fix 80 cols violation


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32179 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
68fe61d6a165ea6090008e281330895a21607daf 29-Nov-2006 Bill Wendling <isanbard@gmail.com> Replacing std::iostreams with llvm iostreams. Some of these changes involve
adding a temporary wrapper around the ostream to make it friendly to
functions expecting an LLVM stream. This should be fixed in the future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31990 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.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/ScalarEvolutionExpander.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/ScalarEvolutionExpander.cpp
ca1a4bebb3928ba18fb8751e2f0c0f88fad54cfd 04-Feb-2006 Chris Lattner <sabre@nondot.org> Pull the InsertCastOfTo out of the header, implement CSE'ing of arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25973 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
df14a04b5ccbbe6a46c2ccb93e27b12a36ff163e 30-Oct-2005 Chris Lattner <sabre@nondot.org> Fix a problem that Nate noticed with LSR:

When inserting code for an addrec expression with a non-unit stride, be
more careful where we insert the multiply. In particular, insert the multiply
in the outermost loop we can, instead of the requested insertion point.

This allows LSR to notice the mul in the right loop, reducing it when it gets
to it. This allows it to reduce the multiply, where before it missed it.

This happens quite a bit in the test suite, for example, eliminating 2
multiplies in art, 3 in ammp, 4 in apsi, reducing from 1050 multiplies to
910 muls in galgel (!), from 877 to 859 in applu, and 36 to 30 in bzip2.

This speeds up galgel from 16.45s to 16.01s, applu from 14.21 to 13.94s and
fourinarow from 66.67s to 63.48s.

This implements Transforms/LoopStrengthReduce/nested-reduce.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24102 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
36f891bdf6cf38fcc655a0930ca18664e18518d4 30-Jul-2005 Nate Begeman <natebegeman@mac.com> Break SCEVExpander out of IndVarSimplify into its own .h/.cpp file so that
other passes may use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22557 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Analysis/ScalarEvolutionExpander.cpp