[PATCH] D93100: [AArch64] Fix Copy Elemination for negative values

Tomas Matheson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 11 03:16:52 PST 2020


tmatheson updated this revision to Diff 311156.
tmatheson added a comment.

Remove whitespace


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93100

Files:
  llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp
  llvm/test/CodeGen/AArch64/machine-copy-remove.mir


Index: llvm/test/CodeGen/AArch64/machine-copy-remove.mir
===================================================================
--- llvm/test/CodeGen/AArch64/machine-copy-remove.mir
+++ llvm/test/CodeGen/AArch64/machine-copy-remove.mir
@@ -536,13 +536,13 @@
   bb.2:
     RET_ReallyLR
 ...
-# Eliminate redundant MOVi32imm -1 in bb.1
+# Don't eliminate redundant MOVi32imm -1 in bb.1: the upper bits are nonzero.
 # Note: 64-bit compare/32-bit move imm
 # Kill marker should be removed from compare.
 # CHECK-LABEL: name: test21
-# CHECK: ADDSXri $x0, 1, 0, implicit-def $nzcv
+# CHECK: ADDSXri killed $x0, 1, 0, implicit-def $nzcv
 # CHECK: bb.1:
-# CHECK-NOT: MOVi32imm
+# CHECK: MOVi32imm
 name:            test21
 tracksRegLiveness: true
 body:             |
Index: llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp
+++ llvm/lib/Target/AArch64/AArch64RedundantCopyElimination.cpp
@@ -408,6 +408,11 @@
                          O.getReg() != CmpReg;
                 }))
               continue;
+
+            // Don't remove a move immediate that implicitly defines the upper
+            // bits as different.
+            if (TRI->isSuperRegister(DefReg, KnownReg.Reg) && KnownReg.Imm < 0)
+              continue;
           }
 
           if (IsCopy)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93100.311156.patch
Type: text/x-patch
Size: 1399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201211/a9465449/attachment.bin>


More information about the llvm-commits mailing list