diff --git a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp index ebdf96b04ccfdaa5712d99144b2b48fbda4ba6fa..fe2474646cfc33f10f0cdac36a83530f405bb6e8 100644 --- a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp +++ b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp @@ -263,14 +263,18 @@ void AArch64Subtarget::initializeProperties() { break; case TSV110: CacheLineSize = 64; + PrefetchDistance = 940; PrefFunctionLogAlignment = 4; PrefLoopLogAlignment = 2; + MinPrefetchStride = 4; break; case HIP09: CacheLineSize = 64; + PrefetchDistance = 940; PrefFunctionLogAlignment = 4; PrefLoopLogAlignment = 2; VScaleForTuning = 2; + MinPrefetchStride = 4; break; case HIP12: CacheLineSize = 64; diff --git a/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp b/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp index dde7de406c585e47699a02f179cd7ff2d21d1763..f38de512a15337cf29eb8c54e4e1c72500f8aed3 100644 --- a/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp +++ b/llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp @@ -1479,6 +1479,10 @@ bool LoopDataPrefetch::run() { } bool MadeChange = false; + if (RandomAccessPrefetchOnly) { + OuterLoopPrefetch = true; + IndirectLoadPrefetch = true; + } for (Loop *I : *LI) for (Loop *L : depth_first(I)) @@ -1550,7 +1554,7 @@ bool LoopDataPrefetch::runOnLoop(Loop *L) { CodeMetrics InnerLoopMetrics; // Calculate the sub loop size when prefetching outer loops. SmallPtrSet InnerMostBBs; - if (!IsInnerMost) { + if (!IsInnerMost && !RandomAccessPrefetchOnly) { for (Loop *LL : L->getSubLoops()) { // Make sure all sub loops are inner most loop. if (!LL->isInnermost()) @@ -1591,7 +1595,7 @@ bool LoopDataPrefetch::runOnLoop(Loop *L) { LoopSize = 1; // Only prefetch small outer loops with small sub loops. - if (!IsInnerMost) + if (!IsInnerMost && !RandomAccessPrefetchOnly) if (LoopSize - InnerLoopMetrics.NumInsts > 128 || InnerLoopMetrics.NumInsts > 128) return MadeChange; diff --git a/llvm/test/Transforms/LoopDataPrefetch/AArch64/indirect-load-crc-outerloop.ll b/llvm/test/Transforms/LoopDataPrefetch/AArch64/indirect-load-crc-outerloop.ll index afde478f89e7f8512bffcc173f9ea50b57aa2940..7c7ddce91539c3c0583e962b17f0f178e8454883 100644 --- a/llvm/test/Transforms/LoopDataPrefetch/AArch64/indirect-load-crc-outerloop.ll +++ b/llvm/test/Transforms/LoopDataPrefetch/AArch64/indirect-load-crc-outerloop.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -mtriple=unknown -passes=loop-data-prefetch --indirect-load-prefetch=true --prefetch-distance=512 --outer-loop-prefetch=true --random-access-prefetch-only=true -disable-direct-prefetch -S | FileCheck %s +; RUN: opt < %s -mtriple=unknown -passes=loop-data-prefetch --prefetch-distance=512 --random-access-prefetch-only=true -disable-direct-prefetch -S | FileCheck %s target datalayout = "e-m:e-p:32:32-Fi8-i64:64:128-a:0:32-n32-S64" target triple = "armv8a-unknown-linux-gun" diff --git a/llvm/test/Transforms/LoopDataPrefetch/AArch64/indirect-load-prefetch_crc.ll b/llvm/test/Transforms/LoopDataPrefetch/AArch64/indirect-load-prefetch_crc.ll index b4d85c62e18fc23ea8ba5d4afcdff8fef5983288..a731b0b6322961baa719a4e96260f93035d98f66 100644 --- a/llvm/test/Transforms/LoopDataPrefetch/AArch64/indirect-load-prefetch_crc.ll +++ b/llvm/test/Transforms/LoopDataPrefetch/AArch64/indirect-load-prefetch_crc.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -mtriple=unknown -passes=loop-data-prefetch --indirect-load-prefetch=true --prefetch-distance=512 --outer-loop-prefetch=true --random-access-prefetch-only=true -disable-direct-prefetch -S | FileCheck %s +; RUN: opt < %s -mtriple=unknown -passes=loop-data-prefetch --prefetch-distance=512 --random-access-prefetch-only=true -disable-direct-prefetch -S | FileCheck %s target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" target triple = "aarch64-unknown-linux-gun"