Age | Commit message (Collapse) | Author | Files | Lines |
|
coalescing SUBREG_TO_REG"
This reverts commit 69c4930aad9659ec6ab846c8e7124d6afe044b1e.
See if this sticks after a few more coalescer assertions are fixed.
|
|
If the rematerialize was placing a subregister into a super register,
and implicit operands referenced the original register, we need to add
undef flags to the now-subregister indexed implicit operands.
Depends #75152
|
|
If the copy being hoisted was undef, we have the same problems that
eliminateUndefCopy needs to solve. We would effectively be introducing a
new live out implicit_def. We need to add an undef flag to avoid
artificially introducing a live through undef value. Previously, the
verifier would fail due to the dead def inside the loop providing the
live in value for the %1 use.
|
|
coalescing SUBREG_TO_REG""
This reverts commit 1f283a60a4bb896fa2d37ce00a3018924be82b9f.
Reason: breaks MSan buildbot
(https://lab.llvm.org/buildbot/#/builders/74/builds/24077)
|
|
coalescing SUBREG_TO_REG"
This reverts commit 9e50c6e6b5741895f58f3e530004052844b6af9f. A few assertion and verifier
errors have been fixed in the coalescer and allocator, so hopefully this sticks this time.
|
|
If this was coalescing a SUBREG_TO_REG as a copy, the resulting
instruction would be an IMPLICIT_DEF with an unexpected 2 immediate
operands, which need to be dropped. Until recently the verifier did not
catch this error, and an assert would fire if later the broken
IMPLICIT_DEF was rematerialized P
#73758 is related, it changes the failure mode to a verifier error.
|
|
coalescing SUBREG_TO_REG""
This reverts commit ba385ae210b3659bc9dfb78ef1d280d03c2c3b5a.
Reason: Broke the MSan buildbot. See comments on
https://github.com/llvm/llvm-project/commit/ba385ae210b3659bc9dfb78ef1d280d03c2c3b5a
for more information.
|
|
Fix some expensive checks verifier errors on MIR tests.
|
|
coalescing SUBREG_TO_REG"
This reverts commit e0f86ca2004b2d87ffe3c1e8242650a29fa98a82.
This was hitting some assertions which have since been relaxed.
|
|
(#69088)
|
|
This ensures !isSSA checks in the function work if the input MIR
happened to appear as SSA.
|
|
coalescing SUBREG_TO_REG"
This reverts commit 414ff812d6241b728754ce562081419e7fc091eb.
|
|
error. NFCI.
|
|
SUBREG_TO_REG
Currently coalescing with SUBREG_TO_REG introduces an invisible load
bearing undef. There is liveness for the super register not
represented in the MIR.
This is part 1 of a fix for regressions that appeared after
b7836d856206ec39509d42529f958c920368166b. The allocator started
recognizing undef-def subregister MOVs as copies. Since there was no
representation for the dependency on the high bits, different undef
segments of the super register ended up disconnected and downstream
users ended up observing different undefs than they did previously.
This does not yet fix the regression. The isCopyInstr handling needs
to start handling implicit-defs on any instruction.
I wanted to include an end to end IR test since the actual failure
only appeared with an interaction between the coalescer and the
allocator. It's a bit bigger than I'd like but I'm having a bit of
trouble reducing it to something which definitely shows a diff that's
meaningful.
The same problem likely exists everywhere trying to do anything with
SUBREG_TO_REG. I don't understand how this managed to be broken for so
long.
This needs to be applied to the release branch.
https://reviews.llvm.org/D156345
|
|
/llvm-project/llvm/lib/CodeGen/RegisterCoalescer.cpp:1320:18: error: unused variable 'DefSubIdx' [-Werror,-Wunused-variable]
const unsigned DefSubIdx = DefMI->getOperand(0).getSubReg();
^
1 error generated.
|
|
If this was coalescing a def of a subregister with a def of the super
register, it was introducing a redundant super-register def and
marking the subregister def as dead.
Resulting in something like:
dead $eax = MOVr0, implicit-def $rax, implicit-def $rax
Avoid this by checking if the new instruction already has the super
def, so we end up with this instead:
dead $eax = MOVr0, implicit-def $rax
The dead flag looks suspicious to me, seems like it's easy to buggily
interpret dead def of subreg and a non-dead def of an aliasing
register. It seems to be intentional though.
https://reviews.llvm.org/D156343
|
|
Permit an implicit-def of a virtual register when rematerializing if
it defines a super register of a subregister def. The
rematerialization pre-legality check should really have been checking
the implicit operands, but that should be fixed separately.
https://reviews.llvm.org/D156331
|
|
Not sure how to produce a test that demonstrates the problem
today. The coalescer would have to introduce a verifier caught SSA
violation, like multiple defs of a virtual register. I'm not sure what
would do that now, but an upcoming patch will.
https://reviews.llvm.org/D156271
|
|
Live out implicit_defs need to be kept, but the check for this only
checked if the block parent was the same. This doesn't work if the
parent blocks are the same but the value is live. Fixes verifier error
"Instruction ending live segment doesn't read the register", which
would appear at the coalesced non-implicit_def def.
Fixes #38788
https://reviews.llvm.org/D158882
|
|
This fixes some verifier errors when live out implicit defs are
coalesced with identity copies. Fixes some reduced testcases from
issue #38788 but doesn't solve the original failure.
I was surprised this seems to obviate the special casing in
analyzeValue that's been there since the subregister liveness support
went in.
https://reviews.llvm.org/D158850
|
|
Don't understand why this would either be OK or necessary, but doesn't
appear to happen in any tests. This was introduced way back in
76e66c31a0481e72d1ff86c56028d850b6c33cff
https://reviews.llvm.org/D156265
|
|
In this example an implicit def had live-out undef subrange
defs. After coalescing with the def from a previous block, the
undef-defed lanes are no longer live out of the block in the new
interval. An empty subrange was tenatively created for these lanes,
but it must be deleted.
|
|
implicit_defs
A live out implicit_def wasn't deleted, but the subranges weren't
correctly updated. The main range was correct but the def
corresponding to the initial main range def instruction was missing
from the lanes redefined in another block.
The written lanes are not quite the same as the valid lanes in the
case of an implicit_def.
Fixes verifier error in blender. There is an additional verifier in
some of the testcase variants where an empty subrange remains.
|
|
I finally snapped and fixed this inconsistency.
|
|
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D152098
|
|
Differential Revision: https://reviews.llvm.org/D151424
|
|
This bumps the "large-interval-freq-threshold" limit in the register
coalescer to 256. The limit was introduced in
https://reviews.llvm.org/D59143 without much justify for the particular
value "100", so I hope bumping it is ok.
This change is motivated by bad codegen for the popular crc32c
algorithm; the code is often based/copied from this implementation:
https://github.com/htot/crc32c/blob/master/crc32c/crc32intelc.cc which
uses a duffs-device pattern with 128 switch-cases. There are examples in
RocksDB (https://github.com/facebook/rocksdb/blob/main/util/crc32c.cc)
and Folly
(https://github.com/facebook/folly/blob/main/folly/hash/detail/Crc32cDetail.cpp)
which are important use cases for us.
Differential Revision: https://reviews.llvm.org/D150994
|
|
Live intervals for physical registers are calculated lazily on demand.
In a case like this:
16B %0:gpr32 = IMPLICIT_DEF
32B $wzr = COPY %0
if the live interval for $wzr did not already exist then the update code
in joinReservedPhysReg would create it with a definition at 32B, which
would remain even after the COPY was deleted.
Differential Revision: https://reviews.llvm.org/D151314
|
|
Not sure what this was originally intended for, but this seems to be
unused. It didn't seem to be used when it was first added in D64630
either.
Reviewed By: jmorse
Differential Revision: https://reviews.llvm.org/D150606
|
|
Give up on erasing an IMPLICIT_DEF if it might be live-in to a call
instruction in a basic block with EH pad successors. This fixes a
liveness bug that will be diagnosed by MachineVerifer when D149947
lands.
Differential Revision: https://reviews.llvm.org/D149954
|
|
Use isPhysical/isVirtual methods.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D141715
|
|
Instructions might use definition register as its "undef" operand. It
happens on architectures with predicated executon:
```
%0:subreg = instruction op_1, ..., op_N, undef %0:subreg, op_N+2, ...
```
RegisterCoalescer should take into account all remat instruction
operands during destination subregister fixup.
```
; remat result before fix:
%1 = instruction op_1, ..., op_N, undef %1:subreg, op_N+2, ...
; remat result after fix (correct):
%1 = instruction op_1, ..., op_N, undef %1, op_N+2, ...
```
Differential Revision: https://reviews.llvm.org/D125657
|
|
This patch uses the API provided by LiveRangeEdit to handle rematerialization.
It will make future maintenance and improvement more easier.
No functional change.
Differential Revision: https://reviews.llvm.org/D133610
|
|
There's no real read of the register, so the copy introduced a new
live value. Make sure we introduce a replacement implicit_def instead
of just erasing the copy.
Found from llvm-reduce since it tries to set undef on everything.
|
|
The issue was with processing two subregs of the same reg are used in the same
instruction (e.g. inline asm): "def early-clobber" and other just "def".
Register coalescer ran in bad recursion if the early clobbered subreg is second
in the following sequence of COPYs.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D127136
|
|
funcion => function
|
|
With C++17 there is no Clang pedantic warning or MSVC C5051.
|
|
With C++17 there is no Clang pedantic warning.
|
|
If the subregister uses were dead, this would leave the main range
segment pointing to a deleted instruction.
Not sure if this should try to avoid shrinking if we know we don't
have dead components.
|
|
This was stored in LiveIntervals, but not actually used for anything
related to LiveIntervals. It was only used in one check for if a load
instruction is rematerializable. I also don't think this was entirely
correct, since it was implicitly assuming constant loads are also
dereferenceable.
Remove this and rely only on the invariant+dereferenceable flags in
the memory operand. Set the flag based on the AA query upfront. This
should have the same net benefit, but has the possible disadvantage of
making this AA query nonlazy.
Preserve the behavior of assuming pointsToConstantMemory implying
dereferenceable for now, but maybe this should be changed.
|
|
|
|
comments
|
|
|
|
|
|
|
|
|
|
for-range loop. NFCI.
Avoid unnecessary copies, reported by MSVC static analyzer.
|
|
Prior to this patch, it skipped the instruction defining VNI when checking if the tainted lanes are used.
In the given example, VRGATHER is an illegal instruction because its DstReg overlaps with SrcReg.
Therefore we need to check the defining instruction as well when there is an earlyclobber constraint.
Reviewed By: qcolombet
Differential Revision: https://reviews.llvm.org/D105684
|
|
The coalescer does not check if register uses are available
at the point of rematerialization. If it attempts to rematerialize
an instruction with such uses it can end up with use without a def.
LiveRangeEdit does such check during rematerialization, so just
call LiveRangeEdit::allUsesAvailableAt() to avoid the problem.
Differential Revision: https://reviews.llvm.org/D106396
|
|
Currently we are resolving lane/subregister conflict by visiting
instructions sequentially in current block to see whether there is any
use of the tainted lanes. To save compile time, we are not doing further
check in successor blocks. This sounds reasonable without subgregister liveness.
But since we have added subregister liveness tracking capability to
register coalescer, we can easily determine whether we have subregister
liveness conflict by checking subranges. This would help coalescing more
COPYs for target that enables subregister liveness tracking.
Reviewed by: arsenm, qcolombet
Differential Revision: https://reviews.llvm.org/D104509
|