History log of /external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
605b3427a9423c1e291a9e9ab94fd7202ca864ae 31-Jul-2013 Owen Anderson <resistor@mac.com> Preserve fast-math flags when folding (fsub x, (fneg y)) to (fadd x, y).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187462 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
107c578126c477ad330bb79defb10ef14eb7dad3 27-Jul-2013 Owen Anderson <resistor@mac.com> Fix variable name.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187253 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
0c326f07ca713fa00d0dcba8ec9b61e91298f690 26-Jul-2013 Owen Anderson <resistor@mac.com> When InstCombine tries to fold away (fsub x, (fneg y)) into (fadd x, y), it is
also worthwhile for it to look through FP extensions and truncations, whose
application commutes with fneg.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187249 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
a98ce503b958821fd2530aad585c21e730695a9e 20-Jul-2013 Stephen Lin <stephenwlin@gmail.com> InstCombine: call FoldOpIntoSelect for all floating binops, not just fmul


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186759 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
54bf58a0325993a423dbad337ff709080157faf2 17-Jul-2013 Stephen Lin <stephenwlin@gmail.com> Restore r181216, which was partially reverted in r182499.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186533 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
b9df53a40b22c74ce3f3a7b4a7c0676a38cf5e73 15-Jul-2013 Craig Topper <craig.topper@gmail.com> Use llvm::array_lengthof to replace sizeof(array)/sizeof(array[0]).

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

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186095 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
c3cfe53b661533401017e39d22022656fc7c74c5 27-Jun-2013 Michael Gottesman <mgottesman@apple.com> In InstCombine{AddSub,MulDivRem} convert APFloat.isFiniteNonZero() && !APFloat.isDenormal => APFloat.isNormal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185037 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
07969dc8aed62fcd5c5760b2ec331275479f4a80 19-Jun-2013 Michael Gottesman <mgottesman@apple.com> [APFloat] Converted all references to APFloat::isNormal => APFloat::isFiniteNonZero.

Turns out all the references were in llvm and not in clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184356 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
5e6cabd163c9c207df3778f3508b0de445578057 22-May-2013 Jean-Luc Duprat <jduprat@apple.com> This is an update to a previous commit (r181216).

The earlier change list introduced the following inst combines:
B * (uitofp i1 C) —> select C, B, 0
A * (1 - uitofp i1 C) —> select C, 0, A
select C, 0, B + select C, A, 0 —> select C, A, B

Together these 3 changes would simplify :
A * (1 - uitofp i1 C) + B * uitofp i1 C
down to :
select C, B, A

In practice we found that the first two substitutions can have a
negative effect on performance, because they reduce opportunities to
use FMA contractions; between the two options FMAs are often the
better choice. This change list amends the previous one to enable
just these inst combines:

select C, B, 0 + select C, 0, A —> select C, B, A
A * (1 - uitofp i1 C) + B * uitofp i1 C —> select C, B, A




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182499 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
8ec23cb07e22198a720c4e151241059cca215c08 06-May-2013 David Majnemer <david.majnemer@gmail.com> InstCombine: (X ^ signbit) + C -> X + (signbit ^ C)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181249 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
c5cf6e536598a3b1e30fce616b771d66a071a54c 06-May-2013 Jean-Luc Duprat <jduprat@apple.com> Provide InstCombines for the following 3 cases:
A * (1 - (uitofp i1 C)) -> select C, 0, A
B * (uitofp i1 C) -> select C, B, 0
select C, 0, A + select C, B, 0 -> select C, B, A

These come up in code that has been hand-optimized from a select to a linear blend,
on platforms where that may have mattered. We want to undo such changes
with the following transform:
A*(1 - uitofp i1 C) + B*(uitofp i1 C) -> select C, A, B



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181216 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.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/InstCombineAddSub.cpp
c76067b7746f15879232c2aa27cf5c1ca35b3449 25-Mar-2013 Shuxin Yang <shuxin.llvm@gmail.com> Fix a bug in fast-math fadd/fsub simplification.

The problem is that the code mistakenly took for granted that following constructor
is able to create an APFloat from a *SIGNED* integer:

APFloat::APFloat(const fltSemantics &ourSemantics, integerPart value)

rdar://13486998


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177906 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
a0c9939873c404f272b3e0abb102c335146764fe 14-Mar-2013 Shuxin Yang <shuxin.llvm@gmail.com> Perform factorization as a last resort of unsafe fadd/fsub simplification.

Rules include:
1)1 x*y +/- x*z => x*(y +/- z)
(the order of operands dosen't matter)

2) y/x +/- z/x => (y +/- z)/x

The transformation is disabled if the new add/sub expr "y +/- z" is a
denormal/naz/inifinity.

rdar://12911472


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177088 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
8e528100d210e225cee417229d94af91355118c0 21-Jan-2013 Paul Redmond <paul.redmond@intel.com> Transform (sub 0, (zext bool to A)) to (sext bool to A) and
(sub 0, (sext bool to A)) to (zext bool to A).

Patch by Muhammad Ahmad
Reviewed by Duncan Sands


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173093 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
4ee576fac3a84553c9342faea87ff0e13e8eb48d 14-Jan-2013 David Greene <greened@obbligato.org> Fix Casting Bug

Add a const version of getFpValPtr to avoid a cast-away-const warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172467 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.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/InstCombineAddSub.cpp
d6b51d1dc158b82cab2e2a77b6c4b4fddb156952 19-Dec-2012 Shuxin Yang <shuxin.llvm@gmail.com> Make sure the buffer, which containas an instance of APFloat, has proper alignment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170486 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
1a3150098c137181576dc3e0960f8cd4abe9da1f 19-Dec-2012 Shuxin Yang <shuxin.llvm@gmail.com> rdar://12801297

InstCombine for unsafe floating-point add/sub.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170471 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
07acee7a09c4895904f827bf56cf15f6bf8ef9f6 14-Dec-2012 Michael Ilseman <milseman@apple.com> Add back FoldOpIntoPhi optimizations with fix. Included test cases to help catch these errors and to test the presence of the optimization itself

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170248 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
dcb024d27c1e303959005d64b4ae70d695fd0564 13-Dec-2012 Eric Christopher <echristo@gmail.com> Revert "Restore the PHI optimization I accidently removed" temporarily since
it seems to be breaking self-host for a few people and is PR14592.

This reverts commit r170024.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170106 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
94993e37c608d060ea2c60176f62f62291850293 12-Dec-2012 Michael Ilseman <milseman@apple.com> Restore the PHI optimization I accidently removed

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
4d96e6f0d105e60b423a118c3c8c7c5ffffae8b2 12-Dec-2012 Michael Ilseman <milseman@apple.com> Remove trailing whitespace

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170022 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
c244f381768e2e6ab9daa807adbee18de4756a07 12-Dec-2012 Michael Ilseman <milseman@apple.com> Remove redunant optimizations from InstCombine, instead call the appropriate functions from SimplifyInstruction


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169941 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.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/InstCombineAddSub.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/InstCombineAddSub.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/InstCombineAddSub.cpp
bbbe41384650142ce57ec469c2342952ed13b69d 27-Jun-2012 Evan Cheng <evan.cheng@apple.com> Remove a instcombine transform that (no longer?) makes sense:
// C - zext(bool) -> bool ? C - 1 : C
if (ZExtInst *ZI = dyn_cast<ZExtInst>(Op1))
if (ZI->getSrcTy()->isIntegerTy(1))
return SelectInst::Create(ZI->getOperand(0), SubOne(C), C);

This ends up forming sext i1 instructions that codegen to terrible code. e.g.
int blah(_Bool x, _Bool y) {
return (x - y) + 1;
}
=>
movzbl %dil, %eax
movzbl %sil, %ecx
shll $31, %ecx
sarl $31, %ecx
leal 1(%rax,%rcx), %eax
ret


Without the rule, llvm now generates:
movzbl %sil, %ecx
movzbl %dil, %eax
incl %eax
subl %ecx, %eax
ret

It also helps with ARM (and pretty much any target that doesn't have a sext i1 :-).

The transformation was done as part of Eli's r75531. He has given the ok to
remove it.

rdar://11748024


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159230 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
0f68fbb9e5a6ccc59c3c75581d4e594347ca4c92 09-Jun-2012 Nuno Lopes <nunoplopes@sapo.pt> canonicalize:
-%a + 42
into
42 - %a

previously we were emitting:
-(%a + 42)

This fixes the infinite loop in PR12338. The generated code is still not perfect, though.
Will work on that next

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.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/InstCombineAddSub.cpp
9d236f909cec671ef2ff186c8fce6d2e1540a0a9 11-May-2012 Nuno Lopes <nunoplopes@sapo.pt> objectsize: add support for GEPs with non-constant indexes
add an additional parameter to InstCombiner::EmitGEPOffset() to force it to *not* emit operations with NUW flag

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154011 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
d2348639e639573a7708de9ea98dc55bade048a6 20-Feb-2012 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Make OptimizePointerDifference more aggressive.

- Ignore pointer casts.
- Also expand GEPs that aren't constantexprs when they have one use or only constant indices.

- We now compile "&foo[i] - &foo[j]" into "i - j".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150961 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
49064ff7708bcd3b720ce79bc7629c2f3207b8d6 24-Dec-2011 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Add a combine that turns (2^n)-1 ^ x back into (2^n)-1 - x iff x is smaller than 2^n and it fuses with a following add.

This was intended to undo the sub canonicalization in cases where it's not profitable, but it also
finds some cases on it's own.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147256 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
1fdfae05b0a4356d1ed0633bf3d6cdc6eba2e173 24-Dec-2011 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Canonicalize (2^n)-1 - x into (2^n)-1 ^ x iff x is known to be smaller than 2^n.

This has the obvious advantage of being commutable and is always a win on x86 because
const - x wastes a register there. On less weird architectures this may lead to
a regression because other arithmetic doesn't fuse with it anymore. I'll address that
problem in a followup.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147254 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.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/InstCombineAddSub.cpp
bd9f6bf5cd5499715e216415989c29f820a7561c 17-Feb-2011 Chris Lattner <sabre@nondot.org> add is always integer, thanks to Frits for noticing this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125774 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
41429e3f1e4d72ee4f7d4df786b5b0c87405f5b0 17-Feb-2011 Chris Lattner <sabre@nondot.org> preserve NUW/NSW when transforming add x,x


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125711 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
6aa68a76474525255943bee914e37b68a3ba75c8 11-Feb-2011 Chris Lattner <sabre@nondot.org> When lowering an inbounds gep, the intermediate adds can have
unsigned overflow (e.g. due to a negative array index), but
the scales on array size multiplications are known to not
sign wrap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125409 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
6cdf2ea98e9952a57768a1fcdce8850089263260 10-Feb-2011 Chris Lattner <sabre@nondot.org> implement the first part of PR8882: when lowering an inbounds
gep to explicit addressing, we know that none of the intermediate
computation overflows.

This could use review: it seems that the shifts certainly wouldn't
overflow, but could the intermediate adds overflow if there is a
negative index?

Previously the testcase would instcombine to:

define i1 @test(i64 %i) {
%p1.idx.mask = and i64 %i, 4611686018427387903
%cmp = icmp eq i64 %p1.idx.mask, 1000
ret i1 %cmp
}

now we get:

define i1 @test(i64 %i) {
%cmp = icmp eq i64 %i, 1000
ret i1 %cmp
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125271 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
b9b9044600a472d5f8750f43fd884e32e2afe4cc 10-Feb-2011 Chris Lattner <sabre@nondot.org> A bunch of cleanups and simplifications using the new PatternMatch predicates
and generally tidying things up. Only very trivial functionality changes
like now doing (-1 - A) -> (~A) for vectors too.

InstCombineAddSub.cpp | 296 +++++++++++++++++++++-----------------------------
1 file changed, 126 insertions(+), 170 deletions(-)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125264 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
67920320b26cbc8c1203ee94654ac1ce1fd2af13 15-Jan-2011 Chris Lattner <sabre@nondot.org> one more instcombine variant that is needed to work with future changes,
no functionality change currently.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123517 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.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/InstCombineAddSub.cpp
fea3b218d61708ea3577f4ef14c8f7677a94db95 15-Dec-2010 Duncan Sands <baldrick@free.fr> Move Sub simplifications and additional Add simplifications out of
instcombine and into InstructionSimplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121861 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.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/InstCombineAddSub.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/InstCombineAddSub.cpp
93f8455d73858c418ee7371b8e89094716df8fc7 22-Nov-2010 Benjamin Kramer <benny.kra@googlemail.com> InstCombine: Implement X - A*-B -> X + A*B.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119984 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.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/InstCombineAddSub.cpp
a9445e11c553855a6caacbbbf77a9b993ecc651e 02-Mar-2010 Dan Gohman <gohman@apple.com> Floating-point add, sub, and mul are now spelled fadd, fsub, and fmul,
respectively.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97531 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.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/InstCombineAddSub.cpp
be7cfa6033d9f432a30f43870705bd57db0cbd5b 31-Jan-2010 Eli Friedman <eli.friedman@gmail.com> Simplify/generalize the xor+add->sign-extend instcombine.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94943 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
694488f4770468f03b974180631c0fbfa21b28cc 31-Jan-2010 Eli Friedman <eli.friedman@gmail.com> Add a small transform: transform -(X<<Y) to (-X<<Y) when the shift has a single
use and X is free to negate.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94941 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
22f3b9faaca03e3da987955bb75e867d3af7bffe 14-Jan-2010 Bill Wendling <isanbard@gmail.com> When the visitSub method was split into visitSub and visitFSub, this xform was
added to the FSub version. However, the original version of this xform guarded
against doing this for floating point (!Op0->getType()->isFPOrFPVector()).

This is causing LLVM to perform incorrect xforms for code like:

void func(double *rhi, double *rlo, double xh, double xl, double yh, double yl){
double mh, ml;
double c = 134217729.0;
double up, u1, u2, vp, v1, v2;

up = xh*c;
u1 = (xh - up) + up;
u2 = xh - u1;

vp = yh*c;
v1 = (yh - vp) + vp;
v2 = yh - v1;

mh = xh*yh;
ml = (((u1*v1 - mh) + (u1*v2)) + (u2*v1)) + (u2*v2);
ml += xh*yl + xl*yh;

*rhi = mh + ml;
*rlo = (mh - (*rhi)) + ml;
}

The last line was optimized away, but rl is intended to be the difference
between the infinitely precise result of mh + ml and after it has been rounded
to double precision.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93369 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
3168c7dd25193039b3dbf9ce6bb57c7da3e56f85 05-Jan-2010 Chris Lattner <sabre@nondot.org> reduce indentation


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