[llvm-branch-commits] [llvm-branch] r295744 - Merging r295512:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Feb 21 10:46:57 PST 2017


Author: hans
Date: Tue Feb 21 12:46:57 2017
New Revision: 295744

URL: http://llvm.org/viewvc/llvm-project?rev=295744&view=rev
Log:
Merging r295512:
------------------------------------------------------------------------
r295512 | matze | 2017-02-17 15:15:03 -0800 (Fri, 17 Feb 2017) | 8 lines

AArch64LoadStoreOptimizer: Correctly clear kill flags

When promoting the Load of a Store-Load pair to a COPY all kill flags
between the store and the load need to be cleared.

rdar://30402435

Differential Revision: https://reviews.llvm.org/D30110
------------------------------------------------------------------------

Modified:
    llvm/branches/release_40/   (props changed)
    llvm/branches/release_40/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
    llvm/branches/release_40/test/CodeGen/AArch64/ldst-opt.mir

Propchange: llvm/branches/release_40/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb 21 12:46:57 2017
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,291858-291859,291863,291875,291909,291918,291966,291968,291979,292117,292133,292167,292169-292170,292242,292254-292255,292280,292323,292444,292467,292516,292583,292624-292625,292641,292651,292667,292711-292713,292758,292949,293017,293021,293025,293124,293230,293259,293291,293293,293309,293345,293417,293522,293542,293629,293635,293658,293673,293727,293730,294003,294102,294129,294203,294267,294318,294348-294349,294357,294527,294551,294982,295018,295213,295215,295230
+/llvm/trunk:155241,291858-291859,291863,291875,291909,291918,291966,291968,291979,292117,292133,292167,292169-292170,292242,292254-292255,292280,292323,292444,292467,292516,292583,292624-292625,292641,292651,292667,292711-292713,292758,292949,293017,293021,293025,293124,293230,293259,293291,293293,293309,293345,293417,293522,293542,293629,293635,293658,293673,293727,293730,294003,294102,294129,294203,294267,294318,294348-294349,294357,294527,294551,294982,295018,295213,295215,295230,295512

Modified: llvm/branches/release_40/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_40/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp?rev=295744&r1=295743&r2=295744&view=diff
==============================================================================
--- llvm/branches/release_40/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp (original)
+++ llvm/branches/release_40/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Tue Feb 21 12:46:57 2017
@@ -853,9 +853,11 @@ AArch64LoadStoreOpt::promoteLoadFromStor
               .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()));

Modified: llvm/branches/release_40/test/CodeGen/AArch64/ldst-opt.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_40/test/CodeGen/AArch64/ldst-opt.mir?rev=295744&r1=295743&r2=295744&view=diff
==============================================================================
--- llvm/branches/release_40/test/CodeGen/AArch64/ldst-opt.mir (original)
+++ llvm/branches/release_40/test/CodeGen/AArch64/ldst-opt.mir Tue Feb 21 12:46:57 2017
@@ -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 @@ body: |
 # 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




More information about the llvm-branch-commits mailing list