History log of /llvm-project/llvm/lib/Transforms/Scalar/LoopFuse.cpp (Results 1 – 25 of 68)
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 ...


Revision tags: llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4
# 94f9cbbe 02-Nov-2024 Kazu Hirata <kazu@google.com>

[Scalar] Remove unused includes (NFC) (#114645)

Identified with misc-include-cleaner.


Revision tags: 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
# 5ce47a58 13-Aug-2024 Vitaly Buka <vitalybuka@google.com>

Reland "[Support] Assert that DomTree nodes share parent" (#102782)

A dominance query of a block that is in a different function is
ill-defined, so assert that getNode() is only called for blocks t

Reland "[Support] Assert that DomTree nodes share parent" (#102782)

A dominance query of a block that is in a different function is
ill-defined, so assert that getNode() is only called for blocks that are
in the same function.

There are three cases, where this behavior did occur. LoopFuse didn't
explicitly do this, but didn't invalidate the SCEV block dispositions,
leaving dangling pointers to free'ed basic blocks behind, causing
use-after-free. We do, however, want to be able to dereference basic
blocks inside the dominator tree, so that we can refer to them by a
number stored inside the basic block.

Reverts #102780
Reland #101198
Fixes #102784

Co-authored-by: Alexis Engelke <engelke@in.tum.de>

show more ...


# 3c3df1be 11-Aug-2024 Vitaly Buka <vitalybuka@google.com>

Revert "[Support] Assert that DomTree nodes share parent" (#102780)

Reverts llvm/llvm-project#101198

Breaks multiple bots:
https://lab.llvm.org/buildbot/#/builders/72/builds/2103
https://lab.ll

Revert "[Support] Assert that DomTree nodes share parent" (#102780)

Reverts llvm/llvm-project#101198

Breaks multiple bots:
https://lab.llvm.org/buildbot/#/builders/72/builds/2103
https://lab.llvm.org/buildbot/#/builders/164/builds/1909
https://lab.llvm.org/buildbot/#/builders/66/builds/2706

show more ...


# 8101d186 10-Aug-2024 Alexis Engelke <engelke@in.tum.de>

[Support] Assert that DomTree nodes share parent (#101198)

A dominance query of a block that is in a different function is
ill-defined, so assert that getNode() is only called for blocks that are

[Support] Assert that DomTree nodes share parent (#101198)

A dominance query of a block that is in a different function is
ill-defined, so assert that getNode() is only called for blocks that are
in the same function.

There are two cases, where this behavior did occur. LoopFuse didn't
explicitly do this, but didn't invalidate the SCEV block dispositions,
leaving dangling pointers to free'ed basic blocks behind, causing
use-after-free. We do, however, want to be able to dereference basic
blocks inside the dominator tree, so that we can refer to them by a
number stored inside the basic block.

show more ...


Revision tags: llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init
# 7d33d472 30-Jun-2024 Nuno Lopes <nuno.lopes@tecnico.ulisboa.pt>

[LoopFuse] Use poison instead of undef as placeholder for phi entry of unreachable predecessor [NFC]


# 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 ...


Revision tags: 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
# 6942c64e 11-Sep-2023 Jeremy Morse <jeremy.morse@sony.com>

[NFC][RemoveDIs] Prefer iterator-insertion over instructions

Continuing the patch series to get rid of debug intrinsics [0], instruction
insertion needs to be done with iterators rather than instruc

[NFC][RemoveDIs] Prefer iterator-insertion over instructions

Continuing the patch series to get rid of debug intrinsics [0], instruction
insertion needs to be done with iterators rather than instruction pointers,
so that we can communicate information in the iterator class. This patch
adds an iterator-taking insertBefore method and converts various call sites
to take iterators. These are all sites where such debug-info needs to be
preserved so that a stage2 clang can be built identically; it's likely that
many more will need to be changed in the future.

At this stage, this is just changing the spelling of a few operations,
which will eventually become signifiant once the debug-info bearing
iterator is used.

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

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

show more ...


Revision tags: llvmorg-17.0.0-rc4
# 111fcb0d 02-Sep-2023 Fangrui Song <i@maskray.me>

[llvm] Fix duplicate word typos. NFC

Those fixes were taken from https://reviews.llvm.org/D137338


Revision tags: 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
# a20f7efb 15-Apr-2023 Bjorn Pettersson <bjorn.a.pettersson@ericsson.com>

Remove several no longer needed includes. NFCI

Mostly removing includes of InitializePasses.h and Pass.h in
passes that no longer has support for the legacy PM.


Revision tags: llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3
# c1eb3db7 15-Feb-2023 Fangrui Song <i@maskray.me>

[LoopFuse] Remove legacy pass

Following recent changes to remove non-core legacy passes.


Revision tags: llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init
# b53e0d1b 14-Jan-2023 Kazu Hirata <kazu@google.com>

Use std::nullopt instead of None in comments (NFC)


Revision tags: llvmorg-15.0.7
# 7f15907a 12-Jan-2023 Ramkrishnan Narayanan Komala <ramkrishnan.nk@huawei.com>

[LoopFusion] Sorting of undominated FusionCandidates crashes

This patch tries to fix [[ https://github.com/llvm/llvm-project/issues/56263 | issue ]].

If two **FusionCandidates** are in same level o

[LoopFusion] Sorting of undominated FusionCandidates crashes

This patch tries to fix [[ https://github.com/llvm/llvm-project/issues/56263 | issue ]].

If two **FusionCandidates** are in same level of dominator tree then, they will not be dominates each other. But they are control flow equivalent. To sort those FusionCandidates **nonStrictlyPostDominate** check is needed.

Reviewed By: Narutoworld

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

show more ...


# aca7441c 03-Jan-2023 luxufan <luxufan@iscas.ac.cn>

[LoopFusion] Exit early if one of fusion candidate has guarded branch but the another has not

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

Reviewed By: nikic

Differential Revision: htt

[LoopFusion] Exit early if one of fusion candidate has guarded branch but the another has not

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

Reviewed By: nikic

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

show more ...


Revision tags: llvmorg-15.0.6
# 05b060b0 17-Nov-2022 Anna Thomas <anna@azul.com>

[LoopPeel] Expose ValueMap of last peeled iteration. NFC

The value map of last peeled iteration is computed within peelLoop API.
This patch exposes it for callers of peelLoop.
While this is not curr

[LoopPeel] Expose ValueMap of last peeled iteration. NFC

The value map of last peeled iteration is computed within peelLoop API.
This patch exposes it for callers of peelLoop.
While this is not currently used by upstream passes, we have a usecase
downstream which benefits from this API update. Future users of peelLoop
can also use the ValueMap if needed.

Similar value maps are exposed by other loop utilities such as loop
cloning.

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

show more ...


# 04d65299 16-Dec-2022 Nikita Popov <npopov@redhat.com>

[SCEV] Return ArrayRef for SCEV operands() (NFC)

Use a consistent type for the operands() methods of different SCEV
types. Also make the API consistent by only providing operands(),
rather than also

[SCEV] Return ArrayRef for SCEV operands() (NFC)

Use a consistent type for the operands() methods of different SCEV
types. Also make the API consistent by only providing operands(),
rather than also providin op_begin() and op_end() for some of them.

show more ...


# 50043205 13-Dec-2022 Joshua Cao <cao.joshua@yahoo.com>

[LoopFusion] sink second loop PHIs

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

PHI nodes that are in the second loop only have the first loop as its
predecessor. These PHI nodes should

[LoopFusion] sink second loop PHIs

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

PHI nodes that are in the second loop only have the first loop as its
predecessor. These PHI nodes should be sunk to the end of the fused
loop. If the second loop uses the PHI, then the loops cannot be fused.

I don't think this should happen in typical compilation workflows.
The PHI will be in a dedicated exit block of the first loop following
LCSSA transformations.

Reviewed By: aeubanks

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

show more ...


# 31521563 13-Dec-2022 Fangrui Song <i@maskray.me>

[Transforms/Scalar] llvm::Optional => std::optional


# 343de685 03-Dec-2022 Kazu Hirata <kazu@google.com>

[Transforms] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount

[Transforms] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated. The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

show more ...


Revision tags: llvmorg-15.0.5
# ec210f39 11-Nov-2022 Mengxuan Cai <mengxuan.cai@huawei.com>

[LoopFuse] Ensure inner loops are in loop simplified form under new PM

LoopInfo doesn't give all loops in a loop nest, it gives top level loops
only. While isLoopSimplifyForm() only checkes for the

[LoopFuse] Ensure inner loops are in loop simplified form under new PM

LoopInfo doesn't give all loops in a loop nest, it gives top level loops
only. While isLoopSimplifyForm() only checkes for the outter most loop of a
loop nest. As a result, inner loops that are not in simplied form can
not be simplified with the original code.

Reviewed By: aeubanks

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

show more ...


Revision tags: llvmorg-15.0.4
# eda3c934 31-Oct-2022 Mengxuan Cai <mengxuan.cai@huawei.com>

[LoopFuse] Ensure loops are in loop simplified form under new PM

Loop Fusion (Function Pass) requires loops in simplified form. With
legacy-pm, loop-simplify pass is added as a dependency for loop-f

[LoopFuse] Ensure loops are in loop simplified form under new PM

Loop Fusion (Function Pass) requires loops in simplified form. With
legacy-pm, loop-simplify pass is added as a dependency for loop-fusion.
But the new pass manager does not always ensure this format. This patch
tries to invoke simplifyLoop() on loops that are not in simplified form
only for new PM.

Reviewed By: aeubanks

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

show more ...


Revision tags: llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1
# 21a9abc1 19-Sep-2022 Max Kazantsev <mkazantsev@azul.com>

[LoopFuse] Drop loop dispositions before reassigning blocks to other loop

This bug was found by recent improvement in SCEV verifier. The code in LoopFuse
directly reassigns blocks to be a part of a

[LoopFuse] Drop loop dispositions before reassigning blocks to other loop

This bug was found by recent improvement in SCEV verifier. The code in LoopFuse
directly reassigns blocks to be a part of a different loop, which should automatically
invalidate all related cached loop dispositions.

Differential Revision: https://reviews.llvm.org/D134173
Reviewed By: nikic

show more ...


# ae05b9dc 07-Sep-2022 Aaron Kogon <aaron.kogon@intel.com>

Sink/hoist memory instructions between loop fusion candidates

Currently, instructions in the preheader of the second of two fusion
candidates are sunk and hoisted whenever possible, to try to allow

Sink/hoist memory instructions between loop fusion candidates

Currently, instructions in the preheader of the second of two fusion
candidates are sunk and hoisted whenever possible, to try to allow the
loops to fuse. Memory instructions are skipped, and are never sunk or
hoisted. This change adds memory instructions for sinking/hoisting
consideration.

This change uses DependenceAnalysis to check if a mem inst in the
preheader of FC1 depends on an instruction in FC0's header, across
which it will be hoisted, or FC1's header, across which it will be
sunk. We reject cases where the dependency is a data hazard.

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

show more ...


Revision tags: llvmorg-15.0.0, llvmorg-15.0.0-rc3
# 258531b7 21-Aug-2022 Kazu Hirata <kazu@google.com>

Remove redundant initialization of Optional (NFC)


# 6b1bc801 21-Aug-2022 Kazu Hirata <kazu@google.com>

[Scalar] Qualify auto in range-based for loops (NFC)

Identified with readability-qualified-auto.


123