[PATCH] D91525: [LoopLoadElim] Make sure all loops are in simplify form. PR48150
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 25 01:56:02 PST 2020
mkazantsev updated this revision to Diff 307543.
mkazantsev edited the summary of this revision.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91525/new/
https://reviews.llvm.org/D91525
Files:
llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
llvm/test/Transforms/LoopLoadElim/pr-48150.ll
Index: llvm/test/Transforms/LoopLoadElim/pr-48150.ll
===================================================================
--- llvm/test/Transforms/LoopLoadElim/pr-48150.ll
+++ llvm/test/Transforms/LoopLoadElim/pr-48150.ll
@@ -1,6 +1,4 @@
; RUN: opt -passes=loop-load-elim -S < %s | FileCheck %s
-; REQUIRES: asserts
-; XFAIL: *
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
target triple = "x86_64-unknown-linux-gnu"
Index: llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
+++ llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
@@ -56,6 +56,7 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils.h"
+#include "llvm/Transforms/Utils/LoopSimplify.h"
#include "llvm/Transforms/Utils/LoopVersioning.h"
#include "llvm/Transforms/Utils/ScalarEvolutionExpander.h"
#include "llvm/Transforms/Utils/SizeOpts.h"
@@ -610,6 +611,7 @@
static bool
eliminateLoadsAcrossLoops(Function &F, LoopInfo &LI, DominatorTree &DT,
BlockFrequencyInfo *BFI, ProfileSummaryInfo *PSI,
+ ScalarEvolution *SE, AssumptionCache *AC,
function_ref<const LoopAccessInfo &(Loop &)> GetLAI) {
// Build up a worklist of inner-loops to transform to avoid iterator
// invalidation.
@@ -618,14 +620,17 @@
// which merely optimizes the use of loads in a loop.
SmallVector<Loop *, 8> Worklist;
+ bool Changed = false;
+
for (Loop *TopLevelLoop : LI)
- for (Loop *L : depth_first(TopLevelLoop))
+ for (Loop *L : depth_first(TopLevelLoop)) {
+ Changed |= simplifyLoop(L, &DT, &LI, SE, AC, /*MSSAU*/ nullptr, false);
// We only handle inner-most loops.
if (L->isInnermost())
Worklist.push_back(L);
+ }
// Now walk the identified inner loops.
- bool Changed = false;
for (Loop *L : Worklist) {
// The actual work is performed by LoadEliminationForLoop.
LoadEliminationForLoop LEL(L, &LI, GetLAI(*L), &DT, BFI, PSI);
@@ -660,7 +665,7 @@
// Process each loop nest in the function.
return eliminateLoadsAcrossLoops(
- F, LI, DT, BFI, PSI,
+ F, LI, DT, BFI, PSI, nullptr, nullptr,
[&LAA](Loop &L) -> const LoopAccessInfo & { return LAA.getInfo(&L); });
}
@@ -717,7 +722,7 @@
auto &LAM = AM.getResult<LoopAnalysisManagerFunctionProxy>(F).getManager();
bool Changed = eliminateLoadsAcrossLoops(
- F, LI, DT, BFI, PSI, [&](Loop &L) -> const LoopAccessInfo & {
+ F, LI, DT, BFI, PSI, &SE, &AC, [&](Loop &L) -> const LoopAccessInfo & {
LoopStandardAnalysisResults AR = {AA, AC, DT, LI, SE,
TLI, TTI, nullptr, MSSA};
return LAM.getResult<LoopAccessAnalysis>(L, AR);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91525.307543.patch
Type: text/x-patch
Size: 2950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201125/5be77f10/attachment.bin>
More information about the llvm-commits
mailing list