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

[NFC][DebugInfo] Use iterator-flavour getFirstNonPHI at many call-sites (#123737)

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

[NFC][DebugInfo] Use iterator-flavour getFirstNonPHI at many call-sites (#123737)

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 getFirstNonPHI use the iterator-returning version.

This patch changes a bunch of call-sites calling getFirstNonPHI to use
getFirstNonPHIIt, which returns an iterator. All these call sites are
where it's obviously safe to fetch the iterator then dereference it. A
follow-up patch will contain less-obviously-safe changes.

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

---------

Co-authored-by: Stephen Tozer <Melamoto@gmail.com>

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
# b9cb9b3f 20-Oct-2024 Kazu Hirata <kazu@google.com>

[GVNSink] Avoid repeated hash lookups (NFC) (#113023)


Revision tags: 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
# a487616c 27-May-2024 Shan Huang <52285902006@stu.ecnu.edu.cn>

[DebugInfo][GVNSink] Merging debug locations of sinked instructions (#92859)

Fix #85069 .


# f5211d79 20-May-2024 Shan Huang <52285902006@stu.ecnu.edu.cn>

[DebugInfo][GVNSink] Fix #77415: GVNSink fails to optimize LLVM IR with debug info (#77602)

This PR fixes issue #77415 and is revised from PR #77419 .

PR #77419 breaks the newly added test in the

[DebugInfo][GVNSink] Fix #77415: GVNSink fails to optimize LLVM IR with debug info (#77602)

This PR fixes issue #77415 and is revised from PR #77419 .

PR #77419 breaks the newly added test in the same PR on windows, because
GVNSink is non-deterministic when sorting `BasicBlock*` pointers. This
is reflected in the failure report.

```
# | C:\src\llvm-project\llvm\test\Transforms\GVNSink\sink-ignore-dbg-intrinsics.ll:28:10: error: CHECK: expected string not found in input
# | ; CHECK: %a.sink = phi i32 [ %a, %if.then ], [ %b, %if.else ]
# | ^
# | <stdin>:24:8: note: scanning from here
# | if.end: ; preds = %if.else, %if.then
# | ^
# | <stdin>:25:2: note: possible intended match here
# | %b.sink = phi i32 [ %b, %if.else ], [ %a, %if.then ]
# | ^
# |
# | Input file: <stdin>
# | Check file: C:\src\llvm-project\llvm\test\Transforms\GVNSink\sink-ignore-dbg-intrinsics.ll
```

According to the report, what the CheckFile wants to match is the
`%a.sink`, however there is `%b.sink`. But this mismatch does not mean
that this commit is wrong, since the occurrence of either `%a.sink` or
`%b.sink` is correct. The root cause of this test failure is the strict
check rule in the regression test committed.

So I refined the regression test with a more general check rule to only
detect whether there is an instruction with suffix `.sink` in the
`if.end` block. Hope this won't fail the test. If this PR still fails to
build, I will close this PR and try to find another right way to fix
this.

show more ...


Revision tags: llvmorg-18.1.6
# bf7a0f99 14-May-2024 AdityaK <hiraditya@msn.com>

Fix incorrect codegen with respect to GEPs #85333 (#92047)

As mentioned in #68882 and
https://discourse.llvm.org/t/rfc-replacing-getelementptr-with-ptradd/68699

Gep arithmetic isn't consistent w

Fix incorrect codegen with respect to GEPs #85333 (#92047)

As mentioned in #68882 and
https://discourse.llvm.org/t/rfc-replacing-getelementptr-with-ptradd/68699

Gep arithmetic isn't consistent with different types. GVNSink didn't
realize this and sank all geps as long as their operands can be wired
via PHIs
in a post-dominator.

Fixes: #85333
Reapply: #88440 after fixing the non-determinism issues in #90995

show more ...


# e6785fd7 13-May-2024 Kazu Hirata <kazu@google.com>

[Scalar] Fix a warning

This patch fixes:

llvm/lib/Transforms/Scalar/GVNSink.cpp:270:33: error: lambda capture
'this' is not used [-Werror,-Wunused-lambda-capture]

While I am at it, this patch

[Scalar] Fix a warning

This patch fixes:

llvm/lib/Transforms/Scalar/GVNSink.cpp:270:33: error: lambda capture
'this' is not used [-Werror,-Wunused-lambda-capture]

While I am at it, this patch replaces llvm::for_each with a
range-based for loop.

show more ...


# abe3c5ac 13-May-2024 AdityaK <hiraditya@msn.com>

[GVNSink] Fix non-determinisms by using a deterministic ordering (#90995)

GVNSink used to order instructions based on their pointer values and was
prone to non-determinism because of that.
This pa

[GVNSink] Fix non-determinisms by using a deterministic ordering (#90995)

GVNSink used to order instructions based on their pointer values and was
prone to non-determinism because of that.
This patch ensures all the values stored are using a deterministic
order. I have also added a verfier(`ModelledPHI::verifyModelledPHI`) to
assert when ordering isn't preserved.

Additionally, I have added a test case (mirror graph image of an
existing test) that would have failed before this patch.

Fixes: #77852

show more ...


Revision tags: llvmorg-18.1.5
# cf49d077 30-Apr-2024 AdityaK <hiraditya@msn.com>

Revert "[GVNSink] Fix incorrect codegen with respect to GEPs #85333" (#90658)

Reverts llvm/llvm-project#88440

Test failing on Windows:
https://lab.llvm.org/buildbot/#/builders/233/builds/9396
`

Revert "[GVNSink] Fix incorrect codegen with respect to GEPs #85333" (#90658)

Reverts llvm/llvm-project#88440

Test failing on Windows:
https://lab.llvm.org/buildbot/#/builders/233/builds/9396
```
Input file: <stdin>
# | Check file: C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\llvm-project\llvm\test\Transforms\GVNSink\different-gep-types.ll
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# | .
# | .
# | .
# | 42: br label %if.end6
# | 43:
# | 44: if.else5: ; preds = %if.else
# | 45: br label %if.end6
# | 46:
# | 47: if.end6: ; preds = %if.else5, %if.then3, %if.then
# | next:67'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# | next:67'1 with "IF_THEN" equal to "%if\\.then"
# | next:67'2 with "IF_THEN3" equal to "%if\\.then3"
# | next:67'3 with "IF_ELSE5" equal to "%if\\.else5"
# | 48: %.sink1 = phi i32 [ -8, %if.then3 ], [ -4, %if.else5 ], [ 8, %if.then ]
# | next:67'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | next:67'4 ? possible intended match
# | 49: %0 = load ptr, ptr %__i, align 4
# | next:67'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 50: %incdec.ptr4 = getelementptr inbounds i8, ptr %0, i32 %.sink1
# | next:67'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 51: store ptr %incdec.ptr4, ptr %__i, align 4
# | next:67'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 52: ret void
# | next:67'0 ~~~~~~~~~~
# | 53: }
# | next:67'0 ~~
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1
```

show more ...


# 1c979ab7 30-Apr-2024 AdityaK <hiraditya@msn.com>

[GVNSink] Fix incorrect codegen with respect to GEPs #85333 (#88440)

As mentioned in #68882 and
https://discourse.llvm.org/t/rfc-replacing-getelementptr-with-ptradd/68699

Gep arithmetic isn't co

[GVNSink] Fix incorrect codegen with respect to GEPs #85333 (#88440)

As mentioned in #68882 and
https://discourse.llvm.org/t/rfc-replacing-getelementptr-with-ptradd/68699

Gep arithmetic isn't consistent with different types. GVNSink didn't
realize this and sank all geps
as long as their operands can be wired via PHIs
in a post-dominator.

Fixes: #85333

show more ...


Revision tags: llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2
# fab2bb8b 11-Mar-2024 Justin Lebar <justin.lebar@gmail.com>

Add llvm::min/max_element and use it in llvm/ and mlir/ directories. (#84678)

For some reason this was missing from STLExtras.


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, llvmorg-19-init
# 064e73cd 09-Jan-2024 Nikita Popov <nikita.ppv@gmail.com>

Revert "[GVNSink] Skip debug intrinsics when identifying sinking candidates (#77419)"

This reverts commit 51bf0dff53fdaca25f30d30a1c99462c7afdce74.

There are test failures on Windows.


# 51bf0dff 09-Jan-2024 Shan Huang <52285902006@stu.ecnu.edu.cn>

[GVNSink] Skip debug intrinsics when identifying sinking candidates (#77419)

Fixes #77147.


Revision tags: 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, 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
# 8bdf3878 15-Mar-2023 Kazu Hirata <kazu@google.com>

Use *{Map,Set}::contains (NFC)

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


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


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
# 6eb0b0a0 15-Dec-2022 Kazu Hirata <kazu@google.com>

Don't include Optional.h

These files no longer use llvm::Optional.


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

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


# f7dffc28 10-Dec-2022 Kazu Hirata <kazu@google.com>

Don't include None.h (NFC)

I've converted all known uses of None to std::nullopt, so we no longer
need to include None.h.

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

Don't include None.h (NFC)

I've converted all known uses of None to std::nullopt, so we no longer
need to include None.h.

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


# 8a7cbea5 09-Dec-2022 Kazu Hirata <kazu@google.com>

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

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

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalu

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

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


# 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.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
# a33ef8f2 27-Aug-2022 Kazu Hirata <kazu@google.com>

Use llvm::all_equal (NFC)


Revision tags: llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2
# fffabd53 30-Jul-2022 Nuno Lopes <nuno.lopes@tecnico.ulisboa.pt>

[NFC] Switch a few uses of undef to poison as placeholders for unreachable code


Revision tags: llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5
# e0039b8d 05-Jun-2022 Kazu Hirata <kazu@google.com>

Use llvm::less_second (NFC)


123