[PATCH] D44446: [AArch64] Keep track of MIFlags in the LoadStoreOptimizer

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 13 14:48:15 PDT 2018


thegameg updated this revision to Diff 138267.
thegameg marked an inline comment as done.

https://reviews.llvm.org/D44446

Files:
  lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
  test/CodeGen/AArch64/ldst-miflags.mir


Index: test/CodeGen/AArch64/ldst-miflags.mir
===================================================================
--- /dev/null
+++ test/CodeGen/AArch64/ldst-miflags.mir
@@ -0,0 +1,28 @@
+# RUN: llc -run-pass=aarch64-ldst-opt -o - -mtriple=aarch64-- %s | FileCheck %s
+#
+---
+name:            foo
+# CHECK-LABEL: name: foo
+body:             |
+  bb.0:
+    $x26, $x25 = frame-setup LDPXi $sp, 0
+    $sp = frame-destroy ADDXri $sp, 64, 0
+
+  ; Check that we merge the MIFlags from both the instructions in the final
+  ; instruction.
+  ; CHECK: = frame-setup frame-destroy LDPXpost
+    RET_ReallyLR
+
+...
+---
+name:            bar
+# CHECK-LABEL: name: bar
+body:             |
+  bb.0:
+    $x26 = frame-setup LDRXui $sp, 0
+    $sp = frame-destroy ADDXri $sp, 64, 0
+
+  ; Check that we merge the MIFlags from both the instructions in the final
+  ; instruction.
+  ; CHECK: = frame-setup frame-destroy LDRXpost
+    RET_ReallyLR
Index: lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
===================================================================
--- lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
+++ lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
@@ -1352,7 +1352,8 @@
               .add(getLdStRegOp(*I))
               .add(getLdStBaseOp(*I))
               .addImm(Value)
-              .setMemRefs(I->memoperands_begin(), I->memoperands_end());
+              .setMemRefs(I->memoperands_begin(), I->memoperands_end())
+              .setMIFlags(I->getFlags() | Update->getFlags());
   } else {
     // Paired instruction.
     int Scale = getMemScale(*I);
@@ -1362,7 +1363,8 @@
               .add(getLdStRegOp(*I, 1))
               .add(getLdStBaseOp(*I))
               .addImm(Value / Scale)
-              .setMemRefs(I->memoperands_begin(), I->memoperands_end());
+              .setMemRefs(I->memoperands_begin(), I->memoperands_end())
+              .setMIFlags(I->getFlags() | Update->getFlags());
   }
   (void)MIB;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44446.138267.patch
Type: text/x-patch
Size: 1954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180313/14d3a232/attachment.bin>


More information about the llvm-commits mailing list