History log of /llvm-project/llvm/lib/Transforms/Scalar/GVNHoist.cpp (Results 1 – 25 of 126)
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, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6
# b42d245b 15-May-2024 AdityaK <hiraditya@msn.com>

[GVNHoist] Replace combineKnownMetadata with combineMetadataForCSE (#92197)

There is no reason to call combineMetadata directly with a list of MD_
nodes. The combineMetadataForCSE function handles

[GVNHoist] Replace combineKnownMetadata with combineMetadataForCSE (#92197)

There is no reason to call combineMetadata directly with a list of MD_
nodes. The combineMetadataForCSE function handles all the metadata
correctly

Partially fixes: #30866

show more ...


Revision tags: llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3
# 79ba323b 28-Mar-2024 Shan Huang <52285902006@stu.ecnu.edu.cn>

[Debuginfo][GVNHoist] Fix #86227: update the debug location of the hoisted GEP (#86236)

This PR fixes #86227.


Revision tags: 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, llvmorg-17.0.0-rc4, 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
# 1a90faac 13-Mar-2023 Arthur Eubanks <aeubanks@google.com>

[Passes] Remove some legacy passes

NewGVN
GVNHoist
GVNSink
MemCpyOpt
Float2Int

These were only used for the optimization pipeline, of which the legacy version was removed.


# b7a33893 13-Mar-2023 Nick Desaulniers <ndesaulniers@google.com>

[GVNHoist] add cast to unbreak windows build

Follow up to
commit 831e99fee90e ("[GVNHoist] don't hoist callbr users into the callbr's block")

Looks like MSVC has trouble with llvm::is_contained. Un

[GVNHoist] add cast to unbreak windows build

Follow up to
commit 831e99fee90e ("[GVNHoist] don't hoist callbr users into the callbr's block")

Looks like MSVC has trouble with llvm::is_contained. Unbreak the build.

Link: https://lab.llvm.org/buildbot/#/builders/127/builds/45021/steps/7/logs/stdio

Reviewed By: hans, kuhar

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

show more ...


# 831e99fe 13-Mar-2023 Nick Desaulniers <ndesaulniers@google.com>

[GVNHoist] don't hoist callbr users into the callbr's block

This isn't safe to do.

Link: https://github.com/llvm/llvm-project/issues/53562
Fixes: https://github.com/llvm/llvm-project/issues/61023

[GVNHoist] don't hoist callbr users into the callbr's block

This isn't safe to do.

Link: https://github.com/llvm/llvm-project/issues/53562
Fixes: https://github.com/llvm/llvm-project/issues/61023

Reviewed By: efriedma, nikic

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

show more ...


Revision tags: 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, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3
# 6b1bc801 21-Aug-2022 Kazu Hirata <kazu@google.com>

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

Identified with readability-qualified-auto.


# 50724716 14-Aug-2022 Kazu Hirata <kazu@google.com>

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

Identified with readability-qualified-auto.


Revision tags: llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1
# 368681f8 30-Mar-2022 Aditya Kumar <1894981+hiraditya@users.noreply.github.com>

[GVNHoist] drop debug location according to the debug info guide

According to the LLVM debug info update guide: https://llvm.org/docs/HowToUpdateDebugInfo.html,
"Hoisting identical instructions whic

[GVNHoist] drop debug location according to the debug info guide

According to the LLVM debug info update guide: https://llvm.org/docs/HowToUpdateDebugInfo.html,
"Hoisting identical instructions which appear in several successor
blocks into a predecessor block. In this case there is no single
merged instruction. The rule for dropping locations applies".

Thanks to Yuanbo Li for reporting this.

Reviewed By: dblaikie

Reviewers: sebpop, tejohnson, dblaikie

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

show more ...


# c28ce745 30-Mar-2022 Chang-Sun Lin Jr <chang-sun.lin.jr@intel.com>

Value-number GVNHoist loads by result type as well as pointer address.

Avoids merge errors when opaque pointers are loaded into different types.

Reviewed by: jcranmer-intel, hiraditya
Differential

Value-number GVNHoist loads by result type as well as pointer address.

Avoids merge errors when opaque pointers are loaded into different types.

Reviewed by: jcranmer-intel, hiraditya
Differential Revision: https://reviews.llvm.org/D122521

show more ...


Revision tags: llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3
# f96428e1 09-Mar-2022 Nikita Popov <npopov@redhat.com>

[MemorySSA] Don't optimize uses during construction

This changes MemorySSA to be constructed in unoptimized form.
MemorySSA::ensureOptimizedUses() can be called to optimize all
uses (once). This sho

[MemorySSA] Don't optimize uses during construction

This changes MemorySSA to be constructed in unoptimized form.
MemorySSA::ensureOptimizedUses() can be called to optimize all
uses (once). This should be done by passes where having optimized
uses is beneficial, either because we're going to query all uses
anyway, or because we're doing def-use walks.

This should help reduce the compile-time impact of MemorySSA for
some use cases (the reason why I started looking into this is
D117926), which can avoid optimizing all uses upfront, and instead
only optimize those that are actually queried.

Actually, we have an existing use-case for this, which is EarlyCSE.
Disabling eager use optimization there gives a significant
compile-time improvement, because EarlyCSE will generally only query
clobbers for a subset of all uses (this change is not included in
this patch).

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

show more ...


# 59630917 02-Mar-2022 serge-sans-paille <sguelton@redhat.com>

Cleanup includes: Transform/Scalar

Estimated impact on preprocessor output line:
before: 1062981579
after: 1062494547

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cl

Cleanup includes: Transform/Scalar

Estimated impact on preprocessor output line:
before: 1062981579
after: 1062494547

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D120817

show more ...


Revision tags: llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1
# 1d8750c3 01-Nov-2021 Arthur Eubanks <aeubanks@google.com>

[NFC] Rename GVN -> GVNPass and SROA -> SROAPass

To be more consistent with other pass struct names.

There are still more passes that don't end with "Pass", but these are the important ones.

Revie

[NFC] Rename GVN -> GVNPass and SROA -> SROAPass

To be more consistent with other pass struct names.

There are still more passes that don't end with "Pass", but these are the important ones.

Reviewed By: asbirlea

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

show more ...


Revision tags: llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2
# b8e345b2 20-Aug-2021 Aditya Kumar <1894981+hiraditya@users.noreply.github.com>

PR46874: Reset stack after visiting a node

When the stack is not reset it keeps previously visited Basic Block
which results in bugs where an instruction is hoisted to a
predecessor where the instru

PR46874: Reset stack after visiting a node

When the stack is not reset it keeps previously visited Basic Block
which results in bugs where an instruction is hoisted to a
predecessor where the instruction was not fully anticipable.

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

show more ...


Revision tags: llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1
# 6b9524a0 06-May-2021 Arthur Eubanks <aeubanks@google.com>

[NewPM] Don't mark AA analyses as preserved

Currently all AA analyses marked as preserved are stateless, not taking
into account their dependent analyses. So there's no need to mark them
as preserve

[NewPM] Don't mark AA analyses as preserved

Currently all AA analyses marked as preserved are stateless, not taking
into account their dependent analyses. So there's no need to mark them
as preserved, they won't be invalidated unless their analyses are.

SCEVAAResults was the one exception to this, it was treated like a
typical analysis result. Make it like the others and don't invalidate
unless SCEV is invalidated.

Reviewed By: asbirlea

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

show more ...


Revision tags: llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1
# 675be651 01-Jan-2021 Bjorn Pettersson <bjorn.a.pettersson@ericsson.com>

Require chained analyses in BasicAA and AAResults to be transitive

This patch fixes a bug that could result in miscompiles (at least
in an OOT target). The problem could be seen by adding checks tha

Require chained analyses in BasicAA and AAResults to be transitive

This patch fixes a bug that could result in miscompiles (at least
in an OOT target). The problem could be seen by adding checks that
the DominatorTree used in BasicAliasAnalysis and ValueTracking was
valid (e.g. by adding DT->verify() call before every DT dereference
and then running all tests in test/CodeGen).

Problem was that the LegacyPassManager calculated "last user"
incorrectly for passes such as the DominatorTree when not telling
the pass manager that there was a transitive dependency between
the different analyses. And then it could happen that an incorrect
dominator tree was used when doing alias analysis (which was a pretty
serious bug as the alias analysis result could be invalid).

Fixes: https://bugs.llvm.org/show_bug.cgi?id=48709

Reviewed By: nikic

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

show more ...


# 4d92ab16 09-Jan-2021 Kazu Hirata <kazu@google.com>

[Transforms] Use llvm::find_if (NFC)


Revision tags: llvmorg-11.0.1, llvmorg-11.0.1-rc2
# 5ac37725 18-Dec-2020 Kazu Hirata <kazu@google.com>

[GVNHoist] Remove successorDominate (NFC)

The function was introduced on Aug 25, 2016 in commit
5f0d0e60d11b8d2e48aacf31a82762280f9a8712.

Its last use was removed on Sep 13, 2017 in commit
dfa8741c

[GVNHoist] Remove successorDominate (NFC)

The function was introduced on Aug 25, 2016 in commit
5f0d0e60d11b8d2e48aacf31a82762280f9a8712.

Its last use was removed on Sep 13, 2017 in commit
dfa8741c9693c344477c842a25ee0cb6a6f59fcd.

show more ...


# 92310454 17-Dec-2020 Barry Revzin <barry.revzin@gmail.com>

Make LLVM build in C++20 mode

Part of the <=> changes in C++20 make certain patterns of writing equality
operators ambiguous with themselves (sorry!).
This patch goes through and adjusts all the com

Make LLVM build in C++20 mode

Part of the <=> changes in C++20 make certain patterns of writing equality
operators ambiguous with themselves (sorry!).
This patch goes through and adjusts all the comparison operators such that
they should work in both C++17 and C++20 modes. It also makes two other small
C++20-specific changes (adding a constructor to a type that cases to be an
aggregate, and adding casts from u8 literals which no longer have type
const char*).

There were four categories of errors that this review fixes.
Here are canonical examples of them, ordered from most to least common:

// 1) Missing const
namespace missing_const {
struct A {
#ifndef FIXED
bool operator==(A const&);
#else
bool operator==(A const&) const;
#endif
};

bool a = A{} == A{}; // error
}

// 2) Type mismatch on CRTP
namespace crtp_mismatch {
template <typename Derived>
struct Base {
#ifndef FIXED
bool operator==(Derived const&) const;
#else
// in one case changed to taking Base const&
friend bool operator==(Derived const&, Derived const&);
#endif
};

struct D : Base<D> { };

bool b = D{} == D{}; // error
}

// 3) iterator/const_iterator with only mixed comparison
namespace iter_const_iter {
template <bool Const>
struct iterator {
using const_iterator = iterator<true>;

iterator();

template <bool B, std::enable_if_t<(Const && !B), int> = 0>
iterator(iterator<B> const&);

#ifndef FIXED
bool operator==(const_iterator const&) const;
#else
friend bool operator==(iterator const&, iterator const&);
#endif
};

bool c = iterator<false>{} == iterator<false>{} // error
|| iterator<false>{} == iterator<true>{}
|| iterator<true>{} == iterator<false>{}
|| iterator<true>{} == iterator<true>{};
}

// 4) Same-type comparison but only have mixed-type operator
namespace ambiguous_choice {
enum Color { Red };

struct C {
C();
C(Color);
operator Color() const;
bool operator==(Color) const;
friend bool operator==(C, C);
};

bool c = C{} == C{}; // error
bool d = C{} == Red;
}

Differential revision: https://reviews.llvm.org/D78938

show more ...


Revision tags: llvmorg-11.0.1-rc1
# 43c0e4f6 19-Nov-2020 Kazu Hirata <kazu@google.com>

[Transforms] Use llvm::is_contained (NFC)


Revision tags: llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2
# 370330f0 16-Aug-2020 Aditya Kumar <1894981+hiraditya@users.noreply.github.com>

NFC: [GVNHoist] Outline functions from the class

Reviewers: sebpop
Reviewed By: hiraditya

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


# cb6e6936 16-Aug-2020 Aditya Kumar <1894981+hiraditya@users.noreply.github.com>

NFC: [GVNHoist] Hoist loop invariant code and rename variables for readability

Reviewed By: fhahn

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


# 1a8c9cd1 13-Aug-2020 Aditya Kumar <1894981+hiraditya@users.noreply.github.com>

Fix PR45442: Bail out when MemorySSA information is not available

Reviewers: sebpop, uabelho, fhahn
Reviewed by: fhahn

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


123456