History log of /llvm-project-15.0.7/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp (Results 1 – 25 of 419)
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
# 9c8a39c6 01-Jul-2022 Sanjay Patel <[email protected]>

[InstCombine] restrict select of bit-tests to constant shift amounts

This transform is responsible for a long-standing miscompile
as discussed in issue #47012 (was bugzilla #47668).

There was a pro

[InstCombine] restrict select of bit-tests to constant shift amounts

This transform is responsible for a long-standing miscompile
as discussed in issue #47012 (was bugzilla #47668).

There was a proposal to correct it in D88432, but that was
abandoned and there hasn't been any recent activity to fix
it AFAICT.

The original patch D45108 started with a constant-shift-only
restriction and only expanded during review, so I don't think
there's much risk of perf regression on the motivating code.

show more ...


Revision tags: llvmorg-14.0.6, llvmorg-14.0.5
# 83251896 10-Jun-2022 David Sherwood <[email protected]>

[NFC][InstCombine] Refactor InstCombinerImpl::foldSelectIntoOp

Introduce a lambda function so that we remove a lot of code
duplication.

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


# 8daaea20 31-May-2022 David Sherwood <[email protected]>

[InstCombine] Use +0.0 instead of -0.0 as the FP identity for some folds

In foldSelectIntoOp we sometimes transform a select of a fadd into a
fadd of a select, where we select between data and an id

[InstCombine] Use +0.0 instead of -0.0 as the FP identity for some folds

In foldSelectIntoOp we sometimes transform a select of a fadd into a
fadd of a select, where we select between data and an identity value.
For both fadd and fsub the identity is always -0.0, but if the nsz
flag is set on the select instruction we can use +0.0 instead. Doing
so then triggers other optimisations, such as when folding the select
of masked load into a new masked load.

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

show more ...


# 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
# 45226d04 23-May-2022 Nikita Popov <[email protected]>

[InstCombine] Reuse icmp of and/or folds for logical and/or

Similarly to a change recently done for fcmps, add a flag that
indicates whether the and/or is logical to foldAndOrOfICmps, and
reuse the

[InstCombine] Reuse icmp of and/or folds for logical and/or

Similarly to a change recently done for fcmps, add a flag that
indicates whether the and/or is logical to foldAndOrOfICmps, and
reuse the function when folding logical and/or.

We were already calling some parts of it, but this gives us a
clearer indication of which parts may need poison-safe variants,
and would also allow to fold combinations of bitwise and logical
and/or.

This change should be close to NFC, because all folds this enables
were either already called previously, or can make use of implied
poison reasoning.

show more ...


# 51df77f3 19-May-2022 Chenbing Zheng <[email protected]>

[InstCombine] Allow undef vectors when foldSelectToCopysign

Reviewed By: spatel

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


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

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


Revision tags: llvmorg-14.0.3, llvmorg-14.0.2
# 40a2e355 26-Apr-2022 Juneyoung Lee <[email protected]>

[InstCombine] Remove the undef-related workaround code in visitSelectInst

This patch removes an old hack in visitSelectInst that was written to avoid miscompilation bugs in loop unswitch.
(Added via

[InstCombine] Remove the undef-related workaround code in visitSelectInst

This patch removes an old hack in visitSelectInst that was written to avoid miscompilation bugs in loop unswitch.
(Added via https://reviews.llvm.org/D35811)

The legacy loop unswitch pass will be removed after D124376, and the new simple loop unswitch pass correctly uses freeze to avoid introducing UB after D124252.

Since the hack is not necessary anymore, this patch removes it.

Reviewed By: nikic

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

show more ...


# 982cbed8 29-Apr-2022 Nikita Popov <[email protected]>

[InstCombine] Fold logical and/or of range icmps with nowrap flags

This is an edge-case where we don't convert to bitwise and/or based
on implies poison reasoning, so explicitly try to perform the f

[InstCombine] Fold logical and/or of range icmps with nowrap flags

This is an edge-case where we don't convert to bitwise and/or based
on implies poison reasoning, so explicitly try to perform the fold
in logical form. The transform itself is poison-safe, as both icmps
are based on the same value and any nowrap flags are discarded as
part of the fold (https://alive2.llvm.org/ce/z/aCwC8b for the used
example).

show more ...


# ffafa71f 27-Apr-2022 Roman Lebedev <[email protected]>

[InstCombine] 'round up integer': if bias is just right, just reuse instructions

This is only useful if we can't create new instruction
because %x.aligned has other uses and already sticks around.


# aac0afd1 27-Apr-2022 Roman Lebedev <[email protected]>

[InstCombine] Fold 'round up integer' pattern (when alignment is a power of two)

But don't deal with non-splats.

The test coverage is sufficiently exhaustive,
and alive is happy about the changes t

[InstCombine] Fold 'round up integer' pattern (when alignment is a power of two)

But don't deal with non-splats.

The test coverage is sufficiently exhaustive,
and alive is happy about the changes there.

Example with constants: https://alive2.llvm.org/ce/z/EUaJ5- / https://alive2.llvm.org/ce/z/Bkng2X
General proof: https://alive2.llvm.org/ce/z/3RjJ5A

show more ...


# 4041c448 26-Apr-2022 Ricky Zhou <[email protected]>

[InstCombine] Update predicate when canonicalizing comparisons in canonicalizeClampLike.

canonicalizeClampLike canonicalizes the ule/ugt comparisons to ult/uge,
respectively. However, it does not up

[InstCombine] Update predicate when canonicalizing comparisons in canonicalizeClampLike.

canonicalizeClampLike canonicalizes the ule/ugt comparisons to ult/uge,
respectively. However, it does not update the variable holding the
comparison predicate type after doing this. Later code fails to handle
the non-canonical predicate type (specifically, the swap of
ThresholdLowIncl and ThresholdHighExcl when Pred0 has been canonicalized
from ugt to uge). This leads to the miscompile reported in PR53252. Fix
this by updating the comparison predicate after canonicalizing.

Fixes #53252

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

show more ...


# 5805cfb9 25-Apr-2022 Chenbing Zheng <[email protected]>

[InstCombine] Complete folding of fneg-of-fabs

This patch add a function foldSelectWithFCmpToFabs, and do more combine for
fneg-of-fabs.
With 'nsz':
fold (X < +/-0.0) ? X : -X or (X <= +/-0.0) ? X

[InstCombine] Complete folding of fneg-of-fabs

This patch add a function foldSelectWithFCmpToFabs, and do more combine for
fneg-of-fabs.
With 'nsz':
fold (X < +/-0.0) ? X : -X or (X <= +/-0.0) ? X : -X to -fabs(x)
fold (X > +/-0.0) ? X : -X or (X >= +/-0.0) ? X : -X to -fabs(x)

Reviewed By: spatel

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

show more ...


# 2c2568f3 14-Apr-2022 Sanjay Patel <[email protected]>

[InstCombine] canonicalize select with signbit test

This is part of solving issue #54750 - in that example
we have both forms of the compare and do not recognize
the equivalence.


# f6bb156f 12-Apr-2022 Alexander Shaposhnikov <[email protected]>

[InstCombine] Fold icmp(X) ? f(X) : C

This diff extends foldSelectInstWithICmp to handle the case icmp(X) ? f(X) : C
when f(X) is guaranteed to be equal to C for all X in the exact range of the inve

[InstCombine] Fold icmp(X) ? f(X) : C

This diff extends foldSelectInstWithICmp to handle the case icmp(X) ? f(X) : C
when f(X) is guaranteed to be equal to C for all X in the exact range of the inverse predicate.
This addresses the issue https://github.com/llvm/llvm-project/issues/54089.

Differential revision: https://reviews.llvm.org/D123159

Test plan: make check-all

show more ...


Revision tags: llvmorg-14.0.1
# 2c3f6651 01-Apr-2022 Matt Devereau <[email protected]>

[SVE] Extend support for folding select + masked gathers

Extend the work done in D106376 to include masked gathers

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


# 9a53793a 28-Mar-2022 chenglin.bi <[email protected]>

[InstCombine] Fold two select patterns into and-or

select (~a | c), a, b -> and a, (or c, b) https://alive2.llvm.org/ce/z/bnDobs
select (~c & b), a, b -> and b, (or a, c) https://alive2.llvm.org/ce/

[InstCombine] Fold two select patterns into and-or

select (~a | c), a, b -> and a, (or c, b) https://alive2.llvm.org/ce/z/bnDobs
select (~c & b), a, b -> and b, (or a, c) https://alive2.llvm.org/ce/z/k2jJHJ

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

show more ...


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

[InstCombine] Remove integer SPF of SPF folds (NFCI)

Now that we canonicalize to intrinsics, these folds should no
longer be needed. Only one fold that also applies to floating-point
min/max is reta

[InstCombine] Remove integer SPF of SPF folds (NFCI)

Now that we canonicalize to intrinsics, these folds should no
longer be needed. Only one fold that also applies to floating-point
min/max is retained.

show more ...


# ce78e682 14-Mar-2022 Craig Topper <[email protected]>

[InstCombine] Fold select based logic of fcmps with same operands when FMF is present.

If we have a logical and/or in select form and the true/false operand
is an fcmp with poison generating FMF, we

[InstCombine] Fold select based logic of fcmps with same operands when FMF is present.

If we have a logical and/or in select form and the true/false operand
is an fcmp with poison generating FMF, we won't be able to fold it
to an and/or instruction. This prevents us from optimizing the case
where it is a logical operation of two fcmps with identical operands.

This patch adds explicit checks for this case that doesn't rely on
converting to and/or to do the optimization. It reuses the existing
foldLogicOfFCmps, but adds a new flag to disable the other combine
that is inside that function.

FMF flags from the two FCmps are intersected using the logic added in
D121243. The FIXME has been updated to indicate that we can only use
a union for the non-select form.

This allows us to optimize cases like this from compare-fp-3.c in the
gcc torture suite with fast math.

void
test1 (float x, float y)
{
if ((x==y) && (x!=y))
link_error0();
}

Reviewed By: spatel

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

show more ...


# 26748bb1 01-Mar-2022 Nikita Popov <[email protected]>

[InstCombine] Slightly relax one-use check in abs canonicalization

Treat the icmp and sub symmetrically, and require that one of them
has one use, not the icmp in particular. This could be further
r

[InstCombine] Slightly relax one-use check in abs canonicalization

Treat the icmp and sub symmetrically, and require that one of them
has one use, not the icmp in particular. This could be further
relaxed in the abs (but not nabs) case to not check one-use at
all.

show more ...


# 84812b9b 01-Mar-2022 Sanjay Patel <[email protected]>

[InstCombine] drop FMF in select->copysign transform

It is not correct to propagate flags from the select
to the new instructions:
https://alive2.llvm.org/ce/z/tNATrd
https://alive2.llvm.org/ce/z/Vw

[InstCombine] drop FMF in select->copysign transform

It is not correct to propagate flags from the select
to the new instructions:
https://alive2.llvm.org/ce/z/tNATrd
https://alive2.llvm.org/ce/z/VwcVzn

Fixes #54077

show more ...


# f422c5d8 28-Feb-2022 Sanjay Patel <[email protected]>

[InstCombine] fold select-of-zero-or-ones with negated op

(X u< 2) ? -X : -1 --> sext (X != 0)
(X u> 1) ? -1 : -X --> sext (X != 0)

https://alive2.llvm.org/ce/z/U3y5Bb
https://alive2.llvm.org/ce/z/

[InstCombine] fold select-of-zero-or-ones with negated op

(X u< 2) ? -X : -1 --> sext (X != 0)
(X u> 1) ? -1 : -X --> sext (X != 0)

https://alive2.llvm.org/ce/z/U3y5Bb
https://alive2.llvm.org/ce/z/hgi-4p

This is part of solving:

show more ...


# 9353ed6a 28-Feb-2022 Nikita Popov <[email protected]>

[InstCombine] Don't call matchSAddSubSat() for SPF (NFC)

Only call it for intrinsic min/max. The moved implementation is
unchanged apart from the one-use check: It is now hardcoded to
one-use, witho

[InstCombine] Don't call matchSAddSubSat() for SPF (NFC)

Only call it for intrinsic min/max. The moved implementation is
unchanged apart from the one-use check: It is now hardcoded to
one-use, without the two-use special case for SPF.

show more ...


# 53602e4c 28-Feb-2022 Nikita Popov <[email protected]>

[InstCombine] Remove SPF moveAddAfterMinMax() (NFC)

As SPF min/max is canonicalized to intrinsics before this point,
this change should be entirely NFC.


# ee62dcdb 24-Feb-2022 Nikita Popov <[email protected]>

[InstCombine] Remove SPF moveNotAfterMinMax() (NFC)

This happens after SPF -> intrinsic canonicalization, and as such
should be entirely NFC.


12345678910>>...17