History log of /llvm-project/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp (Results 1 – 25 of 223)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init
# 8e702735 24-Jan-2025 Jeremy Morse <jeremy.morse@sony.com>

[NFC][DebugInfo] Use iterator moveBefore at many call-sites (#123583)

As part of the "RemoveDIs" project, BasicBlock::iterator now carries a
debug-info bit that's needed when getFirstNonPHI and sim

[NFC][DebugInfo] Use iterator moveBefore at many call-sites (#123583)

As part of the "RemoveDIs" project, BasicBlock::iterator now carries a
debug-info bit that's needed when getFirstNonPHI and similar feed into
instruction insertion positions. Call-sites where that's necessary were
updated a year ago; but to ensure some type safety however, we'd like to
have all calls to moveBefore use iterators.

This patch adds a (guaranteed dereferenceable) iterator-taking
moveBefore, and changes a bunch of call-sites where it's obviously safe
to change to use it by just calling getIterator() on an instruction
pointer. A follow-up patch will contain less-obviously-safe changes.

We'll eventually deprecate and remove the instruction-pointer
insertBefore, but not before adding concise documentation of what
considerations are needed (very few).

show more ...


# 7fb97bee 23-Jan-2025 Stephen Senran Zhang <zsrkmyn@gmail.com>

[ConstraintElimination] Add eq/ne facts to signed constraint system (#121423)

Facts of eq/ne were added to unsigned system only, causing some missing
optimizations. This patch adds eq/ne facts to b

[ConstraintElimination] Add eq/ne facts to signed constraint system (#121423)

Facts of eq/ne were added to unsigned system only, causing some missing
optimizations. This patch adds eq/ne facts to both signed & unsigned
constraint system.

Fixes #117961.

show more ...


Revision tags: llvmorg-19.1.7
# 2a90efd8 01-Jan-2025 Stephen Senran Zhang <zsrkmyn@gmail.com>

[NFC][ConstraintElimination] Optimize code styles (#121422)

This patch does following things,

- prefer early exits;
- add missing std::move;
- avoid duplicate map lookups;
- prefer emplace_bac

[NFC][ConstraintElimination] Optimize code styles (#121422)

This patch does following things,

- prefer early exits;
- add missing std::move;
- avoid duplicate map lookups;
- prefer emplace_back to avoid unnecessary copies.

show more ...


Revision tags: llvmorg-19.1.6
# 003fb2ae 16-Dec-2024 Yingwei Zheng <dtcxzyw2333@gmail.com>

[ConstraintElim] Decompose `sub nsw` (#118219)

Closes https://github.com/llvm/llvm-project/issues/118211.


# a22578d3 15-Dec-2024 Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com>

ConstraintElim: teach fact-transfer about samesign (#115893)

When the samesign flag is present on an icmp, we can transfer all the
facts on the unsigned system to the signed system, and vice-versa:

ConstraintElim: teach fact-transfer about samesign (#115893)

When the samesign flag is present on an icmp, we can transfer all the
facts on the unsigned system to the signed system, and vice-versa: we do
this by specializing transferToOtherSystem when samesign is present.

show more ...


# 4a0d53a0 13-Dec-2024 Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com>

PatternMatch: migrate to CmpPredicate (#118534)

With the introduction of CmpPredicate in 51a895a (IR: introduce struct
with CmpInst::Predicate and samesign), PatternMatch is one of the first
key p

PatternMatch: migrate to CmpPredicate (#118534)

With the introduction of CmpPredicate in 51a895a (IR: introduce struct
with CmpInst::Predicate and samesign), PatternMatch is one of the first
key pieces of infrastructure that must be updated to match a CmpInst
respecting samesign information. Implement this change to Cmp-matchers.

This is a preparatory step in migrating the codebase over to
CmpPredicate. Since we no functional changes are desired at this stage,
we have chosen not to migrate CmpPredicate::operator==(CmpPredicate)
calls to use CmpPredicate::getMatching(), as that would have visible
impact on tests that are not yet written: instead, we call
CmpPredicate::operator==(Predicate), preserving the old behavior, while
also inserting a few FIXME comments for follow-ups.

show more ...


# 5fa59edf 06-Dec-2024 Yingwei Zheng <dtcxzyw2333@gmail.com>

[ConstraintElim] Add support for `trunc nsw/nuw` (#118745)

Proof for `trunc nsw nneg X -> trunc nuw X`:
https://alive2.llvm.org/ce/z/ooP6Mt


# a608607f 04-Dec-2024 Nikita Popov <npopov@redhat.com>

[ConstraintElim] Add support for decomposing gep nuw (#118639)

ConstraintElimination currently only supports decomposing gep nusw with
non-negative indices (with "non-negative" possibly being enfor

[ConstraintElim] Add support for decomposing gep nuw (#118639)

ConstraintElimination currently only supports decomposing gep nusw with
non-negative indices (with "non-negative" possibly being enforced via
pre-condition).

Add support for gep nuw, which directly gives us the necessary
guarantees for the decomposition.

show more ...


# 10223c72 03-Dec-2024 Nikita Popov <npopov@redhat.com>

[ConstraintElim] Use nusw flag for GEP decomposition

Check for nusw instead of inbounds when decomposing GEPs.

In this particular case, we can also look through multiple nusw
flags, because we will

[ConstraintElim] Use nusw flag for GEP decomposition

Check for nusw instead of inbounds when decomposing GEPs.

In this particular case, we can also look through multiple nusw
flags, because we will ultimately be working in the unsigned
constraint system.

show more ...


Revision tags: llvmorg-19.1.5
# 0f0c0c36 27-Nov-2024 Yingwei Zheng <dtcxzyw2333@gmail.com>

[ConstraintElim] Extend `checkOrAndOpImpliedByOther` to handle and/or expr trees. (#117123)

This patch extends `checkOrAndOpImpliedByOther` to handle and/or trees.
Limitation: At least one of the o

[ConstraintElim] Extend `checkOrAndOpImpliedByOther` to handle and/or expr trees. (#117123)

This patch extends `checkOrAndOpImpliedByOther` to handle and/or trees.
Limitation: At least one of the operands of root and/or instruction
should be an icmp. That is, this patch doesn't support expressions like
`(cmp1 & cmp2) & (cmp3 & cmp4)`.

Closes https://github.com/llvm/llvm-project/issues/117107.
Compile-time impact:
http://llvm-compile-time-tracker.com/compare.php?from=69cc3f096ccbdef526bbd5a065a25c95122e87ee&to=919416d2c4c71e3b9fe533af2c168a36c7893be5&stat=instructions%3Au

show more ...


# 2b5214b9 20-Nov-2024 Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com>

IR: de-duplicate two CmpInst routines (NFC) (#116866)

De-duplicate the functions getSignedPredicate and getUnsignedPredicate,
nearly identical versions of which were present in CmpInst and ICmpInst

IR: de-duplicate two CmpInst routines (NFC) (#116866)

De-duplicate the functions getSignedPredicate and getUnsignedPredicate,
nearly identical versions of which were present in CmpInst and ICmpInst,
creating less confusion.

show more ...


Revision tags: llvmorg-19.1.4
# 52361d03 18-Nov-2024 Yingwei Zheng <dtcxzyw2333@gmail.com>

[ConstraintElim] Bail out on non-dedicated exits when adding exiting conditions (#116627)

This patch bails out non-dedicated exits to avoid adding exiting
conditions to invalid context.
Closes htt

[ConstraintElim] Bail out on non-dedicated exits when adding exiting conditions (#116627)

This patch bails out non-dedicated exits to avoid adding exiting
conditions to invalid context.
Closes https://github.com/llvm/llvm-project/issues/116553.

show more ...


# 856c47b8 13-Nov-2024 Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com>

ConstraintElim: assert on invalid union field (NFC) (#115898)

getContextInst currently returns an invalid union field, when it is
called with a ConditionFact, although existing callers don't do thi

ConstraintElim: assert on invalid union field (NFC) (#115898)

getContextInst currently returns an invalid union field, when it is
called with a ConditionFact, although existing callers don't do this. In
order to error out early and serve as documentation for future callers,
add an assert forbidding the behavior.

show more ...


Revision tags: llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1
# 96f37ae4 30-Sep-2024 Jeremy Morse <jeremy.morse@sony.com>

[NFC] Use initial-stack-allocations for more data structures (#110544)

This replaces some of the most frequent offenders of using a DenseMap that
cause a malloc, where the typical element-count is

[NFC] Use initial-stack-allocations for more data structures (#110544)

This replaces some of the most frequent offenders of using a DenseMap that
cause a malloc, where the typical element-count is small enough to fit in
an initial stack allocation.

Most of these are fairly obvious, one to highlight is the collectOffset
method of GEP instructions: if there's a GEP, of course it's going to have
at least one offset, but every time we've called collectOffset we end up
calling malloc as well for the DenseMap in the MapVector.

show more ...


# d31e3141 20-Sep-2024 Youngsuk Kim <youngsuk.kim@hpe.com>

[llvm] Don't call raw_string_ostream::flush() (NFC)

Don't call raw_string_ostream::flush(), which is essentially a no-op.
As specified in the docs, raw_string_ostream is always unbuffered.
( 65b1361

[llvm] Don't call raw_string_ostream::flush() (NFC)

Don't call raw_string_ostream::flush(), which is essentially a no-op.
As specified in the docs, raw_string_ostream is always unbuffered.
( 65b13610a5226b84889b923bae884ba395ad084d for further reference )

show more ...


Revision tags: llvmorg-19.1.0, llvmorg-19.1.0-rc4
# 85b6aac7 23-Aug-2024 Yingwei Zheng <dtcxzyw2333@gmail.com>

[ConstraintElim] Fix miscompilation caused by PR97974 (#105790)

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


Revision tags: llvmorg-19.1.0-rc3
# 73d835cc 12-Aug-2024 Nikita Popov <npopov@redhat.com>

[ConstraintElimination] Use getAllOnesValue()

Split out from https://github.com/llvm/llvm-project/pull/80309.


Revision tags: llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init
# d18ca43e 10-Jul-2024 Poseydon42 <vvmposeydon@gmail.com>

[ConstraintElimination] Add support for UCMP/SCMP intrinsics (#97974)

This adds checks to fold calls to `ucmp`/`scmp` where a comparative
relationship between the arguments can be established.


# 5b927130 09-Jul-2024 Florian Hahn <flo@fhahn.com>

[ConstraintElim] Use cond from header as upper bound on IV in exit BB. (#94610)

For loops, we can use the condition in the loop header as upper bound on
the compared induction in the unique exit bl

[ConstraintElim] Use cond from header as upper bound on IV in exit BB. (#94610)

For loops, we can use the condition in the loop header as upper bound on
the compared induction in the unique exit block, if it exists. This can
be done even if there are multiple in-loop edges to the unique exit
block, as any other exit may only exit earlier.

More generally, we could add the OR of all exit conditions to the exit,
but that's a possible future extension.

PR: https://github.com/llvm/llvm-project/pull/94610

show more ...


# 74deadf1 29-Jun-2024 Nikita Popov <llvm@npopov.com>

[IRBuilder] Don't include Module.h (NFC) (#97159)

This used to be necessary to fetch the DataLayout, but isn't anymore.


# 9df71d76 28-Jun-2024 Nikita Popov <npopov@redhat.com>

[IR] Add getDataLayout() helpers to Function and GlobalValue (#96919)

Similar to https://github.com/llvm/llvm-project/pull/96902, this adds
`getDataLayout()` helpers to Function and GlobalValue, re

[IR] Add getDataLayout() helpers to Function and GlobalValue (#96919)

Similar to https://github.com/llvm/llvm-project/pull/96902, this adds
`getDataLayout()` helpers to Function and GlobalValue, replacing the
current `getParent()->getDataLayout()` pattern.

show more ...


# d75f9dd1 24-Jun-2024 Stephen Tozer <stephen.tozer@sony.com>

Revert "[IR][NFC] Update IRBuilder to use InsertPosition (#96497)"

Reverts the above commit, as it updates a common header function and
did not update all callsites:

https://lab.llvm.org/buildbot

Revert "[IR][NFC] Update IRBuilder to use InsertPosition (#96497)"

Reverts the above commit, as it updates a common header function and
did not update all callsites:

https://lab.llvm.org/buildbot/#/builders/29/builds/382

This reverts commit 6481dc57612671ebe77fe9c34214fba94e1b3b27.

show more ...


# 6481dc57 24-Jun-2024 Stephen Tozer <stephen.tozer@sony.com>

[IR][NFC] Update IRBuilder to use InsertPosition (#96497)

Uses the new InsertPosition class (added in #94226) to simplify some of
the IRBuilder interface, and removes the need to pass a BasicBlock

[IR][NFC] Update IRBuilder to use InsertPosition (#96497)

Uses the new InsertPosition class (added in #94226) to simplify some of
the IRBuilder interface, and removes the need to pass a BasicBlock
alongside a BasicBlock::iterator, using the fact that we can now get the
parent basic block from the iterator even if it points to the sentinel.
This patch removes the BasicBlock argument from each constructor or call
to setInsertPoint.

This has no functional effect, but later on as we look to remove the
`Instruction *InsertBefore` argument from instruction-creation
(discussed
[here](https://discourse.llvm.org/t/psa-instruction-constructors-changing-to-iterator-only-insertion/77845)),
this will simplify the process by allowing us to deprecate the
InsertPosition constructor directly and catch all the cases where we use
instructions rather than iterators.

show more ...


Revision tags: llvmorg-18.1.8, llvmorg-18.1.7
# ba0e871d 22-May-2024 Florian Hahn <flo@fhahn.com>

[ConstraintElim] Look through SExt with precond Op sge 0.

Look through SExt with a precondition that the operand is signed
positive.

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


Revision tags: llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1
# 8a5d51b0 28-Feb-2024 Florian Hahn <flo@fhahn.com>

[ConstraintElim] Use default depth for most calls of isNonNegative.

Helps to improve resuls in some cases, while being overall neutral with
respect to compile-time,
https://llvm-compile-time-tracker

[ConstraintElim] Use default depth for most calls of isNonNegative.

Helps to improve resuls in some cases, while being overall neutral with
respect to compile-time,
https://llvm-compile-time-tracker.com/compare.php?from=2c9b6c1b36b8185299de083c3058e0c1e7760442&to=5984b1649dc12741308089de235647cf036df95f&stat=instructions:u

show more ...


123456789