Revision tags: llvmorg-21-init, llvmorg-19.1.7 |
|
#
bfa711a9 |
| 08-Jan-2025 |
Nikita Popov <npopov@redhat.com> |
[InstCombine] Use combineMetadataForCSE in phi of loads fold
Use combineMetadataForCSE instead of manually enumerating known metadata kinds. This is a typical sinking transform for which combineMeta
[InstCombine] Use combineMetadataForCSE in phi of loads fold
Use combineMetadataForCSE instead of manually enumerating known metadata kinds. This is a typical sinking transform for which combineMetadataForCSE is safe to use (with DoesKMove=true).
Part of https://github.com/llvm/llvm-project/issues/121495.
show more ...
|
#
3a423a10 |
| 02-Jan-2025 |
Teresa Johnson <tejohnson@google.com> |
[MemProf][PGO] Prevent dropping of profile metadata during optimization (#121359)
This patch fixes a couple of places where memprof-related metadata
(!memprof and !callsite) were being dropped, and
[MemProf][PGO] Prevent dropping of profile metadata during optimization (#121359)
This patch fixes a couple of places where memprof-related metadata
(!memprof and !callsite) were being dropped, and one place where PGO
metadata (!prof) was being dropped.
All were due to instances of combineMetadata() being invoked. That
function drops all metadata not in the list provided by the client, and
also drops any not in its switch statement.
Memprof metadata needed a case in the combineMetadata switch statement.
For now we simply keep the metadata of the instruction being kept, which
doesn't retain all the profile information when two calls with
memprof metadata are being combined, but at least retains some.
For the memprof metadata being dropped during call CSE, add memprof and
callsite metadata to the list of known ids in combineMetadataForCSE.
Neither memprof nor regular prof metadata were in the list of known ids
for the callsite in MemCpyOptimizer, which was added to combine AA
metadata after optimization of byval arguments fed by memcpy
instructions, and similar types of optimizations of memcpy uses.
There is one other callsite of combineMetadata, but it is only invoked
on load instructions, which do not carry these types of metadata.
show more ...
|
Revision tags: llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4 |
|
#
929cbe7f |
| 12-Nov-2024 |
Antonio Frighetto <me@antoniofrighetto.com> |
[InstCombine] Intersect nowrap flags between geps while folding into phi
A miscompilation issue has been addressed with refined checking.
Fixes: https://github.com/llvm/llvm-project/issues/115149.
|
Revision tags: llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1 |
|
#
94a98cf5 |
| 18-Sep-2024 |
Chengjun <chengjunp@Nvidia.com> |
[InstCombine] Remove dead phi web (#108876)
In current visitPHINode function during InstCombine, it can remove dead
phi cycles (all phis have one use, which is another phi). However, it
cannot dea
[InstCombine] Remove dead phi web (#108876)
In current visitPHINode function during InstCombine, it can remove dead
phi cycles (all phis have one use, which is another phi). However, it
cannot deal with the case when the phis form a web (all phis have one or
more uses, and all the uses are phi). This change extends the algorithm
so that it can also deal with the dead phi web.
show more ...
|
Revision tags: llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3 |
|
#
5b40a05d |
| 13-Aug-2024 |
Alexis Engelke <engelke@in.tum.de> |
[InstCombine] Don't look at ConstantData users
When looking at PHI operand for combining, only look at instructions and arguments. The loop later iteraters over Arg's users, which is not useful if A
[InstCombine] Don't look at ConstantData users
When looking at PHI operand for combining, only look at instructions and arguments. The loop later iteraters over Arg's users, which is not useful if Arg is a constant -- it's users are not meaningful and might be in different functions, which causes problems for the dominates() query.
Pull Request: https://github.com/llvm/llvm-project/pull/103302
show more ...
|
Revision tags: llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init |
|
#
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 ...
|
#
6efba061 |
| 19-Jun-2024 |
Nikita Popov <npopov@redhat.com> |
[InstCombine] Preserve all gep flags in dependent IV fold
|
#
6467b494 |
| 19-Jun-2024 |
Nikita Popov <npopov@redhat.com> |
[InstCombine] Preserve all flags in phi of gep fold
Preserve the intersection of all flags. Add GEPNoWrapFlags::all() to serve as the initialization value for the intersection.
|
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6 |
|
#
1650f1b3 |
| 15-May-2024 |
Jay Foad <jay.foad@amd.com> |
Fix typo "indicies" (#92232)
|
Revision tags: llvmorg-18.1.5, llvmorg-18.1.4 |
|
#
60de56c7 |
| 16-Apr-2024 |
Harald van Dijk <harald.vandijk@codeplay.com> |
[ValueTracking] Restore isKnownNonZero parameter order. (#88873)
Prior to #85863, the required parameters of llvm::isKnownNonZero were
Value and DataLayout. After, they are Value, Depth, and Simpli
[ValueTracking] Restore isKnownNonZero parameter order. (#88873)
Prior to #85863, the required parameters of llvm::isKnownNonZero were
Value and DataLayout. After, they are Value, Depth, and SimplifyQuery,
where SimplifyQuery is implicitly constructible from DataLayout. The
change to move Depth before SimplifyQuery needed callers to be updated
unnecessarily, and as commented in #85863, we actually want Depth to be
after SimplifyQuery anyway so that it can be defaulted and the caller
does not need to specify it.
show more ...
|
#
e0a62871 |
| 12-Apr-2024 |
Yingwei Zheng <dtcxzyw2333@gmail.com> |
[ValueTracking] Convert `isKnownNonZero` to use SimplifyQuery (#85863)
This patch converts `isKnownNonZero` to use SimplifyQuery. Then we can
use the context information from `DomCondCache`.
Fix
[ValueTracking] Convert `isKnownNonZero` to use SimplifyQuery (#85863)
This patch converts `isKnownNonZero` to use SimplifyQuery. Then we can
use the context information from `DomCondCache`.
Fixes https://github.com/llvm/llvm-project/issues/85823.
Alive2: https://alive2.llvm.org/ce/z/QUvHVj
show more ...
|
Revision tags: llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1 |
|
#
2fe81ede |
| 04-Mar-2024 |
Jeremy Morse <jeremy.morse@sony.com> |
[NFC][RemoveDIs] Insert instruction using iterators in Transforms/
As part of the RemoveDIs project we need LLVM to insert instructions using iterators wherever possible, so that the iterators can c
[NFC][RemoveDIs] Insert instruction using iterators in Transforms/
As part of the RemoveDIs project we need LLVM to insert instructions using iterators wherever possible, so that the iterators can carry a bit of debug-info. This commit implements some of that by updating the contents of llvm/lib/Transforms/Utils to always use iterator-versions of instruction constructors.
There are two general flavours of update: * Almost all call-sites just call getIterator on an instruction * Several make use of an existing iterator (scenarios where the code is actually significant for debug-info) The underlying logic is that any call to getFirstInsertionPt or similar APIs that identify the start of a block need to have that iterator passed directly to the insertion function, without being converted to a bare Instruction pointer along the way.
Noteworthy changes: * FindInsertedValue now takes an optional iterator rather than an instruction pointer, as we need to always insert with iterators, * I've added a few iterator-taking versions of some value-tracking and DomTree methods -- they just unwrap the iterator. These are purely convenience methods to avoid extra syntax in some passes. * A few calls to getNextNode become std::next instead (to keep in the theme of using iterators for positions), * SeparateConstOffsetFromGEP has it's insertion-position field changed. Noteworthy because it's not a purely localised spelling change.
All this should be NFC.
show more ...
|
Revision tags: llvmorg-18.1.0, llvmorg-18.1.0-rc4 |
|
#
7ce1a11f |
| 21-Feb-2024 |
Nikita Popov <npopov@redhat.com> |
[InstCombine] Fold dependent IVs (#81151)
Fold `iv = phi(start, iv.next = iv2.next + start)` where `iv2 =
phi(iv2.start, iv2.next = iv2 + iv2.step)`
to `iv = iv2 + start` removing one induction v
[InstCombine] Fold dependent IVs (#81151)
Fold `iv = phi(start, iv.next = iv2.next + start)` where `iv2 =
phi(iv2.start, iv2.next = iv2 + iv2.step)`
to `iv = iv2 + start` removing one induction variable from the loop.
Proof: https://alive2.llvm.org/ce/z/hfmwgf
Fixes https://github.com/llvm/llvm-project/issues/77108.
show more ...
|
Revision tags: llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init |
|
#
d8bc5465 |
| 30-Nov-2023 |
Nikita Popov <npopov@redhat.com> |
[InstCombine] Fix phi or icmp fold with disjoint flag
We're changing the operand of the or here, such that the disjoint flag may no longer hold. Clear it.
|
Revision tags: llvmorg-17.0.6, llvmorg-17.0.5 |
|
#
5d3d0846 |
| 07-Nov-2023 |
LiqinWeng <liqin.weng@spacemit.com> |
[InstCombinePHI] Remove dead PHI on UnaryOperator (#71386)
This patch mainly solves the problem of dead PHI on UnaryOperator
|
Revision tags: llvmorg-17.0.4 |
|
#
4a074f32 |
| 24-Oct-2023 |
bipmis <102525366+bipmis@users.noreply.github.com> |
[InstCombine] Extend Phi-Icmp use to include or (#67682)
In InstCombinePHI currently the only use of PHI as an Icmp is being
checked as a requirement to reduce a value if isKnownNonZero.
However t
[InstCombine] Extend Phi-Icmp use to include or (#67682)
In InstCombinePHI currently the only use of PHI as an Icmp is being
checked as a requirement to reduce a value if isKnownNonZero.
However this can be extended to include or(icmp) . This is always true
as OR only adds bits and we are checking against 0.
show more ...
|
Revision tags: llvmorg-17.0.3 |
|
#
186c9079 |
| 04-Oct-2023 |
David Green <david.green@arm.com> |
[InstCombine] Expand redundant phi cycle elimination (#67968)
There is a combine in instcombine that will look for phi cycles that only have
a single incoming value:
```
%0 = phi i64 [ %3, %exit
[InstCombine] Expand redundant phi cycle elimination (#67968)
There is a combine in instcombine that will look for phi cycles that only have
a single incoming value:
```
%0 = phi i64 [ %3, %exit ], [ %othervalue, %preheader ]
%3 = phi i64 [ %0, %body ], [ %othervalue, %body2 ]
```
This currently doesn't handle if %othervalue is a phi though, as the algorithm
will recurse into the phi and fail with multiple incoming values. This adjusts
the algorithm, not requiring the initial value to be found immediately,
allowing it to be set to the value of one of the phis that would otherwise fail
due to having multiple input values.
show more ...
|
Revision tags: llvmorg-17.0.2 |
|
#
6cd5eb1f |
| 28-Sep-2023 |
Nikita Popov <npopov@redhat.com> |
[InstCombine] Avoid some uses of ConstantExpr::getZExt() (NFC)
Add helpers getLosslessUnsignedTrunc/getLosslessSignedTrunc for this common pattern.
|
#
2fda200c |
| 26-Sep-2023 |
Nikita Popov <npopov@redhat.com> |
[InstCombine] Canonicalize phi order for newly inserted nodes
When new phi nodes are inserted at the start of the block, the order of these does not get canonicalized, as we pick the first phi node
[InstCombine] Canonicalize phi order for newly inserted nodes
When new phi nodes are inserted at the start of the block, the order of these does not get canonicalized, as we pick the first phi node to canonicalize towards (and the other phi nodes may have already been visited). This results in phi nodes not being deduplicated and thus a fix-point verification failure.
Fix this by remembering the predecessors of the first phi node we encounter -- this will usually result in the same order we picked previously. I also considered using predecessors() order instead, but that causes substantial test fallout. Additionally the predecessors() order tends to be the reverse of the "natural" order.
Fixes https://github.com/llvm/llvm-project/issues/46688.
show more ...
|
Revision tags: llvmorg-17.0.1, llvmorg-17.0.0 |
|
#
e54277fa |
| 11-Sep-2023 |
Jeremy Morse <jeremy.morse@sony.com> |
[NFC][RemoveDIs] Use iterators over inst-pointers when using IRBuilder
This patch adds a two-argument SetInsertPoint method to IRBuilder that takes a block/iterator instead of an instruction, and up
[NFC][RemoveDIs] Use iterators over inst-pointers when using IRBuilder
This patch adds a two-argument SetInsertPoint method to IRBuilder that takes a block/iterator instead of an instruction, and updates many call sites to use it. The motivating reason for doing this is given here [0], we'd like to pass around more information about the position of debug-info in the iterator object. That necessitates passing iterators around most of the time.
[0] https://discourse.llvm.org/t/rfc-instruction-api-changes-needed-to-eliminate-debug-intrinsics-from-ir/68939
Differential Revision: https://reviews.llvm.org/D152468
show more ...
|
#
d529943a |
| 11-Sep-2023 |
Jeremy Morse <jeremy.morse@sony.com> |
[NFC][RemoveDIs] Prefer iterators over inst-pointers in InstCombine
As per my proposal for how to eliminate debug intrinsics [0], for various places in InstCombine prefer to insert using an instruct
[NFC][RemoveDIs] Prefer iterators over inst-pointers in InstCombine
As per my proposal for how to eliminate debug intrinsics [0], for various places in InstCombine prefer to insert using an instruction iterator rather than an instruction pointer. This is so that we can eventually pass more information in the iterator class. These call-sites where I've changed the spelling are those that necessary to build a stage2clang to produce an identical binary in the coming no-debug-intrinsics mode.
[0] https://discourse.llvm.org/t/rfc-instruction-api-changes-needed-to-eliminate-debug-intrinsics-from-ir/68939
Differential Revision: https://reviews.llvm.org/D152543
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 |
|
#
cd888e6f |
| 01-Jun-2023 |
Nikita Popov <npopov@redhat.com> |
[InstCombine] Fix worklist management in foldPHIArgIntToPtrToPHI()
Make sure the old operand is added back to the worklist for DCE.
|
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 |
|
#
870e6b6e |
| 03-Mar-2023 |
Sanjay Patel <spatel@rotateright.com> |
[InstCombine] use dyn_cast instead of isa+cast; NFC
|
Revision tags: llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2 |
|
#
232698dc |
| 01-Feb-2023 |
luxufan <luxufan@iscas.ac.cn> |
[Local][InstCombine][GVN] Handle !noundef metadata in combineMetadata
Handle !noundef metadata in comhineMetadata. The behavior of violating !noundef metadata is undefined behavior. So if K dominate
[Local][InstCombine][GVN] Handle !noundef metadata in combineMetadata
Handle !noundef metadata in comhineMetadata. The behavior of violating !noundef metadata is undefined behavior. So if K dominates J, we can preserve it uncontionally, otherwise, we preserve it if both K and J have !noundef metadata been set.
This patch also makes !noundef metadata added in KnownIDs when doing instruction combine for phi node or global value numbering for loads.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D142801
show more ...
|