Skip to content

Commit b5ef737

Browse files
committed
Merging r314252:
------------------------------------------------------------------------ r314252 | gberry | 2017-09-26 14:40:46 -0700 (Tue, 26 Sep 2017) | 12 lines [AArch64][Falkor] Fix bug in falkor prefetcher fix pass. Summary: In rare cases, loads that don't get prefetched that were marked as strided loads could cause a crash if they occurred in a loop with other colliding loads. Reviewers: mcrosier Subscribers: aemerson, rengolin, javed.absar, kristof.beyls Differential Revision: https://reviews.llvm.org/D38261 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@314555 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 50ee711 commit b5ef737

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

lib/Target/AArch64/AArch64FalkorHWPFFix.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -690,9 +690,14 @@ void FalkorHWPFFix::runOnLoop(MachineLoop &L, MachineFunction &Fn) {
690690
if (!TII->isStridedAccess(MI))
691691
continue;
692692

693-
LoadInfo LdI = *getLoadInfo(MI);
694-
unsigned OldTag = *getTag(TRI, MI, LdI);
695-
auto &OldCollisions = TagMap[OldTag];
693+
Optional<LoadInfo> OptLdI = getLoadInfo(MI);
694+
if (!OptLdI)
695+
continue;
696+
LoadInfo LdI = *OptLdI;
697+
Optional<unsigned> OptOldTag = getTag(TRI, MI, LdI);
698+
if (!OptOldTag)
699+
continue;
700+
auto &OldCollisions = TagMap[*OptOldTag];
696701
if (OldCollisions.size() <= 1)
697702
continue;
698703

test/CodeGen/AArch64/falkor-hwpf-fix.mir

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,28 @@ body: |
305305
bb.1:
306306
RET_ReallyLR
307307
...
308+
---
309+
# Check that we handle case of strided load with no HW prefetcher tag correctly.
310+
311+
# CHECK-LABEL: name: hwpf_notagbug
312+
# CHECK-NOT: ORRXrs %xzr
313+
# CHECK: LDARW %x1
314+
# CHECK-NOT: ORRXrs %xzr
315+
# CHECK: LDRWui %x1
316+
name: hwpf_notagbug
317+
tracksRegLiveness: true
318+
body: |
319+
bb.0:
320+
liveins: %w0, %x1, %x17
321+
322+
%w1 = LDARW %x1 :: ("aarch64-strided-access" load 4)
323+
%w1 = LDRWui %x1, 0 :: ("aarch64-strided-access" load 4)
324+
%w17 = LDRWui %x17, 0 :: ("aarch64-strided-access" load 4)
325+
326+
%w0 = SUBWri %w0, 1, 0
327+
%wzr = SUBSWri %w0, 0, 0, implicit-def %nzcv
328+
Bcc 9, %bb.0, implicit %nzcv
329+
330+
bb.1:
331+
RET_ReallyLR
332+
...

0 commit comments

Comments
 (0)