[PATCH] D140170: [LoopDataPrefetch] Add LoopSimplify as prerequisite for new PM
YangguangLi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 16 14:26:01 PST 2022
Yangguang updated this revision to Diff 483672.
Yangguang added a comment.
Fixed clang format check failure
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140170/new/
https://reviews.llvm.org/D140170
Files:
llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp
llvm/test/Transforms/LoopDataPrefetch/AArch64/pr43784.ll
Index: llvm/test/Transforms/LoopDataPrefetch/AArch64/pr43784.ll
===================================================================
--- llvm/test/Transforms/LoopDataPrefetch/AArch64/pr43784.ll
+++ llvm/test/Transforms/LoopDataPrefetch/AArch64/pr43784.ll
@@ -1,4 +1,4 @@
-; RUN: opt -mcpu=kryo -passes=loop-simplify,loop-data-prefetch -max-prefetch-iters-ahead=1000 -min-prefetch-stride=16 -S < %s | FileCheck %s
+; RUN: opt -mcpu=kryo -passes=loop-data-prefetch -max-prefetch-iters-ahead=1000 -min-prefetch-stride=16 -S < %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-gnu"
Index: llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp
+++ llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp
@@ -29,6 +29,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils.h"
+#include "llvm/Transforms/Utils/LoopSimplify.h"
#include "llvm/Transforms/Utils/ScalarEvolutionExpander.h"
#define DEBUG_TYPE "loop-data-prefetch"
@@ -179,8 +180,17 @@
&AM.getResult<OptimizationRemarkEmitterAnalysis>(F);
const TargetTransformInfo *TTI = &AM.getResult<TargetIRAnalysis>(F);
+ // Ensure loops are in simplifed form which is a pre-requisite for loop data
+ // prefetch pass. Added only for new PM since the legacy PM has already added
+ // LoopSimplify pass as a dependency.
+ bool Changed = false;
+ for (auto &L : *LI) {
+ Changed |=
+ simplifyLoop(L, DT, LI, SE, AC, nullptr, false /* PreserveLCSSA */);
+ }
+
LoopDataPrefetch LDP(AC, DT, LI, SE, TTI, ORE);
- bool Changed = LDP.run();
+ Changed |= LDP.run();
if (Changed) {
PreservedAnalyses PA;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140170.483672.patch
Type: text/x-patch
Size: 1825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221216/e313bf81/attachment.bin>
More information about the llvm-commits
mailing list