[PATCH] D30110: AArch64LoadStoreOptimizer: Correctly clear kill flags
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 17 15:26:43 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL295512: AArch64LoadStoreOptimizer: Correctly clear kill flags (authored by matze).
Changed prior to commit:
https://reviews.llvm.org/D30110?vs=88936&id=88972#toc
Repository:
rL LLVM
https://reviews.llvm.org/D30110
Files:
llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
llvm/trunk/test/CodeGen/AArch64/ldst-opt.mir
Index: llvm/trunk/test/CodeGen/AArch64/ldst-opt.mir
===================================================================
--- llvm/trunk/test/CodeGen/AArch64/ldst-opt.mir
+++ llvm/trunk/test/CodeGen/AArch64/ldst-opt.mir
@@ -1,10 +1,4 @@
# RUN: llc -mtriple=aarch64--linux-gnu -run-pass=aarch64-ldst-opt %s -verify-machineinstrs -o - 2>&1 | FileCheck %s
---- |
- define void @promote-load-from-store() { ret void }
- define void @store-pair() { ret void }
- define void @store-pair-clearkill0() { ret void }
- define void @store-pair-clearkill1() { ret void }
-...
---
name: promote-load-from-store
tracksRegLiveness: true
@@ -130,3 +124,23 @@
# CHECK-NOT: %w2 = COPY killed %w1
# CHECK: %w2 = COPY %w1
# CHECK: STPWi %w1, killed %w2, killed %x0, 0
+---
+name: store-load-clearkill
+tracksRegLiveness: true
+body: |
+ bb.0:
+ liveins: %w1
+
+ STRWui %w1, %sp, 0 :: (store 4)
+ %wzr = COPY killed %w1 ; killing use of %w1
+ %w11 = LDRWui %sp, 0 :: (load 4)
+ HINT 0, implicit %w11 ; some use of %w11
+...
+# When replaceing the load of a store-load pair with a copy the kill flags
+# along the way need to be cleared.
+# CHECK-LABEL: name: store-load-clearkill
+# CHECK: STRWui %w1, %sp, 0 :: (store 4)
+# CHECK-NOT: COPY killed %w1
+# CHECK: %wzr = COPY %w1
+# CHECK: %w11 = ORRWrs %wzr, %w1, 0
+# CHECK: HINT 0, implicit %w11
Index: llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
===================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
+++ llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
@@ -866,9 +866,11 @@
.addImm(Imms);
}
}
- StoreI->clearRegisterKills(StRt, TRI);
- (void)BitExtMI;
+ // Clear kill flags between store and load.
+ for (MachineInstr &MI : make_range(StoreI->getIterator(),
+ BitExtMI->getIterator()))
+ MI.clearRegisterKills(StRt, TRI);
DEBUG(dbgs() << "Promoting load by replacing :\n ");
DEBUG(StoreI->print(dbgs()));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30110.88972.patch
Type: text/x-patch
Size: 2045 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170217/52ec8994/attachment.bin>
More information about the llvm-commits
mailing list