[llvm] [AArch64] Fix scheduling model issue #96394 (PR #97047)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 05:28:38 PDT 2024


https://github.com/david-arm created https://github.com/llvm/llvm-project/pull/97047

The NeoverseZeroMove predicate assumes that the first operand is always an immediate, which isn't always true. For example, it could be a stack offset, etc. This patch fixes that by checking if the operand is an immediate first.

>From a76a342cf670aeb3c726923f6efdc3ed1607572b Mon Sep 17 00:00:00 2001
From: David Sherwood <david.sherwood at arm.com>
Date: Fri, 28 Jun 2024 12:26:30 +0000
Subject: [PATCH] [AArch64] Fix scheduling model issue #96394

The NeoverseZeroMove predicate assumes that the first operand
is always an immediate, which isn't always true. For example,
it could be a stack offset, etc. This patch fixes that by
checking if the operand is an immediate first.
---
 llvm/lib/Target/AArch64/AArch64SchedPredNeoverse.td | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/AArch64/AArch64SchedPredNeoverse.td b/llvm/lib/Target/AArch64/AArch64SchedPredNeoverse.td
index 97abec10f7942..33b76a4f65f05 100644
--- a/llvm/lib/Target/AArch64/AArch64SchedPredNeoverse.td
+++ b/llvm/lib/Target/AArch64/AArch64SchedPredNeoverse.td
@@ -60,8 +60,9 @@ def NeoverseZeroMove : MCSchedPredicate<
                            // MOV Wd, #0
                            // MOV Xd, #0
                            CheckAll<[CheckOpcode<[MOVZWi, MOVZXi]>,
-                                     CheckAll<[CheckImmOperand<1, 0>,
-                                               CheckImmOperand<2, 0>]>]>,
+                                     CheckIsImmOperand<1>,
+                                     CheckImmOperand<1, 0>,
+                                     CheckImmOperand<2, 0>]>,
                            // MOV Wd, WZR
                            // MOV Xd, XZR
                            // MOV Wd, Wn



More information about the llvm-commits mailing list