[PATCH] D96294: [AArch64] Move machine bundle unpacking to PreEmit2 phase.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 12 08:30:05 PST 2021


fhahn updated this revision to Diff 323342.
fhahn added a comment.

In D96294#2557345 <https://reviews.llvm.org/D96294#2557345>, @SjoerdMeijer wrote:

> This minor reshuffle looks very reasonable to me, but I was wondering about this:
>
>> With the previous position, the machine outliner may outline parts of a bundle, which breaks them up.
>
> I am not that familiar with the instruction bundles, and the MIR langref description is a bit minimal, but was curious and wanted to ask if this is what the outliner should be doing, i.e. breaking up bundles?

Machine instruction bundles are sequences of instructions that should be kept together back-to-back. The problem is that the bundle expansion (which gets rid of the bundles) runs before the machine outliner, so the bundles are gone when the outliner runs and it can outline parts of the instructions in the bundle.

The only uses of bundles in the AArch64 backend is to keep SVE MOVPRFX instructions together with a 2nd instruction and the BLR_RVMARKER handling, which should expand to a call, followed by `mov x29, x29`. In both cases, the outliner should not outline only parts of the sequence.

I think in the MOVPRFX cases, it would be a mis-compile if the MOVPRRX instruction gets moved. And moving the marker instruction `mov x29, x29` prevents runtime optimizations. So I think for both use cases, running bundle expansion late is the right thing to do.

I updated the test to more directly check for that behavior. Without the patch, `mov x29, x29` (which gets added during BLR_RVMARKER expansion) gets outlined, which is not desirable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96294/new/

https://reviews.llvm.org/D96294

Files:
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/test/CodeGen/AArch64/O0-pipeline.ll
  llvm/test/CodeGen/AArch64/O3-pipeline.ll
  llvm/test/CodeGen/AArch64/arm64-opt-remarks-lazy-bfi.ll
  llvm/test/CodeGen/AArch64/rvmarker-pseudo-expansion-and-outlining.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96294.323342.patch
Type: text/x-patch
Size: 5056 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210212/66e2a4e4/attachment.bin>


More information about the llvm-commits mailing list