History log of /llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp (Results 51 – 75 of 549)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1b8fb1a6 28-Sep-2023 Nikita Popov <npopov@redhat.com>

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

Let the IRBuilder constant fold instead.


Revision tags: llvmorg-17.0.1, llvmorg-17.0.0
# d529943a 11-Sep-2023 Jeremy Morse <jeremy.morse@sony.com>

[NFC][RemoveDIs] Prefer iterators over inst-pointers in InstCombine

As per my proposal for how to eliminate debug intrinsics [0], for various
places in InstCombine prefer to insert using an instruct

[NFC][RemoveDIs] Prefer iterators over inst-pointers in InstCombine

As per my proposal for how to eliminate debug intrinsics [0], for various
places in InstCombine prefer to insert using an instruction iterator rather
than an instruction pointer. This is so that we can eventually pass more
information in the iterator class. These call-sites where I've changed the
spelling are those that necessary to build a stage2clang to produce an
identical binary in the coming no-debug-intrinsics mode.

[0] https://discourse.llvm.org/t/rfc-instruction-api-changes-needed-to-eliminate-debug-intrinsics-from-ir/68939

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

show more ...


Revision tags: llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init
# 8249d672 24-Jul-2023 Nikita Popov <npopov@redhat.com>

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

Replace these with IRBuilder uses, as we don't (from a type
perspective) care about Constant results.

Switch the predicate to m_ImmConstant() inste

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

Replace these with IRBuilder uses, as we don't (from a type
perspective) care about Constant results.

Switch the predicate to m_ImmConstant() instead of isa<Constant>
to guarantee that these do get folded away and our assumptions
about simplifications hold true.

show more ...


Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2
# 503ef0a8 06-Apr-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Remove addrspacecast bitcast extraction fold (NFC)

This is not relevant for opaque pointers, and as such no longer
necessary.


# 032e5d40 05-Apr-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Remove convertBitCastToGEP() fold (NFC)

This only applies to typed pointers, so the fold is no longer
necessary.


# d1dd9951 05-Apr-2023 Jie Fu <jiefu@tencent.com>

[InstCombine] Remove unneeded internal function 'decomposeSimpleLinearExpr' in InstCombineCasts.cpp (NFC)

/data/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:32:15: error: functi

[InstCombine] Remove unneeded internal function 'decomposeSimpleLinearExpr' in InstCombineCasts.cpp (NFC)

/data/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:32:15: error: function 'decomposeSimpleLinearExpr' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
static Value *decomposeSimpleLinearExpr(Value *Val, unsigned &Scale,
^
1 error generated.

show more ...


# 3cbdcd6e 05-Apr-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Remove PromoteCastOfAllocation() fold (NFC)

This fold does not apply to opaque pointers, and as such is no
longer needed.


Revision tags: llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4
# aff18638 06-Mar-2023 Nikita Popov <npopov@redhat.com>

[IR] Remove ConstantExpr::getUMin() (NFC)

This is part of select constant expression removal. As there is
only a single place where this is used, just expand it to explicit
constant folding calls.

[IR] Remove ConstantExpr::getUMin() (NFC)

This is part of select constant expression removal. As there is
only a single place where this is used, just expand it to explicit
constant folding calls.

(Normally we'd just use the IRBuilder here, but this isn't possible
due to mergeUndefsWith use).

show more ...


Revision tags: llvmorg-16.0.0-rc3
# ee2f9d6d 20-Feb-2023 Nikita Popov <npopov@redhat.com>

Reapply [InstCombine] Remove early constant fold

The reported compile-time regression has been address in
47f9109dff80a1abbe2705ee71dc0882b1d62274.

Additionally, this contains a change to immediate

Reapply [InstCombine] Remove early constant fold

The reported compile-time regression has been address in
47f9109dff80a1abbe2705ee71dc0882b1d62274.

Additionally, this contains a change to immediately fold zext
with constant operand, even if it's used in a trunc. I'm not sure
if this is relevant for anything, but I noticed it as a behavioral
discrepancy when investigating this issue.

-----

InstCombine currently performs a constant folding attempt as part
of the main InstCombine loop, before visiting the instruction.
However, each visit method will also attempt to simplify the
instruction, which will in turn constant fold it. (Additionally,
we also constant fold instructions before the main InstCombine loop
and use a constant folding IR builder, so this is doubly redundant.)

There is one place where InstCombine visit methods currently don't
call into simplification, and that's casts. To be conservative,
I've added an explicit constant folding call there (though it has
no impact on tests).

This makes for a mild compile-time improvement and in particular
mitigates the compile-time regression from enabling load
simplification in be88b5814d9efce131dbc0c8e288907e2e6c89be.

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

show more ...


# 77967928 24-Feb-2023 Vitaly Buka <vitalybuka@google.com>

Revert "[InstCombine] Remove early constant fold"

Increase compile time with ubsan ARM from 3 to 14 min single file.
I upload reproducer into D144369.

Also we have random timeouts on internal x86_6

Revert "[InstCombine] Remove early constant fold"

Increase compile time with ubsan ARM from 3 to 14 min single file.
I upload reproducer into D144369.

Also we have random timeouts on internal x86_64 builds.
Both bisected to this one.

This reverts commit 45a0b812fa13ec255cae91f974540a4d805a8d79.

show more ...


# 8347ca7d 22-Feb-2023 Nikita Popov <npopov@redhat.com>

[PatternMatch] Don't require DataLayout for m_VScale()

The m_VScale() matcher is unusual in that it requires a DataLayout.
It is currently used to determine the size of the GEP type. However,
I beli

[PatternMatch] Don't require DataLayout for m_VScale()

The m_VScale() matcher is unusual in that it requires a DataLayout.
It is currently used to determine the size of the GEP type. However,
I believe it is sufficient to check for the canonical
<vscale x 1 x i8> form here -- I don't think there's a need to
recognize exotic variations like <vscale x 1 x i4> as a vscale
constant representation as well.

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

show more ...


# 45a0b812 20-Feb-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Remove early constant fold

InstCombine currently performs a constant folding attempt as part
of the main InstCombine loop, before visiting the instruction.
However, each visit method w

[InstCombine] Remove early constant fold

InstCombine currently performs a constant folding attempt as part
of the main InstCombine loop, before visiting the instruction.
However, each visit method will also attempt to simplify the
instruction, which will in turn constant fold it. (Additionally,
we also constant fold instructions before the main InstCombine loop
and use a constant folding IR builder, so this is doubly redundant.)

There is one place where InstCombine visit methods currently don't
call into simplification, and that's casts. To be conservative,
I've added an explicit constant folding call there (though it has
no impact on tests).

This makes for a mild compile-time improvement and in particular
mitigates the compile-time regression from enabling load
simplification in be88b5814d9efce131dbc0c8e288907e2e6c89be.

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

show more ...


# f8f3db27 20-Feb-2023 Kazu Hirata <kazu@google.com>

Use APInt::count{l,r}_{zero,one} (NFC)


Revision tags: llvmorg-16.0.0-rc2
# da4a5a46 31-Jan-2023 Sander de Smalen <sander.desmalen@arm.com>

[InstCombine] Promote expression tree with @llvm.vscale when zero-extending result.

The LoopVectorizer emits the (scaled) element count as i32, which for
scalable VFs results in calls to @llvm.vscal

[InstCombine] Promote expression tree with @llvm.vscale when zero-extending result.

The LoopVectorizer emits the (scaled) element count as i32, which for
scalable VFs results in calls to @llvm.vscale.i32(). This value is scaled
and further zero-extended to i64.

The zero-extend can be folded away by executing the whole expression in i64
type using @llvm.vscale.i64(). Any logical `and` that would needed to mask
the result can be further folded away by KnownBits analysis when
vscale_range is set.

Reviewed By: nikic

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

show more ...


# 038f7deb 30-Jan-2023 Samuel Parker <sam.parker@arm.com>

[DAGCombine] fp_to_sint isSaturatingMinMax

Recommitting after fixing scalable vector crash.

Check for single smax pattern against zero when converting from a
small enough float.

Differential Revis

[DAGCombine] fp_to_sint isSaturatingMinMax

Recommitting after fixing scalable vector crash.

Check for single smax pattern against zero when converting from a
small enough float.

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

show more ...


Revision tags: llvmorg-16.0.0-rc1
# e60b91df 27-Jan-2023 Samuel Parker <sam.parker@arm.com>

Revert "[DAGCombine] fp_to_sint isSaturatingMinMax"

This reverts commit 85395af27241ab9c8d5763b8afcaa07f1bab26d5.

This is causing trouble with scalable vectors.


# 85395af2 26-Jan-2023 Samuel Parker <sam.parker@arm.com>

[DAGCombine] fp_to_sint isSaturatingMinMax

Check for single smax pattern against zero when converting from a
small enough float.

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


Revision tags: llvmorg-17-init
# e44a3056 24-Jan-2023 Sanjay Patel <spatel@rotateright.com>

[InstCombine] invert canonicalization of sext (x > -1) --> not (ashr x)

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

This is similar to changes made for zext + lshr:
21d3871b7c90
6c39a3aae1dc

The existing

[InstCombine] invert canonicalization of sext (x > -1) --> not (ashr x)

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

This is similar to changes made for zext + lshr:
21d3871b7c90
6c39a3aae1dc

The existing fold did not account for extra uses, so we
see some instruction count reductions in the test diffs.

This is intended to improve analysis (icmp likely has more
transforms than any other opcode), make other transforms
more symmetric with zext/lshr, and it can be inverted
in codegen if profitable.

As with the earlier changes, there is potential to uncover
infinite combine loops, but I have not found any yet.

show more ...


# b977f8df 24-Jan-2023 Sanjay Patel <spatel@rotateright.com>

[InstCombine] reduce code duplication; NFC


# c09c90b9 24-Jan-2023 Sanjay Patel <spatel@rotateright.com>

[InstCombine] rename variables for readability; NFC

There's no reason to use "CI" (cast instruction) when
we know that the value is a more specific (exact) type
of instruction (although we might wan

[InstCombine] rename variables for readability; NFC

There's no reason to use "CI" (cast instruction) when
we know that the value is a more specific (exact) type
of instruction (although we might want to common-ize some
of this code to eliminate duplication or logic diffs).

It's also visually difficult to distinguish between "CI",
"ICI", and "IC" acronyms (and those could change meaning
depending on context).

This was partially changed in earlier commits, so this
makes this pair of functions consistent.

show more ...


# b1b7fb6f 24-Jan-2023 Samuel Parker <sam.parker@arm.com>

[InstCombine] trunc (fptoui|fptosi)

Attempt to fold the trunc into the fp-to-int conversion.

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


Revision tags: llvmorg-15.0.7
# 48f5d77e 11-Jan-2023 Guillaume Chatelet <gchatelet@google.com>

[NFC] Use TypeSize::getKnownMinValue() instead of TypeSize::getKnownMinSize()

This change is one of a series to implement the discussion from
https://reviews.llvm.org/D141134.


# 2aa471bd 10-Jan-2023 Sanjay Patel <spatel@rotateright.com>

[InstCombine] remove zext-of-icmp fold that may conflict with other folds

This bit-hack transform would cause the new test to infinite loop
after 21d3871b7c90f85b3ae.

The deleted transform has exis

[InstCombine] remove zext-of-icmp fold that may conflict with other folds

This bit-hack transform would cause the new test to infinite loop
after 21d3871b7c90f85b3ae.

The deleted transform has existed for a very long time,
but the profitable parts appear to be handled by other
folds now. This fold could replace 2 instructions with
4 instructions, so it was always in danger of going
overboard.

No tests regress by removing the whole thing.

show more ...


# f400daae 09-Jan-2023 Sanjay Patel <spatel@rotateright.com>

[InstCombine] limit zext-of-icmp folds to bit-hacks

In the changed tests, we avoid creating extra instructions,
and there are no obvious regressions in IR tests at least.

Codegen should be able to

[InstCombine] limit zext-of-icmp folds to bit-hacks

In the changed tests, we avoid creating extra instructions,
and there are no obvious regressions in IR tests at least.

Codegen should be able to create the shift+mask form if that
is profitable.

This is a more general fix for issue #59897 than 0eedc9e56712 .

show more ...


# a4f3b236 09-Jan-2023 Sanjay Patel <spatel@rotateright.com>

[InstCombine] simplify code and fix formatting; NFC


12345678910>>...22