[PATCH] D81108: [AArch64] Fix ldst-opt of multiple disjunct subregs.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 5 14:36:21 PDT 2020
fhahn updated this revision to Diff 268944.
fhahn added a comment.
Add note about relying on the structure of the AArch64 register file as suggested.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81108/new/
https://reviews.llvm.org/D81108
Files:
llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
llvm/test/CodeGen/AArch64/stp-opt-with-renaming-ld3.mir
Index: llvm/test/CodeGen/AArch64/stp-opt-with-renaming-ld3.mir
===================================================================
--- llvm/test/CodeGen/AArch64/stp-opt-with-renaming-ld3.mir
+++ llvm/test/CodeGen/AArch64/stp-opt-with-renaming-ld3.mir
@@ -1,5 +1,4 @@
-# XFAIL: *
-# RUN: llc -run-pass=aarch64-ldst-opt -mtriple=arm64-apple-iphoneos -aarch64-load-store-renaming=true -verify-machineinstrs -o - %s | FileCheck %s
+# RUN: llc -run-pass=aarch64-ldst-opt -mtriple=arm64-apple-iphoneos -aarch64-load-store-renaming=true -o - -verify-machineinstrs %s | FileCheck %s
--- |
define void @test_ld3(<8 x i8>* %a1) {
entry:
@@ -11,11 +10,12 @@
---
# CHECK-LABEL: name: test_ld3
# CHECK: bb.0.entry:
-# CHECK: renamable $x0, $d1_d2_d3 = LD3Threev8b_POST killed renamable $x0, $xzr
+# CHECK: renamable $x0, renamable $d0_d1_d2 = LD3Threev8b_POST killed renamable $x0, $xzr
# CHECK-NEXT: STPDi renamable $d0, renamable $d1, $fp, -6 :: (store 8)
+# CHECK-NEXT: STURDi renamable $d2, $fp, -32, implicit killed $d0_d1_d2 :: (store 8 into %ir.s1)
# CHECK-NEXT: renamable $d0_d1_d2 = LD3Threev8b killed renamable $x0 :: (load 24 from %ir.a1, align 32)
-# CHECK-NEXT: STPDi $d3, renamable $d0, $fp, -4 :: (store 8 into %ir.s1), (store 8)
-# CHECK-NEXT: STPDi renamable $d1, renamable $d2, $fp, -2 :: (store 8)
+# CHECK-NEXT: STPDi renamable $d0, renamable $d1, $fp, -3 :: (store 8)
+# CHECK-NEXT: STURDi renamable $d2, $fp, -8, implicit killed $d0_d1_d2 :: (store 8)
# CHECK-NEXT: RET undef $lr
#
name: test_ld3
Index: llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
+++ llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
@@ -1287,7 +1287,23 @@
LLVM_DEBUG(dbgs() << " Operand not killed at " << FirstMI << "\n");
return false;
}
- auto canRenameMOP = [](const MachineOperand &MOP) {
+ auto canRenameMOP = [TRI](const MachineOperand &MOP) {
+ if (MOP.isReg()) {
+ auto *RegClass = TRI->getMinimalPhysRegClass(MOP.getReg());
+ // Renaming registers with multiple disjunct sub-registers (e.g. the
+ // result of a LD3) means that all sub-registers are renamed, potentially
+ // impacting other instructions we did not check. Bail out.
+ // Note that this relies on the structure of the AArch64 register file. In
+ // particular, a subregister cannot be written without overwriting the
+ // whole register.
+ if (RegClass->HasDisjunctSubRegs) {
+ LLVM_DEBUG(
+ dbgs()
+ << " Cannot rename operands with multiple disjunct subregisters ("
+ << MOP << ")\n");
+ return false;
+ }
+ }
return MOP.isImplicit() ||
(MOP.isRenamable() && !MOP.isEarlyClobber() && !MOP.isTied());
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81108.268944.patch
Type: text/x-patch
Size: 2880 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200605/c0a4232b/attachment.bin>
More information about the llvm-commits
mailing list