[PATCH] D138228: [LoopPeel] Expose ValueMap of last peeled iteration. NFC
Anna Thomas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 19 06:55:48 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG05b060b0b07b: [LoopPeel] Expose ValueMap of last peeled iteration. NFC (authored by anna).
Changed prior to commit:
https://reviews.llvm.org/D138228?vs=476180&id=483954#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138228/new/
https://reviews.llvm.org/D138228
Files:
llvm/include/llvm/Transforms/Utils/LoopPeel.h
llvm/lib/Transforms/Scalar/LoopFuse.cpp
llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
llvm/lib/Transforms/Utils/LoopPeel.cpp
Index: llvm/lib/Transforms/Utils/LoopPeel.cpp
===================================================================
--- llvm/lib/Transforms/Utils/LoopPeel.cpp
+++ llvm/lib/Transforms/Utils/LoopPeel.cpp
@@ -854,7 +854,7 @@
/// optimizations.
bool llvm::peelLoop(Loop *L, unsigned PeelCount, LoopInfo *LI,
ScalarEvolution *SE, DominatorTree &DT, AssumptionCache *AC,
- bool PreserveLCSSA) {
+ bool PreserveLCSSA, ValueToValueMapTy &LVMap) {
assert(PeelCount > 0 && "Attempt to peel out zero iterations?");
assert(canPeel(L) && "Attempt to peel a loop which is not peelable?");
@@ -946,8 +946,6 @@
InsertBot->setName(Header->getName() + ".peel.next");
NewPreHeader->setName(PreHeader->getName() + ".peel.newph");
- ValueToValueMapTy LVMap;
-
Instruction *LatchTerm =
cast<Instruction>(cast<BasicBlock>(Latch)->getTerminator());
Index: llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -1292,7 +1292,8 @@
<< " iterations";
});
- if (peelLoop(L, PP.PeelCount, LI, &SE, DT, &AC, PreserveLCSSA)) {
+ ValueToValueMapTy VMap;
+ if (peelLoop(L, PP.PeelCount, LI, &SE, DT, &AC, PreserveLCSSA, VMap)) {
simplifyLoopAfterUnroll(L, true, LI, &SE, &DT, &AC, &TTI);
// If the loop was peeled, we already "used up" the profile information
// we had, so we don't want to unroll or peel again.
Index: llvm/lib/Transforms/Scalar/LoopFuse.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopFuse.cpp
+++ llvm/lib/Transforms/Scalar/LoopFuse.cpp
@@ -767,7 +767,8 @@
LLVM_DEBUG(dbgs() << "Attempting to peel first " << PeelCount
<< " iterations of the first loop. \n");
- FC0.Peeled = peelLoop(FC0.L, PeelCount, &LI, &SE, DT, &AC, true);
+ ValueToValueMapTy VMap;
+ FC0.Peeled = peelLoop(FC0.L, PeelCount, &LI, &SE, DT, &AC, true, VMap);
if (FC0.Peeled) {
LLVM_DEBUG(dbgs() << "Done Peeling\n");
Index: llvm/include/llvm/Transforms/Utils/LoopPeel.h
===================================================================
--- llvm/include/llvm/Transforms/Utils/LoopPeel.h
+++ llvm/include/llvm/Transforms/Utils/LoopPeel.h
@@ -15,13 +15,17 @@
#define LLVM_TRANSFORMS_UTILS_LOOPPEEL_H
#include "llvm/Analysis/TargetTransformInfo.h"
+#include "llvm/Transforms/Utils/ValueMapper.h"
namespace llvm {
bool canPeel(const Loop *L);
+/// VMap is the value-map that maps instructions from the original loop to
+/// instructions in the last peeled-off iteration.
bool peelLoop(Loop *L, unsigned PeelCount, LoopInfo *LI, ScalarEvolution *SE,
- DominatorTree &DT, AssumptionCache *AC, bool PreserveLCSSA);
+ DominatorTree &DT, AssumptionCache *AC, bool PreserveLCSSA,
+ ValueToValueMapTy &VMap);
TargetTransformInfo::PeelingPreferences
gatherPeelingPreferences(Loop *L, ScalarEvolution &SE,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138228.483954.patch
Type: text/x-patch
Size: 3119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221219/cb108d87/attachment.bin>
More information about the llvm-commits
mailing list