History log of /llvm-project/llvm/test/Transforms/InstCombine/assume.ll (Results 1 – 25 of 73)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init
# 2570e354 15-Jan-2025 Andreas Jonson <andjo403@hotmail.com>

[InstCombine] Handle trunc to i1 in align assume. (#122949)

proof: https://alive2.llvm.org/ce/z/EyAUA4


Revision tags: llvmorg-19.1.7
# 2d2fc4eb 13-Jan-2025 Andreas Jonson <andjo403@hotmail.com>

[InstCombine] Test for trunc in align assume (NFC)


Revision tags: llvmorg-19.1.6
# 462cb3cd 05-Dec-2024 Nikita Popov <npopov@redhat.com>

[InstCombine] Infer nusw + nneg -> nuw for getelementptr (#111144)

If the gep is nusw (usually via inbounds) and the offset is
non-negative, we can infer nuw.

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

[InstCombine] Infer nusw + nneg -> nuw for getelementptr (#111144)

If the gep is nusw (usually via inbounds) and the offset is
non-negative, we can infer nuw.

Proof: https://alive2.llvm.org/ce/z/ihztLy

show more ...


Revision tags: 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
# 380fa875 01-Sep-2024 Yingwei Zheng <dtcxzyw2333@gmail.com>

[InstCombine] Replace all dominated uses of condition with constants (#105510)

This patch replaces all dominated uses of condition with true/false to
improve context-sensitive optimizations. It eli

[InstCombine] Replace all dominated uses of condition with constants (#105510)

This patch replaces all dominated uses of condition with true/false to
improve context-sensitive optimizations. It eliminates a bunch of
branches in llvm-opt-benchmark.

As a side effect, it may introduce new phi nodes in some corner cases.
See the following case:
```
define i1 @test(i1 %cmp, i1 %cond) {
entry:
br i1 %cond, label %bb1, label %bb2
bb1:
br i1 %cmp, label %if.then, label %if.else
if.then:
br %bb2
if.else:
br %bb2
bb2:
%res = phi i1 [%cmp, %entry], [%cmp, %if.then], [%cmp, %if.else]
ret i1 %res
}
```
It will be simplified into:
```
define i1 @test(i1 %cmp, i1 %cond) {
entry:
br i1 %cond, label %bb1, label %bb2
bb1:
br i1 %cmp, label %if.then, label %if.else
if.then:
br %bb2
if.else:
br %bb2
bb2:
%res = phi i1 [%cmp, %entry], [true, %if.then], [false, %if.else]
ret i1 %res
}
```

I am planning to fix this in late pipeline/CGP since this problem exists
before the patch.

show more ...


Revision tags: llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init
# 05670b42 02-Jul-2024 Nikita Popov <npopov@redhat.com>

[InstCombine] Remove root special case in demanded bits simplification

When calling SimplifyDemandedBits (as opposed to
SimplifyDemandedInstructionBits), and there are multiple uses,
always use Simp

[InstCombine] Remove root special case in demanded bits simplification

When calling SimplifyDemandedBits (as opposed to
SimplifyDemandedInstructionBits), and there are multiple uses,
always use SimplifyMultipleUseDemandedBits and drop the special
case for root values.

This fixes the ephemeral value detection, as seen by the restored
assumes in tests. It may result in more or less simplification,
depending on whether we get more out of having demanded bits or
the ability to perform non-multi-use transforms. The change in
the phi-known-bits.ll test is because the icmp operand now gets
simplified based on demanded bits, which then prevents a different
known bits simplification later.

This also makes the code safe against future changes like
https://github.com/llvm/llvm-project/pull/97289, which add more
context that would have to be discarded for the multi-use case.

show more ...


# 86b37944 02-Jul-2024 Nikita Popov <npopov@redhat.com>

Reapply [InstCombine] Fix context for multi-use demanded bits simplification

Repplied with a clang test fix.

-----

When simplifying a multi-use root value, the demanded bits were
reset to full, bu

Reapply [InstCombine] Fix context for multi-use demanded bits simplification

Repplied with a clang test fix.

-----

When simplifying a multi-use root value, the demanded bits were
reset to full, but we also need to reset the context instruction.
To make this convenient (without requiring by-value passing of
SimplifyQuery), move the logic that handles constants and
dispatches to SimplifyDemandedUseBits/SimplifyMultipleUseDemandedBits
into SimplifyDemandedBits. The SimplifyDemandedInstructionBits
caller starts with full demanded bits and an appropriate context
anyway.

The different context instruction does mean that the ephemeral
value protection no longer triggers in some cases, as the changes
to assume tests show.

An alternative, which I will explore in a followup, is to always
use SimplifyMultipleUseDemandedBits() -- the previous root special
case is only really intended for SimplifyDemandedInstructionBits(),
which now no longer shares this code path.

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

show more ...


# 167c860b 02-Jul-2024 Nikita Popov <npopov@redhat.com>

Revert "[InstCombine] Fix context for multi-use demanded bits simplification"

This reverts commit b558ac0eef57a3737b1e27844115fa91e0b32582.

This breaks a clang test, reverting for now.


# b558ac0e 02-Jul-2024 Nikita Popov <npopov@redhat.com>

[InstCombine] Fix context for multi-use demanded bits simplification

When simplifying a multi-use root value, the demanded bits were
reset to full, but we also need to reset the context extract. To

[InstCombine] Fix context for multi-use demanded bits simplification

When simplifying a multi-use root value, the demanded bits were
reset to full, but we also need to reset the context extract. To
make this convenient (without requiring by-value passing of
SimplifyQuery), move the logic that that handles constants and
dispatches to SimplifyDemandedUseBits/SimplifyMultipleUseDemandedBits
into SimplifyDemandedBits. The SimplifyDemandedInstructionBits
caller starts with full demanded bits and an appropriate context
anyway.

The different context instruction does mean that the ephemeral
value protection no longer triggers in some cases, as the changes
to assume tests show.

An alternative, which I will explore in a followup, is to always
use SimplifyMultipleUseDemandedBits() -- the previous root special
case is only really intended for SimplifyDemandedInstructionBits(),
which now no longer shares this code path.

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

show more ...


Revision tags: llvmorg-18.1.8
# 09457270 14-Jun-2024 Stephen Tozer <stephen.tozer@sony.com>

[RemoveDIs] Print IR with debug records by default (#91724)

This patch makes the final major change of the RemoveDIs project, changing the
default IR output from debug intrinsics to debug records.

[RemoveDIs] Print IR with debug records by default (#91724)

This patch makes the final major change of the RemoveDIs project, changing the
default IR output from debug intrinsics to debug records. This is expected to
break a large number of tests: every single one that tests for uses or
declarations of debug intrinsics and does not explicitly disable writing
records.

If this patch has broken your downstream tests (or upstream tests on a
configuration I wasn't able to run):
1. If you need to immediately unblock a build, pass
`--write-experimental-debuginfo=false` to LLVM's option processing for all
failing tests (remember to use `-mllvm` for clang/flang to forward arguments to
LLVM).
2. For most test failures, the changes are trivial and mechanical, enough that
they can be done by script; see the migration guide for a guide on how to do
this: https://llvm.org/docs/RemoveDIsDebugInfo.html#test-updates
3. If any tests fail for reasons other than FileCheck check lines that need
updating, such as assertion failures, that is most likely a real bug with this
patch and should be reported as such.

For more information, see the recent PSA:
https://discourse.llvm.org/t/psa-ir-output-changing-from-debug-intrinsics-to-debug-records/79578

show more ...


Revision tags: llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2
# 01d8e1ca 17-Mar-2024 Noah Goldstein <goldstein.w.n@gmail.com>

[ValueTracking] Handle non-canonical operand order in `isImpliedCondICmps`

We don't always have canonical order here, so do it manually.

Closes #85575


Revision tags: 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
# 90ba3309 24-Jan-2024 Nikita Popov <npopov@redhat.com>

[InstCombine] Canonicalize constant GEPs to i8 source element type (#68882)

This patch canonicalizes getelementptr instructions with constant
indices to use the `i8` source element type. This makes

[InstCombine] Canonicalize constant GEPs to i8 source element type (#68882)

This patch canonicalizes getelementptr instructions with constant
indices to use the `i8` source element type. This makes it easier for
optimizations to recognize that two GEPs are identical, because they
don't need to see past many different ways to express the same offset.

This is a first step towards
https://discourse.llvm.org/t/rfc-replacing-getelementptr-with-ptradd/68699.
This is limited to constant GEPs only for now, as they have a clear
canonical form, while we're not yet sure how exactly to deal with
variable indices.

The test llvm/test/Transforms/PhaseOrdering/switch_with_geps.ll gives
two representative examples of the kind of optimization improvement we
expect from this change. In the first test SimplifyCFG can now realize
that all switch branches are actually the same. In the second test it
can convert it into simple arithmetic. These are representative of
common optimization failures we see in Rust.

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

show more ...


Revision tags: llvmorg-19-init
# a5f34155 18-Dec-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Replace non-demanded undef vector with poison

If an operand (esp to shufflevector or insertelement) is not
demanded, canonicalize it from undef to poison.


Revision tags: llvmorg-17.0.6
# 28a5e6b0 27-Nov-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Remove over-generalization from computeKnownBitsFromCmp() (#72637)

For most practical purposes, the only KnownBits patterns we care about are
those involving a constant comparison RHS

[InstCombine] Remove over-generalization from computeKnownBitsFromCmp() (#72637)

For most practical purposes, the only KnownBits patterns we care about are
those involving a constant comparison RHS and constant mask. However,
the actual implementation is written in a very general way -- and of
course, with basically no test coverage of those generalizations.

This patch reduces the implementation to only handle cases with constant
operands. The test changes are all in "make sure we don't crash" tests.

The motivation for this change is an upcoming patch to handling dominating
conditions in computeKnownBits(). Handling non-constant RHS would add
significant additional compile-time overhead in that case, without any
significant impact on optimization quality.

show more ...


# f42482de 20-Nov-2023 Jeremy Morse <jeremy.morse@sony.com>

[DebugInfo][RemoveDIs] Don't convert debug-intrinsics to Unreachable (#72380)

It might seem obvious, but it's not a good idea to convert a
debug-intrinsic instruction into an UnreachableInst, as th

[DebugInfo][RemoveDIs] Don't convert debug-intrinsics to Unreachable (#72380)

It might seem obvious, but it's not a good idea to convert a
debug-intrinsic instruction into an UnreachableInst, as this means
things operate differently with and without the -g option. However this
can happen due to the "mutate the next instruction" API calls we make.
With RemoveDIs eliminating debug intrinsics, this behaviour is at risk
of changing, hence this patch ensures we only ever mutate the next _non_
debuginfo instruction into an Unreachable.

The tests instrumented with the --try... flag all exercise this, I've
added some metadata to a SCCP test to ensure it's exercised.

show more ...


Revision tags: llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2
# c00f49cf 21-Sep-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Remove instcombine-infinite-loop-threshold option

This option has been superseded by the fixpoint verification
functionality.


Revision tags: llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4
# 3e992d81 23-Aug-2023 Dhruv Chawla <44582521+dc03@users.noreply.github.com>

[InferAlignment] Enable InferAlignment pass by default

This gives an improvement of 0.6%:
https://llvm-compile-time-tracker.com/compare.php?from=7d35fe6d08e2b9b786e1c8454cd2391463832167&to=0456c8e8a

[InferAlignment] Enable InferAlignment pass by default

This gives an improvement of 0.6%:
https://llvm-compile-time-tracker.com/compare.php?from=7d35fe6d08e2b9b786e1c8454cd2391463832167&to=0456c8e8a42be06b62ad4c3e3cf34b21f2633d1e&stat=instructions:u

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

show more ...


Revision tags: llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init
# 2e0af16c 05-Jul-2023 Nikita Popov <npopov@redhat.com>

[ValueTracking] Support add+icmp assumes for KnownBits

Support the canonical range check pattern for KnownBits assumptions.
This is the same as the generic ConstantRange handling, just shifted
by an

[ValueTracking] Support add+icmp assumes for KnownBits

Support the canonical range check pattern for KnownBits assumptions.
This is the same as the generic ConstantRange handling, just shifted
by an offset.

show more ...


# bd6e5c0c 05-Jul-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Add tests for add+icmp assumes (NFC)


# 7b356769 22-Jun-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Fold assume(false) to non-terminator unreachable

assume(false) is immediate UB, so fold it to (non-terminator)
unreachable.


# 7fc0efd0 21-Jun-2023 luxufan <luxufan@iscas.ac.cn>

[InstCombine] Add !noundef to match behavior of violating assume

The behaviors of violating assume instruction or !nonnull metadata is
different. The former is immediate undefined behavior, but the

[InstCombine] Add !noundef to match behavior of violating assume

The behaviors of violating assume instruction or !nonnull metadata is
different. The former is immediate undefined behavior, but the latter is
returning poison value. This patch adds !noundef to trigger immediate
undefined behavior if !nonnull is violated.

Reviewed By: nikic

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

show more ...


Revision tags: llvmorg-16.0.6
# fa45fb7f 02-Jun-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Handle assumes in multi-use demanded bits simplification

This fixes the largest remaining discrepancy between results of
computeKnownBits() and SimplifyDemandedBits(). We only care abo

[InstCombine] Handle assumes in multi-use demanded bits simplification

This fixes the largest remaining discrepancy between results of
computeKnownBits() and SimplifyDemandedBits(). We only care about
the multi-use case here, because the assume necessarily introduces
an extra use.

show more ...


Revision tags: llvmorg-16.0.5
# f1106ef6 22-May-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Remove computeKnownBits() fold for returns

We try to fold constant computeKnownBits() with context for return
instructions only. Otherwise, we rely on SimplifyDemandedBits() to
fold in

[InstCombine] Remove computeKnownBits() fold for returns

We try to fold constant computeKnownBits() with context for return
instructions only. Otherwise, we rely on SimplifyDemandedBits() to
fold instructions with constant known bits.

The presence of this special fold for returns is dangerous, because
it makes our tests lie about what works and what doesn't. Tests are
usually written by returning the result we're interested in, but
will go through this separate code path that is not used for anything
else. This patch removes the special fold.

This primarily regresses patterns of the style "assume(x); return x".
The responsibility of handling such patterns lies with passes like
EarlyCSE/GVN anyway, which will do this reliably, and not just for
returns.

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

show more ...


# e99a79fb 26-May-2023 Nikita Popov <npopov@redhat.com>

[InstCombine] Add test for missing assume handling multi-use demanded bits (NFC)

Works if the assume is on a root value or an operation that does
not support multi-use demanded bits.


Revision tags: 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
# 211cf8a3 20-Oct-2022 Bjorn Pettersson <bjorn.a.pettersson@ericsson.com>

[test] Use -passes in more Transforms tests

Another step towards getting rid of dependencies to the legacy
pass manager.

Primary change here is to just do -passes=foo instead of -foo in
simple situ

[test] Use -passes in more Transforms tests

Another step towards getting rid of dependencies to the legacy
pass manager.

Primary change here is to just do -passes=foo instead of -foo in
simple situations (when running a single transform pass). But also
updated a few test running multiple passes.

Also removed some "duplicated" RUN lines in a few tests that where
using both -foo and -passes=foo syntax. No need to do the same kind
of testing twice.

show more ...


Revision tags: llvmorg-15.0.3, working, llvmorg-15.0.2
# 4ab40eca 03-Oct-2022 Bjorn Pettersson <bjorn.a.pettersson@ericsson.com>

[test][InstCombine] Update some test cases to use opaque pointers

These tests cases were converted using the script at
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34

Differential Re

[test][InstCombine] Update some test cases to use opaque pointers

These tests cases were converted using the script at
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34

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

show more ...


123