History log of /llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp (Results 26 – 50 of 549)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 6960ace5 20-Mar-2024 Noah Goldstein <goldstein.w.n@gmail.com>

Revert "[InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0`"

This reverts commit d80d5b923c6f611590a12543bdb33e0c16044d44.

It wasn't a particularly important transform to begin with

Revert "[InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0`"

This reverts commit d80d5b923c6f611590a12543bdb33e0c16044d44.

It wasn't a particularly important transform to begin with and caused
some codegen regressions on targets that prefer `sitofp` so dropping.

Might re-visit along with adding `nneg` flag to `uitofp` so its easily
reversable for the backend.

show more ...


Revision tags: llvmorg-18.1.2
# a747e86c 19-Mar-2024 Yingwei Zheng <dtcxzyw2333@gmail.com>

[InstCombine] Fold `fpto{s|u}i non-norm` to zero (#85569)

This patch enables more optimization after canonicalizing `fmul X, 0.0`
into a copysign.
I decide to implement this fold in InstCombine be

[InstCombine] Fold `fpto{s|u}i non-norm` to zero (#85569)

This patch enables more optimization after canonicalizing `fmul X, 0.0`
into a copysign.
I decide to implement this fold in InstCombine because
`computeKnownFPClass` may be expensive.

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

show more ...


Revision tags: llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3
# d80d5b92 20-Feb-2024 Noah Goldstein <goldstein.w.n@gmail.com>

[InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0`

Just a standard canonicalization.

Proofs: https://alive2.llvm.org/ce/z/9W4VFm

Closes #82404


# c18e1215 13-Mar-2024 Yingwei Zheng <dtcxzyw2333@gmail.com>

[InstCombine] Simplify `zext nneg i1 X` to zero (#85043)

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


# e96c0c1d 05-Mar-2024 Quentin Dian <dianqk@dianqk.net>

[InstCombine] Fix shift calculation in InstCombineCasts (#84027)

Fixes #84025.


# d3f6dd65 22-Feb-2024 Benjamin Kramer <benny.kra@googlemail.com>

[InstCombine] Pick bfloat over half when shrinking ops that started with an fpext from bfloat (#82493)

This fixes the case where we would shrink an frem to half and then
bitcast to bfloat, producin

[InstCombine] Pick bfloat over half when shrinking ops that started with an fpext from bfloat (#82493)

This fixes the case where we would shrink an frem to half and then
bitcast to bfloat, producing invalid results. The transformation was
written under the assumption that there is only one type with a given
bit width.

Also add a strategic assert to CastInst::CreateFPCast to turn this
miscompilation into a crash.

show more ...


# f37d81f8 07-Feb-2024 Yingwei Zheng <dtcxzyw2333@gmail.com>

[PatternMatch] Add a matching helper `m_ElementWiseBitCast`. NFC. (#80764)

This patch introduces a matching helper `m_ElementWiseBitCast`, which is
used for matching element-wise int <-> fp casts.

[PatternMatch] Add a matching helper `m_ElementWiseBitCast`. NFC. (#80764)

This patch introduces a matching helper `m_ElementWiseBitCast`, which is
used for matching element-wise int <-> fp casts.
The motivation of this patch is to avoid duplicating checks in
https://github.com/llvm/llvm-project/pull/80740 and
https://github.com/llvm/llvm-project/pull/80414.

show more ...


Revision tags: llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init
# 5a667bee 19-Jan-2024 Alexey Bataev <5361294+alexey-bataev@users.noreply.github.com>

[InstCombine] Try to fold trunc(shuffle(zext)) to just a shuffle (#78636)

Tries to remove extra trunc/ext instruction for shufflevector
instructions.

Differential Review: https://github.com/llvm/ll

[InstCombine] Try to fold trunc(shuffle(zext)) to just a shuffle (#78636)

Tries to remove extra trunc/ext instruction for shufflevector
instructions.

Differential Review: https://github.com/llvm/llvm-project/pull/78636

show more ...


# 4482fd84 19-Jan-2024 Pranav Kant <prka@google.com>

Revert "[InstCombine] Try to fold trunc(shuffle(zext)) to just a shuffle (#78636)"

This reverts commit 4d11f04b20f0bd7488e19e8f178ba028412fa519.

This breaks some programs as mentioned in #78636


# 4d11f04b 19-Jan-2024 Alexey Bataev <5361294+alexey-bataev@users.noreply.github.com>

[InstCombine] Try to fold trunc(shuffle(zext)) to just a shuffle (#78636)

Tries to remove extra trunc/ext instruction for shufflevector
instructions.


# 4b3ea337 29-Nov-2023 Nikita Popov <npopov@redhat.com>

[ValueTracking] Convert isKnownNonNegative() to use SimplifyQuery (NFC)


Revision tags: llvmorg-17.0.6
# ac75171d 21-Nov-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Fix incorrect nneg inference on shift amount

Whether this is valid depends on the bit widths of the involved
integers.

Fixes https://github.com/llvm/llvm-project/issues/72927.


Revision tags: llvmorg-17.0.5
# 44cdbef7 13-Nov-2023 Yingwei Zheng <dtcxzyw2333@gmail.com>

[InstCombine] Infer nneg flag from shift users (#71947)

This patch sets `nneg` flag when the zext is only used by a shift.

Alive2: https://alive2.llvm.org/ce/z/h3xKjP
Compile-time impact:
https

[InstCombine] Infer nneg flag from shift users (#71947)

This patch sets `nneg` flag when the zext is only used by a shift.

Alive2: https://alive2.llvm.org/ce/z/h3xKjP
Compile-time impact:
https://llvm-compile-time-tracker.com/compare.php?from=bd611264993f64decbce178d460caf1d1cb05f59&to=26bc473b239010bb24ff1bc39d58b42ecbbc4730&stat=instructions:u

This is an alternative to #71906.

show more ...


# 8391f405 10-Nov-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Avoid uses of ConstantExpr::getLShr()

Use the constant folding API instead.


# 5918f623 08-Nov-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Infer zext nneg flag (#71534)

Use KnownBits to infer the nneg flag on zext instructions.

Currently we only set nneg when converting sext -> zext, but don't set
it when we have a ze

[InstCombine] Infer zext nneg flag (#71534)

Use KnownBits to infer the nneg flag on zext instructions.

Currently we only set nneg when converting sext -> zext, but don't set
it when we have a zext in the first place. If we want to use it in
optimizations, we should make sure the flag inference is consistent.

show more ...


# 7d398389 07-Nov-2023 Antonio Frighetto <me@antoniofrighetto.com>

[InstCombine] Favour `CreateZExtOrTrunc` in `narrowFunnelShift` (NFC)

Use `CreateZExtOrTrunc`, reduce test and regenerate checks.


# caa124b5 07-Nov-2023 Antonio Frighetto <me@antoniofrighetto.com>

[InstCombine] Zero-extend shift amounts in narrow funnel shift ops

An issue arose when handling shift amounts while performing
narrowed funnel shifts simplification. Specifically, shift
amounts were

[InstCombine] Zero-extend shift amounts in narrow funnel shift ops

An issue arose when handling shift amounts while performing
narrowed funnel shifts simplification. Specifically, shift
amounts were incorrectly truncated when their type was
narrower than the target bit width. This has been addressed
by zero-extending `ShAmt` in such cases.

Fixes: https://github.com/llvm/llvm-project/issues/71463.

Proof: https://alive2.llvm.org/ce/z/5draKz.

show more ...


Revision tags: llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2
# bd29197f 22-Sep-2023 Noah Goldstein <goldstein.w.n@gmail.com>

[InstCombine] Fold `(ptrtoint (ptrmask p0, m0))` -> `(and (ptrtoint p0), m0)`

`and` is generally more supported so if we have a `ptrmask` anyways
might as well use `and`.

Differential Revision: htt

[InstCombine] Fold `(ptrtoint (ptrmask p0, m0))` -> `(and (ptrtoint p0), m0)`

`and` is generally more supported so if we have a `ptrmask` anyways
might as well use `and`.

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

Closes #67166

show more ...


# c7f0e499 01-Nov-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Fix canAlwaysEvaluateInTy() with constant exprs

The m_ZExtOrSExt / m_Trunc in the following code can match constant
expressions, which we don't want here. Make sure we bail out early
f

[InstCombine] Fix canAlwaysEvaluateInTy() with constant exprs

The m_ZExtOrSExt / m_Trunc in the following code can match constant
expressions, which we don't want here. Make sure we bail out early
for non-immediate constants.

show more ...


# aca9c891 01-Nov-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Avoid use of ConstantExpr::getIntegerCast()

Require that constants are ImmConstant for this transform, as we
may otherwise generate constant expressions, which are not
necessarily free.


# 0b5e0fb6 01-Nov-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Avoid some uses of ConstantExpr::getIntegerCast() (NFC)

Use IRBuilder or ConstantFolding instead.


# 3f2ed812 30-Oct-2023 Philip Reames <preames@rivosinc.com>

[InstCombine] Infer nneg on zext when forming from non-negative sext (#70706)

Builds on #67982 which recently introduced the nneg flag on a zext
instruction. InstCombine is one of our largest canon

[InstCombine] Infer nneg on zext when forming from non-negative sext (#70706)

Builds on #67982 which recently introduced the nneg flag on a zext
instruction. InstCombine is one of our largest canonicalizers of zext
from non-negative sext instructions, so set the flag there.

show more ...


# e4dc7d49 27-Oct-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Remove redundant cast of GEP fold (NFC)

With opaque pointers, zero-index GEPs will be eliminated in
general.


# ea86fb8c 09-Oct-2023 Allen <zhongyunde@huawei.com>

[InstCombine] Fold zext-of-icmp with no shift (#68503)

This regression triggers after commit f400daa to fix infinite loop
issue.

In this case, we can known the shift count is 0, so it will not b

[InstCombine] Fold zext-of-icmp with no shift (#68503)

This regression triggers after commit f400daa to fix infinite loop
issue.

In this case, we can known the shift count is 0, so it will not be
triggered by the form of (iN (~X) u>> (N - 1)) in commit 21d3871, of
which N indicates the data type bitwidth of X.

Fixes https://github.com/llvm/llvm-project/issues/68465.

show more ...


# 9ace23c9 02-Oct-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Avoid use of ConstantExpr::getSExt() (NFC)

Use the constant folding API instead.


12345678910>>...22