[PATCH] D14240: Allow Loop Distribute and the loop versioning infrastructure to use SCEV predicates
Adam Nemet via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 4 21:46:56 PST 2015
anemet added a comment.
I have a high-level question. How should LoopDist work with SCEVAssumptions? If you look at alias checks we filter those in includeOnlyCrossPartitionChecks to get rid of unnecessary checks.
Could something like this be implemented with SCEVAssumptions? E.g. if you have a may-wrapping pointer that can't alias with anything in the other partition, we don't need to issue the non-wrapping check in order to make distribution correct.
================
Comment at: lib/Transforms/Scalar/LoopDistribute.cpp:770-771
@@ -767,4 +769,4 @@
// If we need run-time checks to disambiguate pointers are run-time, version
// the loop now.
auto PtrToPartition = Partitions.computePartitionSetForPointers(LAI);
----------------
This comment needs updating now since we don't only version to disambiguate pointers anymore.
================
Comment at: lib/Transforms/Scalar/LoopDistribute.cpp:779
@@ -776,1 +778,3 @@
+ const SCEVUnionPredicate &Pred = LAI.Preds;
+ if ((!Pred.isAlwaysTrue()) || !Checks.empty()) {
DEBUG(dbgs() << "\nPointers:\n");
----------------
Extra () in the first term.
================
Comment at: lib/Transforms/Utils/LoopVersioning.cpp:27-35
@@ -25,10 +26,11 @@
LoopVersioning::LoopVersioning(
SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks,
- const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI, DominatorTree *DT)
+ const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI, DominatorTree *DT,
+ ScalarEvolution *SE)
: VersionedLoop(L), NonVersionedLoop(nullptr), Checks(std::move(Checks)),
- LAI(LAI), LI(LI), DT(DT) {
+ LAI(LAI), LI(LI), DT(DT), SE(SE) {
assert(L->getExitBlock() && "No single exit block");
assert(L->getLoopPreheader() && "No preheader");
}
----------------
Now that we will feed LVers with two sets of checks optionally, we should probably move away from taking these in the ctor.
I think that we should have two members like addAliasChecks and addSCEVChecks or something.
I also don't think that we should take LAI but SCEVPredUnion instead.
The second ctor below is fine because the idea there is to take everything from LAI without filtering it.
================
Comment at: lib/Transforms/Utils/LoopVersioning.cpp:55
@@ -48,3 +54,3 @@
// Add the memcheck in the original preheader (this is empty initially).
BasicBlock *MemCheckBB = VersionedLoop->getLoopPreheader();
std::tie(FirstCheckInst, MemRuntimeCheck) =
----------------
s/MemCheckBB/RuntimeCheckBB
http://reviews.llvm.org/D14240
More information about the llvm-commits
mailing list