llvm.org GIT mirror llvm / eb6d6dd
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 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_40@295744 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 2 years ago
2 changed file(s) with 25 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
852852 .addImm(Imms);
853853 }
854854 }
855 StoreI->clearRegisterKills(StRt, TRI);
856
857 (void)BitExtMI;
855
856 // Clear kill flags between store and load.
857 for (MachineInstr &MI : make_range(StoreI->getIterator(),
858 BitExtMI->getIterator()))
859 MI.clearRegisterKills(StRt, TRI);
858860
859861 DEBUG(dbgs() << "Promoting load by replacing :\n ");
860862 DEBUG(StoreI->print(dbgs()));
0 # RUN: llc -mtriple=aarch64--linux-gnu -run-pass=aarch64-ldst-opt %s -verify-machineinstrs -o - 2>&1 | FileCheck %s
1 --- |
2 define void @promote-load-from-store() { ret void }
3 define void @store-pair() { ret void }
4 define void @store-pair-clearkill0() { ret void }
5 define void @store-pair-clearkill1() { ret void }
6 ...
71 ---
82 name: promote-load-from-store
93 tracksRegLiveness: true
129123 # CHECK-NOT: %w2 = COPY killed %w1
130124 # CHECK: %w2 = COPY %w1
131125 # CHECK: STPWi %w1, killed %w2, killed %x0, 0
126 ---
127 name: store-load-clearkill
128 tracksRegLiveness: true
129 body: |
130 bb.0:
131 liveins: %w1
132
133 STRWui %w1, %sp, 0 :: (store 4)
134 %wzr = COPY killed %w1 ; killing use of %w1
135 %w11 = LDRWui %sp, 0 :: (load 4)
136 HINT 0, implicit %w11 ; some use of %w11
137 ...
138 # When replaceing the load of a store-load pair with a copy the kill flags
139 # along the way need to be cleared.
140 # CHECK-LABEL: name: store-load-clearkill
141 # CHECK: STRWui %w1, %sp, 0 :: (store 4)
142 # CHECK-NOT: COPY killed %w1
143 # CHECK: %wzr = COPY %w1
144 # CHECK: %w11 = ORRWrs %wzr, %w1, 0
145 # CHECK: HINT 0, implicit %w11