History log of /llvm-project-15.0.7/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp (Results 1 – 25 of 356)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init
# 08091a99 22-Jul-2022 Sanjay Patel <[email protected]>

Revert "[InstCombine] enhance fold for subtract-from-constant -> xor"

This reverts commit 79bb915fb60b2cd220d89e3bb54f67abb8cdb7bd.
This caused regressions because SCEV works better with sub.


# fc18a882 08-Jul-2022 Nikita Popov <[email protected]>

[InstCombine] Avoid creating float binop ConstantExprs

Replace ConstantExpr:getFAdd etc with call to
ConstantFoldBinaryOpOperands(). I'm using the constant folding API
rather than IRBuilder here to

[InstCombine] Avoid creating float binop ConstantExprs

Replace ConstantExpr:getFAdd etc with call to
ConstantFoldBinaryOpOperands(). I'm using the constant folding API
rather than IRBuilder here to ensure that this does actually
constant fold. These transforms don't use m_ImmConstant(), so this
would not otherwise be guaranteed (and apparently, they can't use
m_ImmConstant because they want to handle scalable vector splats).

There is an opportunity here to further migrate these to the
ConstantFoldFPInstOperands() API, which would respect the denormal
mode. I've held off on doing so here, because some of this code
explicitly checks for denormal results, and I don't want to touch
it in a mostly NFC change.

show more ...


# 79bb915f 08-Jul-2022 Sanjay Patel <[email protected]>

[InstCombine] enhance fold for subtract-from-constant -> xor

A low-bit mask is not required:
https://alive2.llvm.org/ce/z/yPShss

This matches the SDAG implementation that was updated at:
8b75671314

[InstCombine] enhance fold for subtract-from-constant -> xor

A low-bit mask is not required:
https://alive2.llvm.org/ce/z/yPShss

This matches the SDAG implementation that was updated at:
8b756713140f

show more ...


# 142aca77 04-Jul-2022 Sanjay Patel <[email protected]>

[InstCombine] fold sub of min/max of sub with common operand

x - max(x - y, 0) --> min(x, y)
x - min(x - y, 0) --> max(x, y)

https://alive2.llvm.org/ce/z/2YkqFe

issue #55470


# 4276d00b 04-Jul-2022 Sanjay Patel <[email protected]>

[InstCombine] add helper function for sub-of-min/max folds; NFC

The test diffs are cosmetic -- but improvements -- because we
let instcombine handle replacement. Instead of dropping the
old value na

[InstCombine] add helper function for sub-of-min/max folds; NFC

The test diffs are cosmetic -- but improvements -- because we
let instcombine handle replacement. Instead of dropping the
old value name, it propagates to the new instruction.

show more ...


Revision tags: llvmorg-14.0.6, llvmorg-14.0.5
# b8c2781f 09-Jun-2022 Simon Moll <[email protected]>

[NFC] format InstructionSimplify & lowerCaseFunctionNames

Clang-format InstructionSimplify and convert all "FunctionName"s to
"functionName". This patch does touch a lot of files but gets done with

[NFC] format InstructionSimplify & lowerCaseFunctionNames

Clang-format InstructionSimplify and convert all "FunctionName"s to
"functionName". This patch does touch a lot of files but gets done with
the cleanup of InstructionSimplify in one commit.

This is the alternative to the less invasive clang-format only patch: D126783

Reviewed By: spatel, rengolin

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

show more ...


Revision tags: llvmorg-14.0.4
# e6e0eb3b 24-May-2022 Nikita Popov <[email protected]>

[InstCombine] Strip bitcasts in GEP diff fold

Bitcasts were stripped in one case, but not the other. Of course,
this no longer really matters with opaque pointers, but as I went
through the trouble

[InstCombine] Strip bitcasts in GEP diff fold

Bitcasts were stripped in one case, but not the other. Of course,
this no longer really matters with opaque pointers, but as I went
through the trouble of tracking this down, we may as well remove
one typed vs opaque pointer optimization discrepancy.

show more ...


# be7f09f7 16-May-2022 Sanjay Patel <[email protected]>

[IR] create and use helper functions that test the signbit; NFCI


# 2a0837aa 13-May-2022 Chenbing Zheng <[email protected]>

[InstCombine] fix sub(add(X,Y),umin(Y,Z)) --> add(X,usub.sat(Y,Z))

This patch fix bug left in D124503. We should do
sub(add(X,Z),umin(Y,Z)) --> add(X,usub.sat(Z,Y)) instead of
sub(add(X,Z),umin(Y,Z)

[InstCombine] fix sub(add(X,Y),umin(Y,Z)) --> add(X,usub.sat(Y,Z))

This patch fix bug left in D124503. We should do
sub(add(X,Z),umin(Y,Z)) --> add(X,usub.sat(Z,Y)) instead of
sub(add(X,Z),umin(Y,Z)) --> add(X,usub.sat(Y,Z)).

Reviewed By: spatel

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

show more ...


# 394c683d 07-May-2022 Chenbing Zheng <[email protected]>

[InstCombine] sub(add(X,Y),umin(Y,Z)) --> add(X,usub.sat(Y,Z))

Alive2: https://alive2.llvm.org/ce/z/2UNVbp

Reviewed By: RKSimon, spatel

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


Revision tags: llvmorg-14.0.3, llvmorg-14.0.2
# ffe13960 22-Apr-2022 Simon Pilgrim <[email protected]>

[InstCombine] Fold (A & 2^C1) + A => A & (2^C1 - 1) iff bit C1 in A is a sign bit (PR21929)

Alive2: https://alive2.llvm.org/ce/z/Ygq26C

This is the final missing fold to handle the modulo2 simplifi

[InstCombine] Fold (A & 2^C1) + A => A & (2^C1 - 1) iff bit C1 in A is a sign bit (PR21929)

Alive2: https://alive2.llvm.org/ce/z/Ygq26C

This is the final missing fold to handle the modulo2 simplification: https://github.com/llvm/llvm-project/issues/22303

Fixes #22303

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

show more ...


Revision tags: llvmorg-14.0.1
# 431e93f4 11-Apr-2022 Simon Pilgrim <[email protected]>

[InstCombine] Fold sub(add(x,y),min/max(x,y)) -> max/min(x,y) (PR38280)

As discussed on Issue #37628, we can flip a min/max node if we're subtracting from the sum of the node's operands

Alive2: htt

[InstCombine] Fold sub(add(x,y),min/max(x,y)) -> max/min(x,y) (PR38280)

As discussed on Issue #37628, we can flip a min/max node if we're subtracting from the sum of the node's operands

Alive2: https://alive2.llvm.org/ce/z/W_KXfy

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

show more ...


# 4397504c 24-Mar-2022 Dávid Bolvanský <[email protected]>

[NFCI] Fix set-but-unused warning in InstCombineAddSub.cpp


# 598721f8 15-Mar-2022 Sanjay Patel <[email protected]>

[InstCombine] try harder to propagate 'nsz' through fneg-of-select

This can be viewed as swapping the select arms:
https://alive2.llvm.org/ce/z/jUvFMJ
...so we don't have the 'nsz' problem with the

[InstCombine] try harder to propagate 'nsz' through fneg-of-select

This can be viewed as swapping the select arms:
https://alive2.llvm.org/ce/z/jUvFMJ
...so we don't have the 'nsz' problem with the more general fold.

This unlocks other folds for the motivating fabs example.
This was discussed in issue #38828.

show more ...


Revision tags: llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2
# d5ea3b2f 24-Feb-2022 Nikita Popov <[email protected]>

[InstCombine] Remove sub of SPF min/max fold (NFCI)

This isn't necessary anymore, now that we canonicalize SPF min/max
to intrinsics. Might not be strictly NFC due to worklist order
changes.


# 5379f76e 24-Feb-2022 Sanjay Patel <[email protected]>

[InstCombine] try harder to preserve 'nsz' in fneg-of-select transform

The corner case where 'nsz' needs to be removed is very narrow
as discussed here:
https://reviews.llvm.org/rG3cdd05e519dd

If t

[InstCombine] try harder to preserve 'nsz' in fneg-of-select transform

The corner case where 'nsz' needs to be removed is very narrow
as discussed here:
https://reviews.llvm.org/rG3cdd05e519dd

If the select condition is not undef, there's no problem with
propagating 'nsz':
https://alive2.llvm.org/ce/z/4GWJdq

show more ...


# e2f627e5 23-Feb-2022 Nikita Popov <[email protected]>

[InstCombine] Fold sub of umin to usub.sat

We were handling sub of umax, but not the conjugated umin case.

https://alive2.llvm.org/ce/z/4fdZfy
https://alive2.llvm.org/ce/z/BhUQBM


Revision tags: llvmorg-14.0.0-rc1, llvmorg-15-init
# f15014ff 26-Jan-2022 Benjamin Kramer <[email protected]>

Revert "Rename llvm::array_lengthof into llvm::size to match std::size from C++17"

This reverts commit ef8206320769ad31422a803a0d6de6077fd231d2.

- It conflicts with the existing llvm::size in STLEx

Revert "Rename llvm::array_lengthof into llvm::size to match std::size from C++17"

This reverts commit ef8206320769ad31422a803a0d6de6077fd231d2.

- It conflicts with the existing llvm::size in STLExtras, which will now
never be called.
- Calling it without llvm:: breaks C++17 compat

show more ...


# ef820632 26-Jan-2022 serge-sans-paille <[email protected]>

Rename llvm::array_lengthof into llvm::size to match std::size from C++17

As a conquence move llvm::array_lengthof from STLExtras.h to
STLForwardCompat.h (which is included by STLExtras.h so no buil

Rename llvm::array_lengthof into llvm::size to match std::size from C++17

As a conquence move llvm::array_lengthof from STLExtras.h to
STLForwardCompat.h (which is included by STLExtras.h so no build
breakage expected).

show more ...


# 39e602b6 22-Jan-2022 Sanjay Patel <[email protected]>

[InstCombine] try to fold binop with phi operands

This is an alternate version of D115914 that handles/tests all binary opcodes.

I suspect that we don't see these patterns too often because -simpli

[InstCombine] try to fold binop with phi operands

This is an alternate version of D115914 that handles/tests all binary opcodes.

I suspect that we don't see these patterns too often because -simplifycfg
would convert the minimal cases into selects rather than leave them in phi form
(note: instcombine has logic holes for combining the select patterns too though,
so that's another potential patch).

We only create a new binop in a predecessor that unconditionally branches to
the final block.
https://alive2.llvm.org/ce/z/C57M2F
https://alive2.llvm.org/ce/z/WHwAoU (not safe to speculate an sdiv for example)
https://alive2.llvm.org/ce/z/rdVUvW (but it is ok on this path)

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

show more ...


Revision tags: llvmorg-13.0.1, llvmorg-13.0.1-rc3
# 2d50630e 18-Jan-2022 Sanjay Patel <[email protected]>

[InstCombine] reduce code duplication; NFC


# d8e0e125 18-Jan-2022 Daniil Kovalev <[email protected]>

[InstCombine] Simplify addends reordering logic

Previously some constants were not pushed to the top of the resulting
expression tree as intended by the algorithm. We can remove the logic
from simpl

[InstCombine] Simplify addends reordering logic

Previously some constants were not pushed to the top of the resulting
expression tree as intended by the algorithm. We can remove the logic
from simplifyFAdd and rely on SimplifyAssociativeOrCommutative to do
that.

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

show more ...


# 4cdf30d9 17-Jan-2022 Sanjay Patel <[email protected]>

[InstCombine] FP with reassoc FMF: (X * C) + X --> X * (MulC + 1.0)

This fold already exists for scalars via FAddCombine (and that's
why 2 of the tests are only changed cosmetically), but that code

[InstCombine] FP with reassoc FMF: (X * C) + X --> X * (MulC + 1.0)

This fold already exists for scalars via FAddCombine (and that's
why 2 of the tests are only changed cosmetically), but that code
misses vectors and has largely been replaced by simpler folds
over time, so this is another step towards removing it.

show more ...


Revision tags: llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1
# d5c002bd 09-Nov-2021 Sanjay Patel <[email protected]>

[InstCombine] fix code comment to match code; NFC


# 2a88d00c 09-Nov-2021 Sanjay Patel <[email protected]>

[InstCombine] fold sub-of-umax to 0-usubsat

Op0 - umax(X, Op0) --> 0 - usub.sat(X, Op1)

I'm not sure if this is really an improvement in IR because
we probably have better recognition/analysis for

[InstCombine] fold sub-of-umax to 0-usubsat

Op0 - umax(X, Op0) --> 0 - usub.sat(X, Op1)

I'm not sure if this is really an improvement in IR because
we probably have better recognition/analysis for min/max,
but this lines up with the fold we do for the icmp+select
idiom and removes another diff from D98152.

This is similar to the previous fold in the code that was
added with:
83c2fb9f66be
baa6a851308d

https://alive2.llvm.org/ce/z/5MrVB9

show more ...


12345678910>>...15