History log of /llvm-project/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp (Results 276 – 300 of 463)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# a9ca7090 06-Apr-2018 Sanjay Patel <spatel@rotateright.com>

[InstCombine] limit nsz: -(X - Y) --> Y - X to hasOneUse()

As noted in the post-commit discussion for r329350, we shouldn't
generally assume that fsub is the same cost as fneg.

llvm-svn: 329429


# 04683de8 05-Apr-2018 Sanjay Patel <spatel@rotateright.com>

[InstCombine] FP: Z - (X - Y) --> Z + (Y - X)

This restores what was lost with rL73243 but without
re-introducing the bug that was present in the old code.

Note that we already have these transform

[InstCombine] FP: Z - (X - Y) --> Z + (Y - X)

This restores what was lost with rL73243 but without
re-introducing the bug that was present in the old code.

Note that we already have these transforms if the ops are
marked 'fast' (and I assume that's happening somewhere in
the code added with rL170471), but we clearly don't need
all of 'fast' for these transforms.

llvm-svn: 329362

show more ...


# 03e25267 05-Apr-2018 Sanjay Patel <spatel@rotateright.com>

[InstCombine] nsz: -(X - Y) --> Y - X

This restores part of the fold that was removed with rL73243 (PR4374).

llvm-svn: 329350


# deaf4f35 05-Apr-2018 Sanjay Patel <spatel@rotateright.com>

[InstCombine] use pattern matchers for fsub --> fadd folds

This allows folding for vectors with undef elements.

llvm-svn: 329316


Revision tags: llvmorg-5.0.2, llvmorg-5.0.2-rc2
# 93e64dd9 25-Mar-2018 Sanjay Patel <spatel@rotateright.com>

[PatternMatch] allow undef elements when matching vector FP +0.0

This continues the FP constant pattern matching improvements from:
https://reviews.llvm.org/rL327627
https://reviews.llvm.org/rL32733

[PatternMatch] allow undef elements when matching vector FP +0.0

This continues the FP constant pattern matching improvements from:
https://reviews.llvm.org/rL327627
https://reviews.llvm.org/rL327339
https://reviews.llvm.org/rL327307

Several integer constant matchers also have this ability. I'm
separating matching of integer/pointer null from FP positive zero
and renaming/commenting to make the functionality clearer.

llvm-svn: 328461

show more ...


Revision tags: llvmorg-5.0.2-rc1
# 1a8d5c3d 03-Mar-2018 Sanjay Patel <spatel@rotateright.com>

[InstCombine] (~X) - (~Y) --> Y - X

llvm-svn: 326660


Revision tags: llvmorg-6.0.0
# 8fdd87f9 28-Feb-2018 Sanjay Patel <spatel@rotateright.com>

[InstCombine] move constant check into foldBinOpIntoSelectOrPhi; NFCI

Also, rename 'foldOpWithConstantIntoOperand' because that's annoyingly
vague. The constant check is redundant in some cases, bu

[InstCombine] move constant check into foldBinOpIntoSelectOrPhi; NFCI

Also, rename 'foldOpWithConstantIntoOperand' because that's annoyingly
vague. The constant check is redundant in some cases, but it allows
removing duplication for most of the calls.

llvm-svn: 326329

show more ...


# 4a9116e8 23-Feb-2018 Sanjay Patel <spatel@rotateright.com>

[InstCombine] use FMF-copying functions to reduce code; NFCI

llvm-svn: 325923


Revision tags: llvmorg-6.0.0-rc3, llvmorg-6.0.0-rc2, llvmorg-6.0.0-rc1
# b6404a8c 06-Dec-2017 Sanjay Patel <spatel@rotateright.com>

[InstCombine] canonicalize constant-minus-boolean to select-of-constants

This restores the half of:
https://reviews.llvm.org/rL75531
that was reverted at:
https://reviews.llvm.org/rL159230

For the

[InstCombine] canonicalize constant-minus-boolean to select-of-constants

This restores the half of:
https://reviews.llvm.org/rL75531
that was reverted at:
https://reviews.llvm.org/rL159230

For the x86 case mentioned there, we now produce:
leal 1(%rdi), %eax
subl %esi, %eax

We have target hooks to invert this in DAGCombiner (and x86 is enabled) with:
https://reviews.llvm.org/rL296977
https://reviews.llvm.org/rL311731

AArch64 and possibly other targets would probably benefit from enabling those hooks too.
See PR30327:
https://bugs.llvm.org/show_bug.cgi?id=30327#c2

Differential Revision: https://reviews.llvm.org/D40612

llvm-svn: 319964

show more ...


Revision tags: llvmorg-5.0.1, llvmorg-5.0.1-rc3, llvmorg-5.0.1-rc2
# 629c4115 06-Nov-2017 Sanjay Patel <spatel@rotateright.com>

[IR] redefine 'UnsafeAlgebra' / 'reassoc' fast-math-flags and add 'trans' fast-math-flag

As discussed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2016-November/107104.html
and again more r

[IR] redefine 'UnsafeAlgebra' / 'reassoc' fast-math-flags and add 'trans' fast-math-flag

As discussed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2016-November/107104.html
and again more recently:
http://lists.llvm.org/pipermail/llvm-dev/2017-October/118118.html

...this is a step in cleaning up our fast-math-flags implementation in IR to better match
the capabilities of both clang's user-visible flags and the backend's flags for SDNode.

As proposed in the above threads, we're replacing the 'UnsafeAlgebra' bit (which had the
'umbrella' meaning that all flags are set) with a new bit that only applies to algebraic
reassociation - 'AllowReassoc'.

We're also adding a bit to allow approximations for library functions called 'ApproxFunc'
(this was initially proposed as 'libm' or similar).

...and we're out of bits. 7 bits ought to be enough for anyone, right? :) FWIW, I did
look at getting this out of SubclassOptionalData via SubclassData (spacious 16-bits),
but that's apparently already used for other purposes. Also, I don't think we can just
add a field to FPMathOperator because Operator is not intended to be instantiated.
We'll defer movement of FMF to another day.

We keep the 'fast' keyword. I thought about removing that, but seeing IR like this:
%f.fast = fadd reassoc nnan ninf nsz arcp contract afn float %op1, %op2
...made me think we want to keep the shortcut synonym.

Finally, this change is binary incompatible with existing IR as seen in the
compatibility tests. This statement:
"Newer releases can ignore features from older releases, but they cannot miscompile
them. For example, if nsw is ever replaced with something else, dropping it would be
a valid way to upgrade the IR."
( http://llvm.org/docs/DeveloperPolicy.html#ir-backwards-compatibility )
...provides the flexibility we want to make this change without requiring a new IR
version. Ie, we're not loosening the FP strictness of existing IR. At worst, we will
fail to optimize some previously 'fast' code because it's no longer recognized as
'fast'. This should get fixed as we audit/squash all of the uses of 'isFast()'.

Note: an inter-dependent clang commit to use the new API name should closely follow
commit.

Differential Revision: https://reviews.llvm.org/D39304

llvm-svn: 317488

show more ...


Revision tags: llvmorg-5.0.1-rc1
# 7f0f9bc5 24-Oct-2017 Eugene Zelenko <eugene.zelenko@gmail.com>

[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 316503


# b869f76d 13-Oct-2017 Sanjay Patel <spatel@rotateright.com>

[InstCombine] use m_Neg() to reduce code; NFCI

llvm-svn: 315762


# f0242de1 13-Oct-2017 Sanjay Patel <spatel@rotateright.com>

[InstCombine] move code to remove repeated constant check; NFCI

Also, consolidate tests for this fold in one place.

llvm-svn: 315745


# 28b3aa36 13-Oct-2017 Sanjay Patel <spatel@rotateright.com>

[InstCombine] recycle adds for better efficiency

Also, clean up unnecessary matcher capture variable initializations.

llvm-svn: 315743


# 21189521 13-Oct-2017 Sanjay Patel <spatel@rotateright.com>

[InstCombine] use local var to reduce code duplication; NFCI

llvm-svn: 315728


# c419c9f6 13-Oct-2017 Sanjay Patel <spatel@rotateright.com>

[InstCombine] add hasOneUse check to add-zext-add fold to prevent increasing instructions

llvm-svn: 315718


# 76ed9eab 13-Oct-2017 Sanjay Patel <spatel@rotateright.com>

[InstCombine] use AddOne helper to reduce code; NFC

llvm-svn: 315709


# 8d810fee 13-Oct-2017 Sanjay Patel <spatel@rotateright.com>

[InstCombine] rearrange code to remove repeated constant check; NFCI

llvm-svn: 315703


# 2150651a 13-Oct-2017 Sanjay Patel <spatel@rotateright.com>

[InstCombine] allow zext(bool) + C --> select bool, C+1, C for vector types

The backend should be prepared for this transform after:
https://reviews.llvm.org/rL311731

llvm-svn: 315701


# aa103b3d 20-Sep-2017 Quentin Colombet <qcolombet@apple.com>

[InstCombine] Add select simplifications

In these cases, two selects have constant selectable operands for
both the true and false components and have the same conditional
expression.
We then create

[InstCombine] Add select simplifications

In these cases, two selects have constant selectable operands for
both the true and false components and have the same conditional
expression.
We then create two arithmetic operations of the same type and feed a
final select operation using the result of the true arithmetic for the true
operand and the result of the false arithmetic for the false operand and reuse
the original conditionl expression.
The arithmetic operations are naturally folded as a consequence, leaving
only the newly formed select to replace the old arithmetic operation.

Patch by: Michael Berg <michael_c_berg@apple.com>
Differential Revision: https://reviews.llvm.org/D37019

llvm-svn: 313774

show more ...


Revision tags: llvmorg-5.0.0, llvmorg-5.0.0-rc5, llvmorg-5.0.0-rc4, llvmorg-5.0.0-rc3, llvmorg-5.0.0-rc2
# 60855214 27-Jul-2017 Hiroshi Yamauchi <yamauchi@google.com>

[InstCombine] Simplify pointer difference subtractions (GEP-GEP) where GEPs have other uses and one non-constant index

Summary:
Pointer difference simplifications currently happen only if input GEPs

[InstCombine] Simplify pointer difference subtractions (GEP-GEP) where GEPs have other uses and one non-constant index

Summary:
Pointer difference simplifications currently happen only if input GEPs don't have other uses or their indexes are all constants, to avoid duplicating indexing arithmetic.

This patch enables cases with exactly one non-constant index among input GEPs to happen where there is no duplicated arithmetic or code size increase even if input GEPs have other uses.

For example, this patch allows "(&A[42][i]-&A[42][0])" --> "i", which didn't happen previously, if the input GEP(s) have other uses.

Reviewers: sanjoy, bkramer

Reviewed By: sanjoy

Subscribers: mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D35499

llvm-svn: 309304

show more ...


# 0445e31c 26-Jul-2017 Hiroshi Yamauchi <yamauchi@google.com>

Fix a comment (test commit).

llvm-svn: 309192


Revision tags: llvmorg-5.0.0-rc1
# fde4723e 09-Jul-2017 Craig Topper <craig.topper@intel.com>

[IR] Add Type::isIntOrIntVectorTy(unsigned) similar to the existing isIntegerTy(unsigned), but also works for vectors.

llvm-svn: 307492


# bb4069e4 07-Jul-2017 Craig Topper <craig.topper@intel.com>

[InstCombine] Make InstCombine's IRBuilder be passed by reference everywhere

Previously the InstCombiner class contained a pointer to an IR builder that had been passed to the constructor. Sometimes

[InstCombine] Make InstCombine's IRBuilder be passed by reference everywhere

Previously the InstCombiner class contained a pointer to an IR builder that had been passed to the constructor. Sometimes this would be passed to helper functions as either a pointer or the pointer would be dereferenced to be passed by reference.

This patch makes it a reference everywhere including the InstCombiner class itself so there is more inconsistency. This a large, but mechanical patch. I've done very minimal formatting changes on it despite what clang-format wanted to do.

llvm-svn: 307451

show more ...


# 2f3ead7a 25-Jun-2017 Sanjay Patel <spatel@rotateright.com>

[InstCombine] add (sext i1 X), 1 --> zext (not X)

http://rise4fun.com/Alive/i8Q

A narrow bitwise logic op is obviously better than math for value tracking,
and zext is better than sext. Typically,

[InstCombine] add (sext i1 X), 1 --> zext (not X)

http://rise4fun.com/Alive/i8Q

A narrow bitwise logic op is obviously better than math for value tracking,
and zext is better than sext. Typically, the 'not' will be folded into an
icmp predicate.

The IR difference would even survive through codegen for x86, so we would see
worse code:

https://godbolt.org/g/C14HMF

one_or_zero(int, int): # @one_or_zero(int, int)
xorl %eax, %eax
cmpl %esi, %edi
setle %al
retq

one_or_zero_alt(int, int): # @one_or_zero_alt(int, int)
xorl %ecx, %ecx
cmpl %esi, %edi
setg %cl
movl $1, %eax
subl %ecx, %eax
retq

llvm-svn: 306243

show more ...


1...<<111213141516171819