[PATCH] D127294: [AARCH64 folding] Do not fold any copy with NZCV
Serguei Katkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 20 20:39:18 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG163c77b2e083: [AARCH64 folding] Do not fold any copy with NZCV (authored by skatkov).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127294/new/
https://reviews.llvm.org/D127294
Files:
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
llvm/test/CodeGen/AArch64/spill-fold.mir
Index: llvm/test/CodeGen/AArch64/spill-fold.mir
===================================================================
--- llvm/test/CodeGen/AArch64/spill-fold.mir
+++ llvm/test/CodeGen/AArch64/spill-fold.mir
@@ -5,6 +5,7 @@
define i64 @test_subreg_spill_fold3() { ret i64 0 }
define i64 @test_subreg_fill_fold() { ret i64 0 }
define double @test_subreg_fill_fold2() { ret double 0.0 }
+ define i64 @test_nzcv_spill_fold() { ret i64 0 }
...
---
# CHECK-LABEL: name: test_subreg_spill_fold
@@ -80,3 +81,18 @@
$d0 = COPY %1
RET_ReallyLR implicit $d0
...
+---
+# CHECK-LABEL: name: test_nzcv_spill_fold
+# Ensure that nzcv COPY cannot be folded.
+name: test_nzcv_spill_fold
+registers:
+ - { id: 0, class: gpr64 }
+body: |
+ bb.0:
+ ; CHECK: %1:gpr64 = COPY $nzcv
+ ; CHECK: STRXui %1, %stack.0, 0 :: (store (s64) into %stack.0)
+ %0 = COPY $nzcv
+ INLINEASM &nop, 1, 12, implicit-def dead $x0, 12, implicit-def dead $x1, 12, implicit-def dead $x2, 12, implicit-def dead $x3, 12, implicit-def dead $x4, 12, implicit-def dead $x5, 12, implicit-def dead $x6, 12, implicit-def dead $x7, 12, implicit-def dead $x8, 12, implicit-def dead $x9, 12, implicit-def dead $x10, 12, implicit-def dead $x11, 12, implicit-def dead $x12, 12, implicit-def dead $x13, 12, implicit-def dead $x14, 12, implicit-def dead $x15, 12, implicit-def dead $x16, 12, implicit-def dead $x17, 12, implicit-def dead $x18, 12, implicit-def dead $x19, 12, implicit-def dead $x20, 12, implicit-def dead $x21, 12, implicit-def dead $x22, 12, implicit-def dead $x23, 12, implicit-def dead $x24, 12, implicit-def dead $x25, 12, implicit-def dead $x26, 12, implicit-def dead $x27, 12, implicit-def dead $x28, 12, implicit-def dead $fp, 12, implicit-def dead $lr, 12, implicit-def $sp
+ $x0 = COPY %0
+ RET_ReallyLR implicit $x0
+...
Index: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -4437,6 +4437,9 @@
MF.getRegInfo().constrainRegClass(SrcReg, &AArch64::GPR64RegClass);
return nullptr;
}
+ // Nothing can folded with copy from/to NZCV.
+ if (SrcReg == AArch64::NZCV || DstReg == AArch64::NZCV)
+ return nullptr;
}
// Handle the case where a copy is being spilled or filled but the source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127294.438538.patch
Type: text/x-patch
Size: 2419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220621/5dcf983f/attachment.bin>
More information about the llvm-commits
mailing list