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

Bug: http://b/31320715

This merges commit 7dcf7f03e005379ef2f06db96aa93f06186b66d5 from
aosp/dev.

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

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

http://b/26987366

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

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

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

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

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

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

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

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

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

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

Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
7b7037563b12589e675c655e5d1e4f737f50fa9d 06-Dec-2013 Bill Wendling <isanbard@gmail.com> Merging r196611:
------------------------------------------------------------------------
r196611 | dexonsmith | 2013-12-06 13:48:36 -0800 (Fri, 06 Dec 2013) | 5 lines

Don't use isNullValue to evaluate ConstantExpr

ConstantExpr can evaluate to false even when isNullValue gives false.

Fixes PR18143.
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@196614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
1df59ef1aa271a4e33cf8973e14bcaf55c585231 03-Oct-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Make gep i8* X, -(ptrtoint Y) transform work with address spaces

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191920 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
4c332fa5a5a650cd779935d78b505f84cef4db69 20-Sep-2013 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Canonicalize (gep i8* X, -(ptrtoint Y)) to (sub (ptrtoint X), (ptrtoint Y))

The GEP pattern is what SCEV expander emits for "ugly geps". The latter is what
you get for pointer subtraction in C code. The rest of instcombine already
knows how to deal with that so just canonicalize on that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191090 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
596aa123f46158639c836f1d53b89a9d7898c4b7 05-Sep-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Consistently use dbgs() in debug printing

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190093 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
8e3367ea36d7b25c79b9d3f14842e8f9c7c5801e 20-Aug-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Teach InstCombine visitGetElementPtr about address spaces

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
c4ad982f0bbf4c3d8fc7babc832f0a75e615ba19 20-Aug-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Cleanup visitGetElementPtr to make address space change easier

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188720 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
fdc2660214265e8c32b9536a18ff983f035aaf02 14-Aug-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Fix always creating GEP with i32 indices

Use the pointer size if datalayout is available.
Use i64 if it's not, which is consistent with what other
places do when the pointer size is unknown.

The test doesn't really test this in a useful way
since it will be transformed to that later anyway,
but this now tests it for non-zero arrays and when
datalayout isn't available. The cases in
visitGetElementPtrInst should save an extra re-visit to
the newly created GEP since it won't need to cleanup after
itself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188339 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
3ea117e1bca290c4043ca38d25f278275e5853cb 14-Aug-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Use type helper functions instead of cast

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
6227d5c690504c7ada5780c00a635b282c46e275 04-Jul-2013 Craig Topper <craig.topper@gmail.com> Use SmallVectorImpl::iterator/const_iterator instead of SmallVector to avoid specifying the vector size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185606 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
5c332dbd30d9398ed25b30c3080506f7b8e92290 05-May-2013 Dmitri Gribenko <gribozavr@gmail.com> Add ArrayRef constructor from None, and do the cleanups that this constructor enables

Patch by Robert Wilhelm.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181138 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
40be1e85665d10f5444186f0e7106e368dd735b8 01-May-2013 Filip Pizlo <fpizlo@apple.com> This patch breaks up Wrap.h so that it does not have to include all of
the things, and renames it to CBindingWrapping.h. I also moved
CBindingWrapping.h into Support/.

This new file just contains the macros for defining different wrap/unwrap
methods.

The calls to those macros, as well as any custom wrap/unwrap definitions
(like for array of Values for example), are put into corresponding C++
headers.

Doing this required some #include surgery, since some .cpp files relied
on the fact that including Wrap.h implicitly caused the inclusion of a
bunch of other things.

This also now means that the C++ headers will include their corresponding
C API headers; for example Value.h must include llvm-c/Core.h. I think
this is harmless, since the C API headers contain just external function
declarations and some C types, so I don't believe there should be any
nasty dependency issues here.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180881 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
3e39731e88f2d4f597cebc74388fd6650ca4f604 23-Apr-2013 Eric Christopher <echristo@gmail.com> Move C++ code out of the C headers and into either C++ headers
or the C++ files themselves. This enables people to use
just a C compiler to interoperate with LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180063 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
0fae64fde0a75cb2b36a92fb249f88d6a4378202 07-Feb-2013 Michael Ilseman <milseman@apple.com> Preserve fast-math flags after reassociation and commutation. Update test cases



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174571 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
028dba376ae90c82b44d72ddb3ed97849484aab4 23-Jan-2013 Benjamin Kramer <benny.kra@googlemail.com> Revert "InstCombine: Clean up weird code that talks about a modulus that's long gone."

This causes crashes during the build of compiler-rt during selfhost. Add a
testcase for coverage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
9381dd1ac9ac8a4020cd0dd03323a26f1ae5587f 23-Jan-2013 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Clean up weird code that talks about a modulus that's long gone.

This does the right thing unless the multiplication overflows, but the old code
didn't handle that case either.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173276 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
935e35d2b9f889566207b76a7026b63a1619742c 09-Jan-2013 Shuxin Yang <shuxin.llvm@gmail.com> Consider expression "0.0 - X" as the negation of X if
- this expression is explicitly marked no-signed-zero, or
- no-signed-zero of this expression can be derived from some context.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171922 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
637582eaf77e6892094cea0bf6b9483f50b5d94e 07-Jan-2013 Quentin Colombet <qcolombet@apple.com> When code size is the priority (Oz, MinSize attribute), help llvm
turning a code like this:

if (foo)
free(foo)

into that:
free(foo)

Move a call to free from basic block FB into FB's predecessor, P,
when the path from P to FB is taken only if the argument of free is
not equal to NULL.

Some restrictions apply on P and FB to be sure that this code motion
is profitable. Namely:
1. FB must have only one predecessor P.
2. FB must contain only the call to free plus an unconditional
branch to S.
3. P's successors are FB and S.

Because of 1., we will not increase the code size when moving the call
to free from FB to P.
Because of 2., FB will be empty after the move.
Because of 2. and 3., P's branch instruction becomes useless, so as FB
(simplifycfg will do the job).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171762 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.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/Transforms/InstCombine/InstructionCombining.cpp
98281a20503896349bd152e2dfe87435d3a6aada 30-Dec-2012 Nuno Lopes <nunoplopes@sapo.pt> convert a bunch of callers from DataLayout::getIndexedOffset() to GEP::accumulateConstantOffset().
The later API is nicer than the former, and is correct regarding wrap-around offsets (if anyone cares).
There are a few more places left with duplicated code, which I'll remove soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.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/Transforms/InstCombine/InstructionCombining.cpp
2920a71663b96f2c33b1fee09ca5ca9f5dc1cf12 13-Nov-2012 Meador Inge <meadori@codesourcery.com> instcombine: Migrate math library call simplifications

This patch migrates the math library call simplifications from the
simplify-libcalls pass into the instcombine library call simplifier.

I have typically migrated just one simplifier at a time, but the math
simplifiers are interdependent because:

1. CosOpt, PowOpt, and Exp2Opt all depend on UnaryDoubleFPOpt.
2. CosOpt, PowOpt, Exp2Opt, and UnaryDoubleFPOpt all depend on
the option -enable-double-float-shrink.

These two factors made migrating each of these simplifiers individually
more of a pain than it would be worth. So, I migrated them all together.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167815 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
b69bf6be1b042a5f06a623fc546107fc6d9f46c4 11-Nov-2012 Meador Inge <meadori@codesourcery.com> Add method for replacing instructions to LibCallSimplifier

In some cases the library call simplifier may need to replace instructions
other than the library call being simplified. In those cases it may be
necessary for clients of the simplifier to override how the replacements
are actually done. As such, a new overrideable method for replacing
instructions was added to LibCallSimplifier.

A new subclass of LibCallSimplifier is also defined which overrides
the instruction replacement method. This is because the instruction
combiner defines its own replacement method which updates the worklist
when instructions are replaced.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167681 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
c5b969a0194aa3e3d8170ddd38ab3cb8c9f3113c 03-Nov-2012 Duncan Sands <baldrick@free.fr> Generalize the transform that boosts GEP indices to the size of a pointer to
also do it for vectors of pointers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167354 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.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/Transforms/InstCombine/InstructionCombining.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/Transforms/InstCombine/InstructionCombining.cpp
f1ec4e4123a8e6d811c072f383399781cfeaa9aa 23-Oct-2012 Duncan Sands <baldrick@free.fr> Fix typo that somehow escaped both testing and code inspection.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
bbc7016c60bfe319f4d3bbc525547596e85c9aad 23-Oct-2012 Duncan Sands <baldrick@free.fr> Transform code like this
%V = mul i64 %N, 4
%t = getelementptr i8* bitcast (i32* %arr to i8*), i32 %V
into
%t1 = getelementptr i32* %arr, i32 %N
%t = bitcast i32* %t1 to i8*
incorporating the multiplication into the getelementptr.
This happens all the time in dragonegg, for example for
int foo(int *A, int N) {
return A[N];
}
because gcc turns this into byte pointer arithmetic before it hits the plugin:
D.1590_2 = (long unsigned int) N_1(D);
D.1591_3 = D.1590_2 * 4;
D.1592_5 = A_4(D) + D.1591_3;
D.1589_6 = *D.1592_5;
return D.1589_6;
The D.1592_5 line is a POINTER_PLUS_EXPR, which is turned into a getelementptr
on a bitcast of A_4 to i8*, so this becomes exactly the kind of IR that the
transform fires on.

An analogous transform (with no testcases!) already existed for bitcasts of
arrays, so I rewrote it to share code with this one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166474 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
5e8904576a5260cfd5b14596e338a4bb25b9817e 13-Oct-2012 Meador Inge <meadori@codesourcery.com> Implement new LibCallSimplifier class

This patch implements the new LibCallSimplifier class as outlined in [1].
In addition to providing the new base library simplification infrastructure,
all the fortified library call simplifications were moved over to the new
infrastructure. The rest of the library simplification optimizations will
be moved over with follow up patches.

NOTE: The original fortified library call simplifier located in the
SimplifyFortifiedLibCalls class was not removed because it is still
used by CodeGenPrepare. This class will eventually go away too.

[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-August/052283.html

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164767 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
8e0d1c03ca7fd86e6879b4e37d0d7f0e982feef6 29-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> Make MemoryBuiltins aware of TargetLibraryInfo.

This disables malloc-specific optimization when -fno-builtin (or -ffreestanding)
is specified. This has been a problem for a long time but became more severe
with the recent memory builtin improvements.

Since the memory builtin functions are used everywhere, this required passing
TLI in many places. This means that functions that now have an optional TLI
argument, like RecursivelyDeleteTriviallyDeadFunctions, won't remove dead
mallocs anymore if the TLI argument is missing. I've updated most passes to do
the right thing.

Fixes PR13694 and probably others.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162841 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
56cb2298663017eb77aa4f4dda8db7ecd1b58173 19-Jul-2012 Bill Wendling <isanbard@gmail.com> Remove tabs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160477 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
78f8ef42173a3a9867ed789073d4ddc652fb7ff2 09-Jul-2012 Nuno Lopes <nunoplopes@sapo.pt> instcombine: merge the functions that remove dead allocas and dead mallocs/callocs/...
This patch removes ~70 lines in InstCombineLoadStoreAlloca.cpp and makes both functions a bit more aggressive than before :)
In theory, we can be more aggressive when removing an alloca than a malloc, because an alloca pointer should never escape, but we are not taking advantage of this anyway

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159952 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
9969458b1673648394fce3f50f3f4a84071c7ca7 07-Jul-2012 Nuno Lopes <nunoplopes@sapo.pt> teach instcombine to remove allocated buffers even if there are stores, memcpy/memmove/memset, and objectsize users.
This means we can do cheap DSE for heap memory.
Nothing is done if the pointer excapes or has a load.

The churn in the tests is mostly due to objectsize, since we want to make sure we
don't delete the malloc call before evaluating the objectsize (otherwise it becomes -1/0)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159876 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
c363c74c45756004f50c2bd67711400fd9026588 29-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> make instcombine produce calls to llvm.donothing instead of a random intrinsic

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159384 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
3769fe149bb47dfdaa8ac39b7a4c26cf98ec503e 25-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> improve optimization of invoke instructions:
- simplifycfg: invoke undef/null -> unreachable
- instcombine: invoke new -> invoke expect(0, 0) (an arbitrary NOOP intrinsic; only done if the allocated memory is unused, of course)
- verifier: allow invoke of intrinsics (to make the previous step work)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159146 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
2b3e9580536dfb5666b9d91e99baebf6d45bfa5f 21-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> Add support for invoke to the MemoryBuiltin analysid.
Update comments accordingly.

Make instcombine remove useless invokes to C++'s 'new' allocation function (test attached).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158937 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
9e72a79ef4a9fcda482ce0b0e1f0bd6a4f16cffd 21-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> refactor the MemoryBuiltin analysis:
- provide more extensive set of functions to detect library allocation functions (e.g., malloc, calloc, strdup, etc)
- provide an API to compute the size and offset of an object pointed by

Move a few clients (GVN, AA, instcombine, ...) to the new API.
This implementation is a lot more aggressive than each of the custom implementations being replaced.

Patch reviewed by Nick Lewycky and Chandler Carruth, thanks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158919 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
b47f3ea22461b2d877d4a3246d54bdeab4fcfaa3 20-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> replace usage of EmitGEPOffset() with TargetData::getIndexedOffset() when the GEP offset is known to be constant.
With this change, we avoid relying on the IR Builder to constant fold the operations.

No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158829 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
5c525b59d5e0036a778d278eeff4832edfd41357 22-May-2012 Nuno Lopes <nunoplopes@sapo.pt> add a new pass to instrument loads and stores for run-time bounds checking
move EmitGEPOffset from InstCombine to Transforms/Utils/Local.h

(a draft of this) patch reviewed by Andrew, thanks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157261 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
58c1da84f27d7821a75d41bed6e28c76fba8b64d 06-May-2012 Jakub Staszak <kubastaszak@gmail.com> Remove trailing spaces.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156257 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
02f0a49bbaa9a0f881ef18abd3b06168c2b35135 26-Mar-2012 Nadav Rotem <nadav.rotem@intel.com> 153465 was incorrect. In this code we wanted to check that the pointer operand is of pointer type (and not vector type).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153468 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
c71108b6f843f39d4a305e6d351e4a2be4f604b2 26-Mar-2012 Nadav Rotem <nadav.rotem@intel.com> PR12357: The pointer was used before it was checked.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153465 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
3d3abe0852d5f499bed7ab014519dd582a0a795d 11-Mar-2012 Stepan Dyatkovskiy <stpworld@narod.ru> llvm::SwitchInst
Renamed methods caseBegin, caseEnd and caseDefault with case_begin, case_end, and case_default.
Added some notes relative to case iterators.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152532 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
c10fa6c801e48771b5eade50afc2fe6abaf08227 08-Mar-2012 Stepan Dyatkovskiy <stpworld@narod.ru> Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html

Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*".

ConstCaseIt is just a read-only iterator.
CaseIt is read-write iterator; it allows to change case successor and case value.

Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters.

Main way of iterator usage looks like this:
SwitchInst *SI = ... // intialize it somehow

for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) {
BasicBlock *BB = i.getCaseSuccessor();
ConstantInt *V = i.getCaseValue();
// Do something.
}

If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method.
If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method.

There are also related changes in llvm-clients: klee and clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152297 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
7302d80490feabfc8a01bee0fa698aab55169544 06-Feb-2012 Chris Lattner <sabre@nondot.org> Remove some dead code and tidy things up now that vectors use ConstantDataVector
instead of always using ConstantVector.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149912 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
24473120a253a05f3601cd3373403b47e6d03d41 01-Feb-2012 Stepan Dyatkovskiy <stpworld@narod.ru> SwitchInst refactoring.
The purpose of refactoring is to hide operand roles from SwitchInst user (programmer). If you want to play with operands directly, probably you will need lower level methods than SwitchInst ones (TerminatorInst or may be User). After this patch we can reorganize SwitchInst operands and successors as we want.

What was done:

1. Changed semantics of index inside the getCaseValue method:
getCaseValue(0) means "get first case", not a condition. Use getCondition() if you want to resolve the condition. I propose don't mix SwitchInst case indexing with low level indexing (TI successors indexing, User's operands indexing), since it may be dangerous.
2. By the same reason findCaseValue(ConstantInt*) returns actual number of case value. 0 means first case, not default. If there is no case with given value, ErrorIndex will returned.
3. Added getCaseSuccessor method. I propose to avoid usage of TerminatorInst::getSuccessor if you want to resolve case successor BB. Use getCaseSuccessor instead, since internal SwitchInst organization of operands/successors is hidden and may be changed in any moment.
4. Added resolveSuccessorIndex and resolveCaseIndex. The main purpose of these methods is to see how case successors are really mapped in TerminatorInst.
4.1 "resolveSuccessorIndex" was created if you need to level down from SwitchInst to TerminatorInst. It returns TerminatorInst's successor index for given case successor.
4.2 "resolveCaseIndex" converts low level successors index to case index that curresponds to the given successor.

Note: There are also related compatability fix patches for dragonegg, klee, llvm-gcc-4.0, llvm-gcc-4.2, safecode, clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149481 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
a78fa8cc2dd6d2ffe5e4fe605f38aae7b3d2fb7a 27-Jan-2012 Chris Lattner <sabre@nondot.org> continue making the world safe for ConstantDataVector. At this point,
we should (theoretically optimize and codegen ConstantDataVector as well
as ConstantVector.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149116 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
d59ae907eea28285ece6696d6f3271b4ca578c0d 26-Jan-2012 Chris Lattner <sabre@nondot.org> Continue improving support for ConstantDataAggregate, and use the
new methods recently added to (sometimes greatly!) simplify code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
1608769abeb1430dc34f31ffac0d9850f99ae36a 05-Dec-2011 Nadav Rotem <nadav.rotem@intel.com> Add support for vectors of pointers.



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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145630 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
3d925d24e8c54cde05228258c25cc21687cad922 30-Nov-2011 Chad Rosier <mcrosier@apple.com> Add support for sqrt, sqrtl, and sqrtf in TargetLibraryInfo. Disable
(fptrunc (sqrt (fpext x))) -> (sqrtf x) transformation if -fno-builtin is
specified.
rdar://10466410

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145460 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
a7b0cb759433c715065440ee2a963a04db7f2b0b 15-Nov-2011 Benjamin Kramer <benny.kra@googlemail.com> Remove all remaining uses of Value::getNameStr().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144648 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
049260d9e2f72d650d97167e1ab451384e32b014 01-Nov-2011 Eli Friedman <eli.friedman@gmail.com> Make sure we use the right insertion point when instcombine replaces a PHI with another instruction. (Specifically, don't insert an arbitrary instruction before a PHI.) Fixes PR11275.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143437 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
76f267df17b601a87b3d89e718891f7ed2a5be46 17-Oct-2011 Bill Wendling <isanbard@gmail.com> Add support for the Objective-C personality function to the instruction
combining of the landingpad instruction. The ObjC personality function acts
almost identically to the C++ personality function. In particular, it uses
"null" as a "catch-all" value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142256 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
602650c98822371d4a34b00353ec71051621b7fb 17-Oct-2011 Chandler Carruth <chandlerc@gmail.com> Add a routine to swap branch instruction operands, and update any
profile metadata at the same time. Use it to preserve metadata attached
to a branch when re-writing it in InstCombine.

Add metadata to the canonicalize_branch InstCombine test, and check that
it is tranformed correctly.

Reviewed by Nick Lewycky!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142168 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
35d9da3d3b82cbf6ff9e788fb3200040a98dc155 05-Oct-2011 Jim Grosbach <grosbach@apple.com> Re-commit 141203, but much more conservative.

Just pull the instruction name, but don't change the order of anything
else. That keeps --debug happy and non-crashing, but doesn't change
how the worklist gets built.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141210 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
e2999b48998508ac426a9c2d67db55a6ca4b4fde 05-Oct-2011 Jim Grosbach <grosbach@apple.com> Revert 141203. InstCombine is looping on unit tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141209 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
30c1ff234d30567fc20d6c41d8fd9c3aacbbf9ca 05-Oct-2011 Jim Grosbach <grosbach@apple.com> Update InstCombine worklist after instruction transform is complete.

When updating the worklist for InstCombine, the Add/AddUsersToWorklist
functions may access the instruction(s) being added, for debug output for
example. If the instructions aren't yet added to the basic block, this
can result in a crash. Finish the instruction transformation before
adjusting the worklist instead.

rdar://10238555


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141203 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
0ad7b6e773b33f4c4fd3c82c8a5c10ac0597792c 30-Sep-2011 Duncan Sands <baldrick@free.fr> Inlining often produces landingpad instructions with repeated
catch or repeated filter clauses. Teach instcombine a bunch
of tricks for simplifying landingpad clauses. Currently the
code only recognizes the GNU C++ and Ada personality functions,
but that doesn't stop it doing a bunch of "generic" transforms
which are hopefully fine for any real-world personality function.
If these "generic" transforms turn out not to be generic, they
can always be conditioned on the personality function. Probably
someone should add the ObjC++ personality function. I didn't as
I don't know anything about it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
bb5a7442e362776621112dc9453e546a55878e79 29-Sep-2011 Eli Friedman <eli.friedman@gmail.com> Clean up uses of switch instructions so they are not dependent on the operand ordering. Patch by Stepan Dyatkovskiy.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140803 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
a268468d50a0c6f7de27299d50c6e387e404d685 04-Sep-2011 Bill Wendling <isanbard@gmail.com> Use Duncan's patch to delete the instructions in reverse order (minus the landingpad and terminator).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139090 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
9dc31e87051715f2db5012794e9089ac0f7f30d3 02-Sep-2011 Bill Wendling <isanbard@gmail.com> Update comments to reflect reality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139023 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
6bb4e7e8e8c39432c890bedb800bb01f6eda1e44 01-Sep-2011 Bill Wendling <isanbard@gmail.com> Reduce indentation. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138968 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
c8c0fd39931491146efd08d7ac835f2839e41b1e 01-Sep-2011 Bill Wendling <isanbard@gmail.com> Change worklist driven deletion to be an iterative process.
Duncan noticed this!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138967 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
a8d1393093d67091d47fa87a4ce86c0adcead6a0 01-Sep-2011 Bill Wendling <isanbard@gmail.com> Resubmit with fix. Properly remove the instructions except for landingpad, which should be removed only when its invokes are.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138932 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
c1b4cd6c11f58f3b49d09bf30acc165cb0d9a33b 01-Sep-2011 Bill Wendling <isanbard@gmail.com> Submitted this too early.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
1893cd31313d240279b3d65b24bc1d69003e9bc5 01-Sep-2011 Bill Wendling <isanbard@gmail.com> Don't DCE the landingpad instruction.

The landingpad instruction can be removed only when its invokes are removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138930 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
c9b2a987a291434490fd5b3b6e98b9992916ece4 17-Aug-2011 Bill Wendling <isanbard@gmail.com> Revert r137655. There is some question about whether the 'landingpad'
instruction should be marked as potentially reading and/or writing memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137863 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.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/Transforms/InstCombine/InstructionCombining.cpp
6456a62178818204e0807aada7b699ab647bebc6 16-Aug-2011 Bill Wendling <isanbard@gmail.com> Don't sink the instruction to before a landingpad instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137672 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
cc4a0435b7ee34af2c64a6f7ee63642f56096d1b 16-Aug-2011 Eli Friedman <eli.friedman@gmail.com> Update instcombine for atomic load/store.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137664 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
9d6070f161d89376c7c834950f518e25e34d7ce8 15-Aug-2011 Bill Wendling <isanbard@gmail.com> Duncan pointed out that the LandingPadInst might read memory. (It might also
write to memory.) Marking it as such makes some checks for immobility go away.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137655 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
06f20ebfcf2b4dbe388f6d506b62fb2aa8af5fe8 15-Aug-2011 Bill Wendling <isanbard@gmail.com> Don't try to sink the landingpad instruction. It's immobile.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137629 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
28b84ff4cec5bf2de4c1f85b85d613818175c4d4 14-Aug-2011 Nick Lewycky <nicholas@mxc.ca> This transform is not safe. Thanks to Eli for pointing that out!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137575 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
7f0170c1975fe55c58f6f2a968e1fc2248732fbe 14-Aug-2011 Nick Lewycky <nicholas@mxc.ca> Don't attempt to add 'nsw' when intermediate instructions had no such guarantee.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
daf27ea899fbd94a020cc6f4680279ea0ac65064 14-Aug-2011 Nick Lewycky <nicholas@mxc.ca> Teach instcombine to preserve the nsw bit by doing an after-the-fact analysis
when combining add and sub instructions. Patch by Pranav Bhandarkar!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137570 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
dbd22550911ef20d09403d294090b480c03eeeca 03-Aug-2011 Nick Lewycky <nicholas@mxc.ca> Small cleanups:
- use SmallVectorImpl& for the function argument.
- ignore the operands on the GEP, even if they aren't constant! Much as we
pretend the malloc succeeds, we pretend that malloc + whatever-you-GEP'd-by
is not null. It's magic!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136757 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
d5061a9268d04c80af764291ef93fe3f7b51f0de 03-Aug-2011 Nick Lewycky <nicholas@mxc.ca> Fix logical error when detecting lifetime intrinsics.

Don't replace a gep/bitcast with 'undef' because that will form a "free(undef)"
which in turn means "unreachable". What we wanted was a no-op. Instead, analyze
the whole tree and look for all the instructions we need to delete first, then
delete them second, not relying on the use_list to stay consistent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136752 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
d8030c79fd4531a691381e7e870fe99b8a4cb8a4 03-Aug-2011 Nick Lewycky <nicholas@mxc.ca> Teach InstCombine that lifetime intrincs aren't a real user on the result of a
malloc call.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136732 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
592ad6a82facd7d7ee58c599767a1b0c85eda0c5 31-Jul-2011 Rafael Espindola <rafael.espindola@gmail.com> Add a small gep optimization I noticed was missing while reading some IL.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136585 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
a9203109f4ac95aa7e9624f2838e3d89623ec902 25-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert GetElementPtrInst to use ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.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/Transforms/InstCombine/InstructionCombining.cpp
b9b54ebfed02f0654897d37e8a4448d3f8087558 19-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert SimplifyGEPInst to use ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135482 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
39b5abf507b43da6b92f68b86406e0015ead18e9 18-Jul-2011 Frits van Bommel <fvbommel@gmail.com> Migrate LLVM and Clang to use the new makeArrayRef(...) functions where previously explicit non-default constructors were used.
Mostly mechanical with some manual reformatting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135390 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.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/Transforms/InstCombine/InstructionCombining.cpp
fc6d3a49867cd38954dc40936a88f1907252c6d2 13-Jul-2011 Jay Foad <jay.foad@gmail.com> Convert InsertValueInst and ExtractValueInst APIs to use ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135040 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
b5a12dd12fa3cd1026e9058a53089c29fb97f2fd 11-Jul-2011 Rafael Espindola <rafael.espindola@gmail.com> Don't duplicate the work done by a gep into a "bitcast" if the gep has
more than one use.

Fixes PR10322.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134883 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
a311c34d2af7c750f016ef5e4c41bee77a1dfac7 27-May-2011 Eli Friedman <eli.friedman@gmail.com> Final step of instcombine debuginfo; switch a couple more places over to InsertNewInstWith, and use setDebugLoc for the cases which can't be easily handled by the automated mechanisms.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132167 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
a4d4aeb387a9bf48bb3600fa044d660cae5f5ba4 24-May-2011 Eli Friedman <eli.friedman@gmail.com> Make instcombine O(N) instead of O(N^2) in code where the same simplifiable constant is used many times.
Part of rdar://9471075.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131979 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
e6f364b6c44eda14cd4ad54366ea5cc7246b9500 19-May-2011 Eli Friedman <eli.friedman@gmail.com> More instcombine cleanup, towards improving debug line info.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131604 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
ef819d0ed8c9df3da633e8c1240e582a7879bb94 18-May-2011 Eli Friedman <eli.friedman@gmail.com> Start trying to make InstCombine preserve more debug info. The idea here is to set the debug location on the IRBuilder, which will be then right location in most cases. This should magically give many transformations debug locations, and fixing places which are missing a debug location will usually just means changing the code creating it to use the IRBuilder.

As an example, the change to InstCombineCalls catches a common case where a call to a bitcast of a function is rewritten.

Chris, does this approach look reasonable?



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131516 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
3e22cb9ec30cd9b1be9b0f50e400f512124997e5 18-May-2011 Eli Friedman <eli.friedman@gmail.com> Use ReplaceInstUsesWith instead of replaceAllUsesWith where appropriate in instcombine.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131512 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
089a246333eff6b9d01e5d4510809db14371628f 27-Apr-2011 Duncan Sands <baldrick@free.fr> Stop trying to have instcombine preserve LCSSA form: this was not
effective in avoiding recomputation of LCSSA form; the widespread
use of instsimplify (which looks through phi nodes) means it was
not preserving LCSSA form anyway; and instcombine is no longer
scheduled in the middle of the loop passes so this doesn't matter
anymore.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130301 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
0286ca89f0734a81c273e80732a573f619c7ace4 05-Apr-2011 Nadav Rotem <nadav.rotem@intel.com> InstCombine optimizes gep(bitcast(x)) even when the bitcasts casts away address
space info. We crash with an assert in this case. This change checks that the
address space of the bitcasted pointer is the same as the gep ptr.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.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/Transforms/InstCombine/InstructionCombining.cpp
fd4a5497b6a2f9e67187d8ca74659388c52c5427 28-Mar-2011 Jay Foad <jay.foad@gmail.com> Make more use of PHINode::getNumIncomingValues().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128406 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
813c9a0f19c0d27085a3ea81eb44033747007741 17-Mar-2011 Devang Patel <dpatel@apple.com> Try to not lose variable's debug info during instcombine.
This is done by lowering dbg.declare intrinsic into dbg.value intrinsic.
Radar 9143931.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127834 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
e7394ea9c6fac7e1af3a1e4b24fc545d8898110f 15-Feb-2011 Devang Patel <dpatel@apple.com> Do not forget DebugLoc!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125547 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
5195b71941b49b3be7915cf4a52c951ac72e0a83 02-Feb-2011 Dan Gohman <gohman@apple.com> Conservatively, clear optional flags, such as nsw, when performing
reassociation. No testcase, because I wasn't able to create a testcase
which actually demonstrates a problem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124713 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
cd151d2f95eabae61b3cf8e675717d5674afbe85 21-Jan-2011 Chris Lattner <sabre@nondot.org> fix PR9013, an infinite loop in instcombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123968 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
084fe6243a4e69ef8d032303fcad116fa6695386 21-Jan-2011 Chris Lattner <sabre@nondot.org> update obsolete comment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123965 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
acf4a7c0e6f6c88c6ee0201ecd81942e21adb023 21-Jan-2011 Nick Lewycky <nicholas@mxc.ca> Don't try to pull vector bitcasts that change the number of elements through
a select. A vector select is pairwise on each element so we'd need a new
condition with the right number of elements to select on. Fixes PR8994.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123963 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
6eb6116d52a729b36ab9089e656267e09cc6207a 16-Jan-2011 Chris Lattner <sabre@nondot.org> remove a dead check, this was needed before we had an explicit veto on uses of phis.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123569 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
192228edb1c08ca11da2df959072bcaa99eacd63 16-Jan-2011 Chris Lattner <sabre@nondot.org> enhance FoldOpIntoPhi in instcombine to try harder when a phi has
multiple uses. In some cases, all the uses are the same operation,
so instcombine can go ahead and promote the phi. In the testcase
this pushes an add out of the loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123568 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
9922ccf4b483ce37524047879f9b2f9bb73e3ccb 16-Jan-2011 Chris Lattner <sabre@nondot.org> remove the AllowAggressive argument to FoldOpIntoPhi. It is forced to false in the
first line of the function because it isn't a good idea, even for compares.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123566 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
7dfe8fd96ce3aaa027afd27b954a3b01306eafbf 16-Jan-2011 Chris Lattner <sabre@nondot.org> more cleanups: use the IR builder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123565 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
5aac83288c64f6917626ae3b0faedda398135944 16-Jan-2011 Chris Lattner <sabre@nondot.org> tidy up code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123564 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
37bf92b5238434b00fde79347ba5336e7554e562 22-Dec-2010 Duncan Sands <baldrick@free.fr> Add a generic expansion transform: A op (B op' C) -> (A op B) op' (A op C)
if both A op B and A op C simplify. This fires fairly often but doesn't
make that much difference. On gcc-as-one-file it removes two "and"s and
turns one branch into a select.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122399 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
a3c44a5280042dbc0cde995675c225ede4528c6e 22-Dec-2010 Duncan Sands <baldrick@free.fr> Add some statistics, good for understanding how much more powerful
instcombine is compared to instsimplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122397 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
f2a97ed13d8aa23fab6d141b3c633e6ae513233e 20-Dec-2010 Chris Lattner <sabre@nondot.org> fix an oversight caught by Frits!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122204 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
74b64611c4b74a633239f2a9bfd6be07cdedff88 19-Dec-2010 Chris Lattner <sabre@nondot.org> move a transformation to a more logical place, simplifying it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122183 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
34ceb4db22c4af3e63ddbc94c56ebb1fec1b918d 29-Nov-2010 Frits van Bommel <fvbommel@gmail.com> Transform (extractvalue (load P), ...) to (load (gep P, 0, ...)) if the load has no other uses, shrinking the load.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
50f2625b22e05d838ddfa17f6861de78cb5e2779 23-Nov-2010 Duncan Sands <baldrick@free.fr> Rename SimplifyDistributed to the more meaningfull name SimplifyByFactorizing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120051 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
e104f1bccbf828dcbe4e82709c8ca97d8bf018d5 23-Nov-2010 Duncan Sands <baldrick@free.fr> Propagate LeftDistributes and RightDistributes into their only uses.
Stylistic improvement suggested by Frits van Bommel.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120026 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
c2b1c0b85d09aa69a625c1baacab0a310b4be552 23-Nov-2010 Duncan Sands <baldrick@free.fr> Fix typo pointed out by Frits van Bommel and Marius Wachtler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120025 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
5057f381418ddc8c96699c40479ead993cd62e7b 23-Nov-2010 Duncan Sands <baldrick@free.fr> Exploit distributive laws (eg: And distributes over Or, Mul over Add, etc) in a
fairly systematic way in instcombine. Some of these cases were already dealt
with, in which case I removed the existing code. The case of Add has a bunch of
funky logic which covers some of this plus a few variants (considers shifts to be
a form of multiplication), which I didn't touch. The simplification performed is:
A*B+A*C -> A*(B+C). The improvement is to do this in cases that were not already
handled [such as A*B-A*C -> A*(B-C), which was reported on the mailing list], and
also to do it more often by not checking for "only one use" if "B+C" simplifies.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
a63395a30f9227bde826749d3480046301b47332 22-Nov-2010 Duncan Sands <baldrick@free.fr> If a GEP index simply advances by multiples of a type of zero size,
then replace the index with zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119974 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
85bbff6c94695f07cc1a9765b4d384ed18d2fd7c 22-Nov-2010 Duncan Sands <baldrick@free.fr> Move the "gep undef" -> "undef" transform from instcombine to
InstructionSimplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119970 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
096aa79276b8527a3cbbb3691e40e729dea09523 13-Nov-2010 Duncan Sands <baldrick@free.fr> Generalize the reassociation transform in SimplifyCommutative (now renamed to
SimplifyAssociativeOrCommutative) "(A op C1) op C2" -> "A op (C1 op C2)",
which previously was only done if C1 and C2 were constants, to occur whenever
"C1 op C2" simplifies (a la InstructionSimplify). Since the simplifying operand
combination can no longer be assumed to be the right-hand terms, consider all of
the possible permutations. When compiling "gcc as one big file", transform 2
(i.e. using right-hand operands) fires about 4000 times but it has to be said
that most of the time the simplifying operands are both constants. Transforms
3, 4 and 5 each fired once. Transform 6, which is an existing transform that
I didn't change, never fired. With this change, the testcase is now optimized
perfectly with one run of instcombine (previously it required instcombine +
reassociate + instcombine, and it may just have been luck that this worked).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119002 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
a53fe6070cae7d2feccb542b8ba24b37d3fdd027 23-Oct-2010 Benjamin Kramer <benny.kra@googlemail.com> SmallVectorize.


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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115996 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
74cfb0ce1c9525cfaa4f484edf555ea18b379370 07-Oct-2010 Owen Anderson <resistor@mac.com> Add initialization routines to InstCombine.


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


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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107972 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
916973706d9b2559c7f88cef8b0f4e40a6450c06 24-Jun-2010 Gabor Greif <ggreif@gmail.com> use ArgOperand API, also tighten the type of visitFree to make this work out smoothly

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106736 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
1d9b973fd7e60e4149678a03aac762551c846f13 27-May-2010 Duncan Sands <baldrick@free.fr> Teach instCombine to remove malloc+free if malloc's only uses are comparisons
to null. Patch by Matti Niemenmaa.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104871 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
551754c4958086cc6910da7c950f2875e212f5cf 17-Apr-2010 Eric Christopher <echristo@apple.com> Revert 101465, it broke internal OpenGL testing.

Probably the best way to know that all getOperand() calls have been handled
is to replace that API instead of updating.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101579 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
4ec2258ffb495d7ce00177e447740ef1123a27db 16-Apr-2010 Gabor Greif <ggreif@gmail.com> reapply r101434
with a fix for self-hosting

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101465 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
607a7ab3da72a2eb53553a520507cbb8068dd1d8 16-Apr-2010 Gabor Greif <ggreif@gmail.com> back out r101423 and r101397, they break llvm-gcc self-host on darwin10

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101434 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
2ff961f66816daab8bbc58a19025161d969821c2 15-Apr-2010 Gabor Greif <ggreif@gmail.com> reapply r101364, which has been backed out in r101368
with a fix

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101397 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
9ee17208115482441953127615231c59a2f4d052 15-Apr-2010 Gabor Greif <ggreif@gmail.com> back out r101364, as it trips the linux nightlybot on some clang C++ tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101368 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
165dac08d1bb8428b32a5f39cdd3dbee2888987f 15-Apr-2010 Gabor Greif <ggreif@gmail.com> rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.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/Transforms/InstCombine/InstructionCombining.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/Transforms/InstCombine/InstructionCombining.cpp
8d10f9d4a836907d7bf048be507787a9233959c9 08-Jan-2010 Chris Lattner <sabre@nondot.org> teach ComputeNumSignBits to look through PHI nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92964 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
8c65f6e71c1d46d823b9a884819992a9255edd54 05-Jan-2010 Benjamin Kramer <benny.kra@googlemail.com> Move remaining stuff to the isInteger predicate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92771 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
11acaa374cdcebb161bf0de5f244265d78a749c1 05-Jan-2010 Benjamin Kramer <benny.kra@googlemail.com> Convert a ton of simple integer type equality tests to the new predicate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92760 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
321a813c536e2f1f2f05bbe78a7fbf64046f0557 05-Jan-2010 Dan Gohman <gohman@apple.com> Use do+while instead of while for loops which obviously have a
non-zero trip count. Use SmallVector's pop_back_val().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92734 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
804272c8d6fd960c47c8cbc1603aba3fe5a65ea8 05-Jan-2010 Chris Lattner <sabre@nondot.org> prune some #includes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92712 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
25f2a23b4ac9610eaa73e9dff9831fdbf1492071 05-Jan-2010 Chris Lattner <sabre@nondot.org> split and/or/xor out into one overly-large (2000LOC) file. However, I think
it does make sense to keep them together, at least for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92711 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
d3c5b2d322fc5e45bc96de79c698bf65ced699fa 05-Jan-2010 Chris Lattner <sabre@nondot.org> missed file with previous commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92710 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
948cdeba97d767df6d50496cccd4a4837e0296c8 05-Jan-2010 Chris Lattner <sabre@nondot.org> eliminate getBitCastOperand and simplify some over-complex inbounds stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92708 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
753a2b464d0628231bd3dce645edd05dfbaa3a06 05-Jan-2010 Chris Lattner <sabre@nondot.org> split call handling out to InstCombineCalls.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92707 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
16507fe9fd3518dc89bea4c6e7f98893ce89b2d1 05-Jan-2010 Chris Lattner <sabre@nondot.org> optimize cttz and ctlz when we can prove something about the
leading/trailing bits. Patch by Alastair Lynn!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92706 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
f87cd93e0ce0b707b996cd2e07584b6e9217fc05 05-Jan-2010 Chris Lattner <sabre@nondot.org> this inline function moved to addsub


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92705 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
53a19b73b5d18794c314bf93f4f3f03e5a8af1f2 05-Jan-2010 Chris Lattner <sabre@nondot.org> split add/sub out to its own file. Eliminate use of
dyn_castNotVal in the X+~X transform. dyn_castNotVal is
dramatic overkill for what the xform needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92704 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
248a84beb3c7f43c2bc394ff8b2ed472573f6e2b 05-Jan-2010 Chris Lattner <sabre@nondot.org> all the places we use hasOneUse() we know are instructions, so inline
and simplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92700 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
dea34da6f8e88d52746c00e55dc0b32b93f8a2b1 05-Jan-2010 Chris Lattner <sabre@nondot.org> eliminate AssociativeOpt and its last uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
a317e044fb6ababf4dc6dd85001ce402a959f9fc 05-Jan-2010 Chris Lattner <sabre@nondot.org> inline the FoldICmpLogical functor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92695 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
32c0cf5af933031f4e842bf44d08e96d76a70386 05-Jan-2010 Chris Lattner <sabre@nondot.org> inline the 'AddRHS' transformation, simplifying things significantly.
Eliminate the 'AddMaskingAnd' transformation, it is redundant with this
more general code right below it:
// A+B --> A|B iff A and B have no bits set in common.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
d0db8e8bad3060d5c016483ecfc62d822bc84fb7 05-Jan-2010 Chris Lattner <sabre@nondot.org> remove massive over-genality manifested as a big template
that got instantiated. There is no reason for instcombine
to try this hard for simple associative optimizations. Next
up, eliminate the template completely.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92692 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
d12c27ce0079ba14e73e0c422a30dac68c631a23 05-Jan-2010 Chris Lattner <sabre@nondot.org> split mul/div/rem instructions out to their own file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92689 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
c6334b97e1de7c7c67c7279bdc44eb99ea65c78c 05-Jan-2010 Chris Lattner <sabre@nondot.org> split select out to its own file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92687 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
8d9b8d717e665945b31b0742b901561fb433cece 05-Jan-2010 Chris Lattner <sabre@nondot.org> split out load/store/alloca.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92685 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
b8a5cecd6bc74d6c1c256263f857f79f383e53bd 05-Jan-2010 Chris Lattner <sabre@nondot.org> split vector stuff out to InstCombineVectorOps.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92683 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
f54e72962991005a3c0cc7dce0c550a14af90792 05-Jan-2010 Chris Lattner <sabre@nondot.org> split PHI node stuff out to InstCombinePHI.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92682 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
44a29e066a24e88bdf127e88be4380a5f259c4b4 05-Jan-2010 Devang Patel <dpatel@apple.com> Remove dead debug info intrinsics.
Intrinsic::dbg_stoppoint
Intrinsic::dbg_region_start
Intrinsic::dbg_region_end
Intrinsic::dbg_func_start
AutoUpgrade simply ignores these intrinsics now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92557 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
0cb1e9edd5ae9862da46d102daf613cd688eb61a 04-Jan-2010 Chris Lattner <sabre@nondot.org> silence a bogus 'might be used uninit' warning from GCC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92494 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
f3d1b5dd68b8c9fe15158ce330a8b1949269e3df 04-Jan-2010 Chris Lattner <sabre@nondot.org> move some more cast-related stuff


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92471 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
5f0290e0ef6225114a04517744bf20e93040d2e4 04-Jan-2010 Chris Lattner <sabre@nondot.org> move the [Can]EvaluateInDifferentType functions out to InstCombineCasts.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92469 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
80f43d339f0a5904c62ca6268939c14ab148b94f 04-Jan-2010 Chris Lattner <sabre@nondot.org> split 943 lines of instcombine out to a new InstCombineCasts.cpp
file. InstructionCombining.cpp is now down to a svelte 9300 lines :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92468 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
02446fc99abb06d3117d65c0b1f5fba4f906db2e 04-Jan-2010 Chris Lattner <sabre@nondot.org> split instcombine of compares (visit[FI]Cmp) out to
a new InstCombineCompares.cpp file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92467 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
e0b4b721aa82796c6ee5cf501ecd85f4974732ee 04-Jan-2010 Chris Lattner <sabre@nondot.org> move the 'SimplifyDemandedFoo' methods out to their own file, cutting 1K lines out of instcombine.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92465 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
ac8f2fd2e217d063d7ef57b8698894739f707431 04-Jan-2010 Chris Lattner <sabre@nondot.org> split the instcombine class definition out to a header shared
among the instcombine library.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
4de84762bde34dd142213444654f599759f2e5b2 04-Jan-2010 Chris Lattner <sabre@nondot.org> remove a ton of unneeded LLVMContext stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92462 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
3df5c6fff17296620a79ce80aa8c5939a85f9597 04-Jan-2010 Chris Lattner <sabre@nondot.org> move InstCombineWorklist out to its own header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92461 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
dffbef0d76549ac400e47c3688ad2d140eb49212 04-Jan-2010 Chris Lattner <sabre@nondot.org> move instcombine to its own library, it's past time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92459 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp