History log of /external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.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/Transforms/InstCombine/InstCombineAndOrXor.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/InstCombineAndOrXor.cpp
36b56886974eae4f9c5ebc96befd3e7bfe5de338 24-Apr-2014 Stephen Hines <srhines@google.com> Update to LLVM 3.5a.

Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
0d833348c2dea181e08d3ece8da18079653f96ee 13-Nov-2013 Nadav Rotem <nrotem@apple.com> Update the docs to match the function name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
6c84f7ad2dbba5d1afa26a4929c3b032ae9e7e10 12-Nov-2013 Nadav Rotem <nrotem@apple.com> Fold (iszero(A&K1) | iszero(A&K2)) -> (A&(K1|K2)) != (K1|K2) if we know that K1 and K2 are 'one-hot' (only one bit is on).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194525 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
0415b1810bbf93f434f1c561e172bf24c1cb37dc 04-Sep-2013 Tim Northover <tnorthover@apple.com> InstCombine: allow unmasked icmps to be combined with logical ops

"(icmp op i8 A, B)" is equivalent to "(icmp op i8 (A & 0xff), B)" as a
degenerate case. Allowing this as a "masked" comparison when analysing "(icmp)
&/| (icmp)" allows us to combine them in more cases.

rdar://problem/7625728

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
7bfabdac4ebf82f9f6a9ee7a00fd948f729dc7fe 04-Sep-2013 Tim Northover <tnorthover@apple.com> InstCombine: look for masked compares with subset relation

Even in cases which aren't universally optimisable like "(A & B) != 0 && (A &
C) != 0", the masks can make one of the comparisons completely redundant. In
this case, since we've gone to the effort of spotting masked comparisons we
should combine them.

rdar://problem/7625728

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189930 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
bff3c587f68530faa1d2be962255254e9adce264 16-Aug-2013 Jim Grosbach <grosbach@apple.com> InstCombine: Use isAllOnesValue() instead of explicit -1.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188563 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
4658ce9c1f023ca8198add9eabc9ec466d23c8cb 16-Aug-2013 Jim Grosbach <grosbach@apple.com> InstCombine: Simplify if(x!=0 && x!=-1).

When both constants are positive or both constants are negative,
InstCombine already simplifies comparisons like this, but when
it's exactly zero and -1, the operand sorting ends up reversed
and the pattern fails to match. Handle that special case.

Follow up for rdar://14689217

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188512 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
a0ec3f9b7b826b9b40b80199923b664bad808cce 14-Jul-2013 Craig Topper <craig.topper@gmail.com> Use SmallVectorImpl& instead of SmallVector to avoid repeating small vector size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186274 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
b1b738e03613e98f0ae367af1b5423221c5bd29d 05-Jul-2013 David Majnemer <david.majnemer@gmail.com> InstCombine: (icmp eq B, 0) | (icmp ult A, B) -> (icmp ule A, B-1)

This transform allows us to turn IR that looks like:
%1 = icmp eq i64 %b, 0
%2 = icmp ult i64 %a, %b
%3 = or i1 %1, %2
ret i1 %3

into:
%0 = add i64 %b, -1
%1 = icmp uge i64 %0, %a
ret i1 %1

which means we go from lowering:
cmpq %rsi, %rdi
setb %cl
testq %rsi, %rsi
sete %al
orb %cl, %al
ret

to lowering:
decq %rsi
cmpq %rdi, %rsi
setae %al
ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185677 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
c6e2ab3a573af4d3b486eb9164cce8e6760ef8dd 06-Jun-2013 Jakub Staszak <kubastaszak@gmail.com> Remove unneeded cast<>.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183363 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
f2d03d74ffe05d08ac7dccbb81f41d996a1f1d2a 06-Jun-2013 Jakub Staszak <kubastaszak@gmail.com> Use IRBuilder instead of ConstantInt methods.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183360 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
c6af2432c802d241c8fffbe0371c023e6c58844e 25-May-2013 Michael J. Spencer <bigcheesegs@gmail.com> Replace Count{Leading,Trailing}Zeros_{32,64} with count{Leading,Trailing}Zeros.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
024d943bca85ee0b6bc1b9e5f13ec5276f16c13d 14-Apr-2013 David Majnemer <david.majnemer@gmail.com> Reorders two transforms that collide with each other

One performs: (X == 13 | X == 14) -> X-13 <u 2
The other: (A == C1 || A == C2) -> (A & ~(C1 ^ C2)) == C1

The problem is that there are certain values of C1 and C2 that
trigger both transforms but the first one blocks out the second,
this generates suboptimal code.

Reordering the transforms should be better in every case and
allows us to do interesting stuff like turn:
%shr = lshr i32 %X, 4
%and = and i32 %shr, 15
%add = add i32 %and, -14
%tobool = icmp ne i32 %add, 0

into:
%and = and i32 %X, 240
%tobool = icmp ne i32 %and, 224


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179493 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
6ac927860610d134f2a35119abff6eb2d81846a1 12-Apr-2013 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Check the operand types before merging fcmp ord & fcmp ord.

Fixes PR15737.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179417 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
03fceff6f69a0261a767aab8e62de8aa9301b86c 05-Apr-2013 Jim Grosbach <grosbach@apple.com> Tidy up a bit. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178915 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
e629a33d166f55a916f40a1feae47af8ab97feed 09-Mar-2013 Jakub Staszak <kubastaszak@gmail.com> Simplify code. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176765 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
cc54889cd58322b8766525f43cc1f7cb52e4692e 17-Feb-2013 Bill Wendling <isanbard@gmail.com> The transform is:

(or (bool?A:B),(bool?C:D)) --> (bool?(or A,C):(or B,D))

By the time the OR is visited, both the SELECTs have been visited and not
optimized and the OR itself hasn't been transformed so we do this transform in
the hopes that the new ORs will be optimized.

The transform is explicitly disabled for vector-selects until "codegen matures
to handle them better".

Patch by Muhammad Tauqir!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175380 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
cc687faba373e6aa3cefe594bd9f3212e18617eb 30-Jan-2013 Nadav Rotem <nrotem@apple.com> InstCombine: canonicalize sext-and --> select
sext-not-and --> select.

Patch by Muhammad Tauqir Ahmad.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173901 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.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/InstCombineAndOrXor.cpp
526057921dcb57e0d51d60ddb0f5ce16596c307f 31-Dec-2012 Jakub Staszak <kubastaszak@gmail.com> Add extra CHECK to make sure that 'or' instruction was replaced.
Also add an assert to avoid confusion in the code where is known that C1 <= C2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171310 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
b6d9c4181a57a4b57d92a4437761387606f49c2d 31-Dec-2012 Jakub Staszak <kubastaszak@gmail.com> Grammo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171272 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
d60b8ac64fa161646d50c49d6171cb49e6a2c7ee 31-Dec-2012 Jakub Staszak <kubastaszak@gmail.com> Transform (A == C1 || A == C2) into (A & ~(C1 ^ C2)) == C1
if C1 and C2 differ only with one bit.
Fixes PR14708.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171270 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
00f8102758316cf754668b98c748c2a349f37966 20-Dec-2012 Craig Topper <craig.topper@gmail.com> Formatting fixes. Remove some unnecessary 'else' after 'return'. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170676 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
41a05dc59c599b2d121650c77ec11e28d17e5cc7 20-Dec-2012 Craig Topper <craig.topper@gmail.com> Removing trailing whitespace

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170675 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.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/InstCombineAndOrXor.cpp
b30e256993e075c838ffa1b7af6b04dd28be2c34 26-Nov-2012 Shuxin Yang <shuxin.llvm@gmail.com> rdar://12329730 (defect 2)

Enhancement to InstCombine. Try to catch this opportunity:

---------------------------------------------------------------
((X^C1) >> C2) ^ C3 => (X>>C2) ^ ((C1>>C2)^C3)
where the subexpression "X ^ C1" has more than one uses, and
"(X^C1) >> C2" has single use.
----------------------------------------------------------------

Reviewed by Nadav (with minor change per his request).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
45fc0b65e22124333d0545675e18d2dd00ebe967 15-Nov-2012 NAKAMURA Takumi <geek4civic@gmail.com> InstCombineAndOrXor.cpp: Escape bracket in doxygen description. [-Wdocumentation]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168013 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.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/InstCombineAndOrXor.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/InstCombineAndOrXor.cpp
7a0575b9a8ca291c33495623eae171394f33b58f 14-Jun-2012 Manman Ren <mren@apple.com> InstCombine: fix a bug when combining (fcmp cc0 x, y) && (fcmp cc1 x, y).

uno && ueq was converted to ueq, it should be converted to uno.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158441 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
8b421c8eb2c41ee66cd1023bc7c262bdfaea481d 06-Jun-2012 Chad Rosier <mcrosier@apple.com> Fix combine of uno && ord -> false so that the ordering of the fcmps doesn't
matter.
rdar://11579835


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158084 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
7bb9f063be7c1228eb2647364ce3bbc9b31b7dc8 28-May-2012 Benjamin Kramer <benny.kra@googlemail.com> Fix suspicous hasOneUse() check, found by PVS Studio (PR12357).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157592 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
c1fc5e4464788be072509eab7d66a73dc7a5f275 27-Apr-2012 Chad Rosier <mcrosier@apple.com> Add instcombine patterns for the following transformations:

(x & y) | (x ^ y) -> x | y
(x & y) + (x ^ y) -> x | y

Patch by Manman Ren.
rdar://10770603


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155674 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
de813b7108de64829ab006e6b998a7b38d119ecc 26-Mar-2012 Chris Lattner <sabre@nondot.org> eliminate an unneeded branch, part of PR12357


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153458 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
e9f15c8a563a745c5cafa7c98b1f12de2dcab070 16-Mar-2012 Eli Friedman <eli.friedman@gmail.com> In InstCombiner::visitOr, make sure we reverse the operand swap used for checking for or-of-xor operations after those checks; a later check expects that any constant will be in Op1. PR12234.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
e1b66f11459c7f1523939fb6ac1dfdc93e1d26ef 29-Feb-2012 Bill Wendling <isanbard@gmail.com> Restrict this transformation to equality conditions.

This transformation is not correct for not-equal conditions:

(trunc x) != C1 & (and x, CA) != C2 -> (and x, CA|CMAX) != C1|C2

Let
C1 == 0
C2 == 0
CA == 0xFF0000
CMAX == 0xFF
and truncating to i8.

The original truth table:

x | A: trunc x != 0 | B: x & 0xFF0000 != 0 | A & B != 0
--------------------------------------------------------------
0x00000 | 0 | 0 | 0
0x00001 | 1 | 0 | 0
0x10000 | 0 | 1 | 0
0x10001 | 1 | 1 | 1

The truth table of the replacement:

x | x & 0xFF00FF != 0
----------------------------
0x00000 | 0
0x00001 | 1
0x10000 | 1
0x10001 | 1

So they are different.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151691 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
858143816d43e58b17bfd11cb1b57afbd7f0f893 07-Feb-2012 Craig Topper <craig.topper@gmail.com> Convert assert(0) to llvm_unreachable

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149967 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
7ba962fe4ac04acd12db803cbc255b0c00a6e4ea 06-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> Make helper static.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149865 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.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/Transforms/InstCombine/InstCombineAndOrXor.cpp
7e4ac32a4e674c077317f190e9507ccb26eeaf3f 09-Jan-2012 Benjamin Kramer <benny.kra@googlemail.com> Move assert to the right place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
47a86077212bb680c3273842b1aba801757836ea 09-Jan-2012 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Teach foldLogOpOfMaskedICmpsHelper that sign bit tests are bit tests.

This subsumes several other transforms while enabling us to catch more cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147777 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
d4242d8ab11b0da74867299cec7c2f6354c037dd 08-Jan-2012 Benjamin Kramer <benny.kra@googlemail.com> Tweak my last commit to be less conservative about uses.

We still save an instruction when just the "and" part is replaced.
Also change the code to match comments more closely.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147753 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
dfb806f6ba53b792171b928b57def9d0182d2f5f 08-Jan-2012 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: If we have a bit test and a sign test anded/ored together, merge the sign bit into the bit test.

This is common in bit field code, e.g. checking if the first or the last bit of a bit field is set.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147749 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
2e33944c101f2a08ed1d85e807830f2fc089dd06 17-Dec-2011 Pete Cooper <peter_cooper@apple.com> Refactor code used in InstCombine::FoldAndOfICmps to new file.

This will be used by SimplifyCfg in a later commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146803 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.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/Transforms/InstCombine/InstCombineAndOrXor.cpp
c6b8ba86738cb6187835e440f2baafaa24dea0b2 19-Sep-2011 Eli Friedman <eli.friedman@gmail.com> Fix an infinite loop where a transform in InstCombiner::visitAnd claims a construct is changed when it is not. (See included testcase.)

Patch by Xiaoyi Guo.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140072 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.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/InstCombineAndOrXor.cpp
eb9a85f09e18b3fe88499710404b38d3a9128f62 14-Jul-2011 Benjamin Kramer <benny.kra@googlemail.com> Change Intrinsic::getDeclaration and friends to take an ArrayRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135154 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
5fdd6c8793462549e3593890ec61573da06e3346 12-Jul-2011 Jay Foad <jay.foad@gmail.com> Second attempt at de-constifying LLVM Types in FunctionType::get(),
StructType::get() and TargetData::getIntPtrType().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134982 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
2280ebd61416b73d0b6137f275b25af82e268d1f 12-Jul-2011 Bill Wendling <isanbard@gmail.com> Revert r134893 and r134888 (and related patches in other trees). It was causing
an assert on Darwin llvm-gcc builds.

Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.llvm-gcc-i386-darwin9-RA/llvm.src/lib/VMCore/Instructions.cpp, li\
ne 2067.
etc.

http://smooshlab.apple.com:8013/builders/llvm-gcc-i386-darwin9-RA/builds/2354

--- Reverse-merging r134893 into '.':
U include/llvm/Target/TargetData.h
U include/llvm/DerivedTypes.h
U tools/bugpoint/ExtractFunction.cpp
U unittests/Support/TypeBuilderTest.cpp
U lib/Target/ARM/ARMGlobalMerge.cpp
U lib/Target/TargetData.cpp
U lib/VMCore/Constants.cpp
U lib/VMCore/Type.cpp
U lib/VMCore/Core.cpp
U lib/Transforms/Utils/CodeExtractor.cpp
U lib/Transforms/Instrumentation/ProfilingUtils.cpp
U lib/Transforms/IPO/DeadArgumentElimination.cpp
U lib/CodeGen/SjLjEHPrepare.cpp
--- Reverse-merging r134888 into '.':
G include/llvm/DerivedTypes.h
U include/llvm/Support/TypeBuilder.h
U include/llvm/Intrinsics.h
U unittests/Analysis/ScalarEvolutionTest.cpp
U unittests/ExecutionEngine/JIT/JITTest.cpp
U unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp
U unittests/VMCore/PassManagerTest.cpp
G unittests/Support/TypeBuilderTest.cpp
U lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp
U lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp
U lib/VMCore/IRBuilder.cpp
G lib/VMCore/Type.cpp
U lib/VMCore/Function.cpp
G lib/VMCore/Core.cpp
U lib/VMCore/Module.cpp
U lib/AsmParser/LLParser.cpp
U lib/Transforms/Utils/CloneFunction.cpp
G lib/Transforms/Utils/CodeExtractor.cpp
U lib/Transforms/Utils/InlineFunction.cpp
U lib/Transforms/Instrumentation/GCOVProfiling.cpp
U lib/Transforms/Scalar/ObjCARC.cpp
U lib/Transforms/Scalar/SimplifyLibCalls.cpp
U lib/Transforms/Scalar/MemCpyOptimizer.cpp
G lib/Transforms/IPO/DeadArgumentElimination.cpp
U lib/Transforms/IPO/ArgumentPromotion.cpp
U lib/Transforms/InstCombine/InstCombineCompares.cpp
U lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
U lib/Transforms/InstCombine/InstCombineCalls.cpp
U lib/CodeGen/DwarfEHPrepare.cpp
U lib/CodeGen/IntrinsicLowering.cpp
U lib/Bitcode/Reader/BitcodeReader.cpp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
f362affa3a695164a94d275fb44d18f44ebb855a 11-Jul-2011 Jay Foad <jay.foad@gmail.com> De-constify Types in FunctionType::get().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134888 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
b0884f3f13ca6e5d83e3232d8390a4d58739d57c 28-Apr-2011 Benjamin Kramer <benny.kra@googlemail.com> We require threse bits to be zero, too.

This shouldn't happen in practice because the icmp would be a constant.
Add a check so we don't miscompile code if something goes wrong.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130446 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
e12d58362176a7ea7ead7afa157194c18359499f 28-Apr-2011 Benjamin Kramer <benny.kra@googlemail.com> Fix a comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130428 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
264ac878b26e90fe446aba9163d714d28d05bd8d 28-Apr-2011 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Merge "(trunc x) == C1 & (and x, CA) == C2" into a single and+icmp.

This happens when GVN widens loads. Part of PR6627.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
3ec01b7dac769449723a25d8f7d33b49c917ccc9 15-Apr-2011 Eli Friedman <eli.friedman@gmail.com> Add an instcombine for constructs like a | -(b != c); a select is more
canonical, and generally leads to better code. Found while looking at
an article about saturating arithmetic.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129545 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
9822b869fc4310dd0584838ca79745f3d051ca74 30-Mar-2011 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Add a few missing combines for ANDs and ORs of sign bit tests.

On x86 we now compile "if (a < 0 && b < 0)" into
testl %edi, %esi
js IF.THEN

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128496 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
d70be0b2c199183077626a9e756ecd14b807dd56 01-Mar-2011 Anders Carlsson <andersca@mac.com> Make InstCombiner::FoldAndOfICmps create a ConstantRange that's the
intersection of the LHS and RHS ConstantRanges and return "false" when
the range is empty.

This simplifies some code and catches some extra cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126744 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
38f7f66fcc6ed5e43be4d9c96c782d4eabdb7342 20-Feb-2011 Benjamin Kramer <benny.kra@googlemail.com> Move "A | ~(A & ?) -> -1" from InstCombine to InstructionSimplify.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126082 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
91e37ef278779c3c8700bbddbb5c9d37739b1716 20-Feb-2011 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Add a bunch of combines of the form x | (y ^ z).

We usually catch this kind of optimization through InstSimplify's distributive
magic, but or doesn't distribute over xor in general.

"A | ~(A | B) -> A | ~B" hits 24 times on gcc.c.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126081 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
d9e087bbc31f71a91ce5497f41e50de439805220 15-Feb-2011 Nadav Rotem <nadav.rotem@intel.com> Fix 9216 - Endless loop in InstCombine pass.
The pattern "A&(A^B) -> A & ~B" recreated itself because ~B is
actually a xor -1.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125557 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
da1d660aa285b724818bdd547f1b538011cc5459 15-Feb-2011 Chris Lattner <sabre@nondot.org> tidy up a bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125546 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
44cc997d42f896c42a0d37fd8b98d9ec0cb28501 10-Feb-2011 Chris Lattner <sabre@nondot.org> more cleanups, notably bitcast isn't used for "signed to unsigned type
conversions". :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125265 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
aeaf3d484b4d4c35e8794378c4b6cfbbde718dd1 09-Feb-2011 Chris Lattner <sabre@nondot.org> Rework InstrTypes.h so to reduce the repetition around the NSW/NUW/Exact
versions of creation functions. Eventually, the "insertion point" versions
of these should just be removed, we do have IRBuilder afterall.

Do a massive rewrite of much of pattern match. It is now shorter and less
redundant and has several other widgets I will be using in other patches.
Among other changes, m_Div is renamed to m_IDiv (since it only matches
integer divides) and m_Shift is gone (it used to match all binops!!) and
we now have m_LogicalShift for the one client to use.

Enhance IRBuilder to have "isExact" arguments to things like CreateUDiv
and reduce redundancy within IRbuilder by having these methods chain to
each other more instead of duplicating code.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125194 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
5d2e1889622cc20ada6146041e6d862a6588194f 21-Jan-2011 Owen Anderson <resistor@mac.com> Just because we have determined that an (fcmp | fcmp) is true for A < B,
A == B, and A > B, does not mean we can fold it to true. We still need to
check for A ? B (A unordered B).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123993 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
28621cb36f1d5c761dc5b493c501b4c7252fe5dc 15-Jan-2011 Chris Lattner <sabre@nondot.org> reduce indentation


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.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/InstCombineAndOrXor.cpp
b0de244f23c2e11505cab729f198dfaaa2028532 20-Dec-2010 Benjamin Kramer <benny.kra@googlemail.com> Add a check missing from my last commit and avoid a potential overflow situation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122258 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
4dc1ac094714a5866b9d32c6bbf2ecaa672fde48 20-Dec-2010 Benjamin Kramer <benny.kra@googlemail.com> Reduce indentation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122249 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
5337f20c1516296edcea6bc3da6cdc74329142ae 20-Dec-2010 Benjamin Kramer <benny.kra@googlemail.com> Teach InstCombine to merge (icmp ult (X + CA), C1) | (icmp eq X, C2) into (icmp ult (X + CA), C1 + 1) if C2 + CA == C1.

InstCombine creates these so now we compile x == 23 || x == 24 || x == 25 to
%x.off = add i32 %x, -23
%1 = icmp ult i32 %x.off, 3
instead of
%x.off = add i32 %x, -23
%1 = icmp ult i32 %x.off, 2
%cmp3 = icmp eq i32 %x, 25
%ret2 = or i1 %1, %cmp3


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122248 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.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/InstCombineAndOrXor.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/InstCombineAndOrXor.cpp
2b749870d0488c3b049edf5d0c8875f56f5b1bed 17-Nov-2010 Duncan Sands <baldrick@free.fr> Move some those Xor simplifications which don't require creating new
instructions out of InstCombine and into InstructionSimplify. While
there, introduce an m_AllOnes pattern to simplify matching with integers
and vectors with all bits equal to one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.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/InstCombineAndOrXor.cpp
2c5f19db2eef055d2a65482504ae98e79f2ca24d 13-Sep-2010 Owen Anderson <resistor@mac.com> Re-apply r113679, which was reverted in r113720, which added a paid of new instcombine transforms
to expose greater opportunities for store narrowing in codegen. This patch fixes a potential
infinite loop in instcombine caused by one of the introduced transforms being overly aggressive.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113763 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
298c45e845e1743f86b060cd280e8729cd4ba468 12-Sep-2010 Eric Christopher <echristo@apple.com> Revert 113679, it was causing an infinite loop in a testcase that I've sent
on to Owen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113720 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
26c5663283f89f1624304723ebe8c25d253463a3 11-Sep-2010 Owen Anderson <resistor@mac.com> Invert and-of-or into or-of-and when doing so would allow us to clear bits of the and's mask.
This can result in increased opportunities for store narrowing in code generation. Update a number of
tests for this change. This fixes <rdar://problem/8285027>.

Additionally, because this inverts the order of ors and ands, some patterns for optimizing or-of-and-of-or
no longer fire in instances where they did originally. Add a simple transform which recaptures most of these
opportunities: if we have an or-of-constant-or and have failed to fold away the inner or, commute the order
of the two ors, to give the non-constant or a chance for simplification instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113679 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
0ca25608b97d0d02273887fe58e87bb3cfa062d3 10-Sep-2010 Benjamin Kramer <benny.kra@googlemail.com> This transform is also performed by InstructionSimplify, remove the duplicate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113608 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
5c3c23afe77a2ce784b613af12cf9278c38fdcbf 09-Sep-2010 Owen Anderson <resistor@mac.com> Generalize instcombine's support for combining multiple bit checks into a single test. Patch by Dirk Steinke!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113423 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
61378363b76ad84dc7effff506d7c3e991225743 02-Aug-2010 Owen Anderson <resistor@mac.com> Re-apply the infamous r108614, with a fix pointed out by Dirk Steinke.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110036 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
10b173a1e7fb6ca21bdbc617b9c86592db27489d 31-Jul-2010 Daniel Dunbar <daniel@zuster.org> Speculatively revert r108614, "Another attempt at getting the clang self-host to
like my instcombine patch.", in an attempt to fix Clang i386 bootstrap.
- Also PR7719.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109953 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
7e3012c34509a5c1e7c891bcadb5caaed462deb1 17-Jul-2010 Owen Anderson <resistor@mac.com> Another attempt at getting the clang self-host to like my instcombine patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
de309a8b529bb978cea072680738147e04d21e70 16-Jul-2010 Eric Christopher <echristo@apple.com> Also revert 108422, it's causing some test failures.

Working on testcases for Owen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108494 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
11acba047007a5bb13eea472e8487bfbbd73ec11 15-Jul-2010 Owen Anderson <resistor@mac.com> Speculatively revert r108429 to fix the clang self-host.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108436 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
40bf5e7a6811bf31b6853d2c71c08feed871419b 15-Jul-2010 Owen Anderson <resistor@mac.com> Per Chris' suggestion, get rid of the select canonicalization and just add
the corresponding or-icmp-and pattern. This has the added benefit of doing
the matching earlier, and thus being less susceptible to being confused by
earlier transforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108429 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
96fe621e078837a150b321003f1dd07dd2b830ba 15-Jul-2010 Owen Anderson <resistor@mac.com> Reapply r108378, with bugfixes, testcase, and improved comment formatting.
This now passes LIT, nighty test, and llvm-gcc bootstrap on my machine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108422 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
5e84e8e52a9e965b22d21e20ad3ee22b2cf91ce3 15-Jul-2010 Eli Friedman <eli.friedman@gmail.com> Speculatively revert r108378; may be causing bootstrap failures.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108389 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
bd129a746058dc5d8da089f1351ff417de3114e7 15-Jul-2010 Owen Anderson <resistor@mac.com> Add instcombine transforms to optimize tests of multiple bits of the same value into a single larger comparison.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108378 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
07c9b64719f913015d23c7b6d1e0f135ddc3d018 14-Jul-2010 Chris Lattner <sabre@nondot.org> revert r108320, I see the failures now...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108322 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
7e185af9302cfc5e9dffdba65c8a99f9f57b4076 14-Jul-2010 Chris Lattner <sabre@nondot.org> reapply benjamin's instcombine patch, I don't see anything wrong with it and can't repro any problems with a manual self-host.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108320 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
c9fe6374b7681c392a135bfe2d9819a9237bf879 12-Jul-2010 Benjamin Kramer <benny.kra@googlemail.com> Nope, still breaks the release selfhost bots :(


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
8fd437c43fccc73777ba6aefa9d38c78281e5828 12-Jul-2010 Benjamin Kramer <benny.kra@googlemail.com> Reapply the "or" half of r108136, which seems to be less problematic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108152 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
e2d07b5208362159e8deb886c03225b7f5a03cf2 12-Jul-2010 Benjamin Kramer <benny.kra@googlemail.com> Revert r108141 again, sigh.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108148 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
98a8206e58d32adebaba501d40266eefb42cb06a 12-Jul-2010 Benjamin Kramer <benny.kra@googlemail.com> Reapply 108136 with an ugly pasto fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108141 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
ad854f0764e6a386b0dc49a2640766b8e9ae0b61 12-Jul-2010 Benjamin Kramer <benny.kra@googlemail.com> Move optimization to avoid redundant matching.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108140 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
0cc4ed1ca504c9e5631d16ababb8baceb4fce6ea 12-Jul-2010 Benjamin Kramer <benny.kra@googlemail.com> Revert r108136 until I figure out why it broke selfhost.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
4fc719e60767c80541a21c99d139a904b4c948df 12-Jul-2010 Benjamin Kramer <benny.kra@googlemail.com> instcombine: fold (x & y) | (~x & z) and (x & y) ^ (~x & z) into ((y ^ z) & x) ^ z which is one instruction shorter. (PR6773)

before:
%and = and i32 %y, %x
%neg = xor i32 %x, -1
%and4 = and i32 %z, %neg
%xor = xor i32 %and4, %and

after:
%xor1 = xor i32 %z, %y
%and2 = and i32 %xor1, %x
%xor = xor i32 %and2, %z


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
6c3ae655b846ae663ea14000adf3b42e9455ce56 09-Apr-2010 Dan Gohman <gohman@apple.com> Minor code simplification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100859 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
f34f48c57870cf4eb4d48e23b11e29b95d1950c3 05-Mar-2010 Chris Lattner <sabre@nondot.org> Fix PR6503. This turned into a much more interesting and nasty bug. Various
parts of the cmp|cmp and cmp&cmp folding logic wasn't prepared for vectors
(unrelated to the bug but noticed while in the code) and the code was
*definitely* not safe to use by the (cast icmp)|(cast icmp) handling logic
that I added in r95855. Fix all this up by changing the various routines
to more consistently use IRBuilder and not pass in the I which had the wrong
type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97801 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
d6f645ac09a28b5b45f390b2597444514be8a70e 05-Mar-2010 Chris Lattner <sabre@nondot.org> simplify some functions and make them work with vector
compares, noticed by inspection.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97795 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
7d9f2b93a356aa89186522bd61c5c565718ff555 03-Mar-2010 Bill Wendling <isanbard@gmail.com> This test case:

long test(long x) { return (x & 123124) | 3; }

Currently compiles to:

_test:
orl $3, %edi
movq %rdi, %rax
andq $123127, %rax
ret

This is because instruction and DAG combiners canonicalize

(or (and x, C), D) -> (and (or, D), (C | D))

However, this is only profitable if (C & D) != 0. It gets in the way of the
3-addressification because the input bits are known to be zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97616 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.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/InstCombineAndOrXor.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/InstCombineAndOrXor.cpp
8c5ad3a5da7419af4d31963c3824836b5da52478 11-Feb-2010 Chris Lattner <sabre@nondot.org> Rename ValueRequiresCast to ShouldOptimizeCast, to better reflect
what it does. Enhance it to return false to optimizing vector
sign extensions from vector comparisions, which is the idiom used
to get a splatted vector for a vector comparison.

Doing this breaks vector-casts.ll, add some compensating
transformations to handle the important case they cover without
depending on this canonicalization.

This fixes rdar://7434900 a serious pessimization of vector compares.


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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95781 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
e576f292ee5f7af40489a68fa626d53a14e46a10 09-Feb-2010 Chris Lattner <sabre@nondot.org> simplify this code, duh.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95643 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
e538db4fb0ec30500da721a2a698946fa36db1a8 09-Feb-2010 Chris Lattner <sabre@nondot.org> fix PR6193, only considering sign extensions *from i1* for this
xform.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95642 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
74529826a70546d71c6558e9a3917244a87acfe9 05-Feb-2010 Chris Lattner <sabre@nondot.org> fix logical-select to invoke filecheck right, and fix hte instcombine
xform it is checking to actually pass. There is no need to match
m_SelectCst<0, -1> since instcombine canonicalizes that into not(sext).

Add matches for sext(not(x)) in addition to not(sext(x)).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95420 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
39ceb471b7ebaf0ebef09f7916419ae2e0f30acc 02-Feb-2010 Chris Lattner <sabre@nondot.org> don't turn (A & (C0?-1:0)) | (B & ~(C0?-1:0)) -> C0 ? A : B
for vectors. Codegen is generating awful code or segfaulting
in various cases (e.g. PR6204).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95058 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
abb992d6a3d2dc05d3f3c62a367ea8977a7dd070 24-Jan-2010 Chris Lattner <sabre@nondot.org> change the canonical form of "cond ? -1 : 0" to be
"sext cond" instead of a select. This simplifies some instcombine
code, matches the policy for zext (cond ? 1 : 0 -> zext), and allows
us to generate better code for a testcase on ppc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94339 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
c0404b3715151d020dda074740bbdaa794f9328a 19-Jan-2010 Chris Lattner <sabre@nondot.org> optimize ~(~X >>s Y) --> (X >>s Y), patch by Edmund Grimley
Evans!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93884 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
8e76764de86d7906db5123626b65f593e159d9f3 11-Jan-2010 Chris Lattner <sabre@nondot.org> add one more bitfield optimization, allowing clang to generate
good code on PR4216:

_test_bitfield: ## @test_bitfield
orl $32962, %edi
movl $4294941946, %eax
andq %rdi, %rax
ret

instead of:

_test_bitfield:
movl $4294941696, %ecx
movl %edi, %eax
orl $194, %edi
orl $32768, %eax
andq $250, %rdi
andq %rax, %rcx
movq %rdi, %rax
orq %rcx, %rax
ret

Evan is looking into the remaining andq+imm -> andl optimization.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93147 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.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/InstCombineAndOrXor.cpp