[llvm] 6734be2 - Revert "[LoopVersioning] Allow versionLoop to create plain branch inst when no runtime check is specified"
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 16 02:06:22 PST 2021
Author: eopXD
Date: 2021-12-16T02:06:11-08:00
New Revision: 6734be290bdd97174b9fccea2be842eb6b085d8b
URL: https://github.com/llvm/llvm-project/commit/6734be290bdd97174b9fccea2be842eb6b085d8b
DIFF: https://github.com/llvm/llvm-project/commit/6734be290bdd97174b9fccea2be842eb6b085d8b.diff
LOG: Revert "[LoopVersioning] Allow versionLoop to create plain branch inst when no runtime check is specified"
This reverts commit fbf6c8ac1589a4be68ee549257f1d528937ac582.
Added:
Modified:
llvm/include/llvm/Transforms/Utils/LoopVersioning.h
llvm/lib/Transforms/Utils/LoopVersioning.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Utils/LoopVersioning.h b/llvm/include/llvm/Transforms/Utils/LoopVersioning.h
index abf5acc377e4e..4a8831ed45b25 100644
--- a/llvm/include/llvm/Transforms/Utils/LoopVersioning.h
+++ b/llvm/include/llvm/Transforms/Utils/LoopVersioning.h
@@ -75,12 +75,6 @@ class LoopVersioning {
/// loop may alias (i.e. one of the memchecks failed).
Loop *getNonVersionedLoop() { return NonVersionedLoop; }
- /// Returns the basic block that contains the runtime check BranchInst
- BasicBlock *getRuntimeCheckBB() { return RuntimeCheckBB; }
-
- /// Returns the runtime check BranchInst
- BranchInst *getRuntimeCheckBI() { return RuntimeCheckBI; }
-
/// Annotate memory instructions in the versioned loop with no-alias
/// metadata based on the memchecks issued.
///
@@ -121,12 +115,6 @@ class LoopVersioning {
/// loop may alias (memchecks failed).
Loop *NonVersionedLoop;
- /// The basic Block that stores the BranchInst to Versioned / NonVersioned
- BasicBlock *RuntimeCheckBB;
-
- /// The branch instruction to Versioned / NonVersioned
- BranchInst *RuntimeCheckBI;
-
/// This maps the instructions from VersionedLoop to their counterpart
/// in NonVersionedLoop.
ValueToValueMapTy VMap;
diff --git a/llvm/lib/Transforms/Utils/LoopVersioning.cpp b/llvm/lib/Transforms/Utils/LoopVersioning.cpp
index 15a40cac8c110..771b7d25b0f20 100644
--- a/llvm/lib/Transforms/Utils/LoopVersioning.cpp
+++ b/llvm/lib/Transforms/Utils/LoopVersioning.cpp
@@ -30,9 +30,6 @@
using namespace llvm;
-#define LVER_OPTION "loop-versioning"
-#define DEBUG_TYPE LVER_OPTION
-
static cl::opt<bool>
AnnotateNoAlias("loop-version-annotate-no-alias", cl::init(true),
cl::Hidden,
@@ -87,11 +84,8 @@ void LoopVersioning::versionLoop(
} else
RuntimeCheck = MemRuntimeCheck ? MemRuntimeCheck : SCEVRuntimeCheck;
- if (!RuntimeCheck) {
- LLVM_DEBUG(dbgs() << DEBUG_TYPE " No MemRuntimeCheck or SCEVRuntimeCheck found"
- << ", set RuntimeCheck to False\n");
- RuntimeCheck = ConstantInt::getFalse(RuntimeCheckBB->getContext());
- }
+ assert(RuntimeCheck && "called even though we don't need "
+ "any runtime checks");
// Rename the block to make the IR more readable.
RuntimeCheckBB->setName(VersionedLoop->getHeader()->getName() +
@@ -115,8 +109,8 @@ void LoopVersioning::versionLoop(
// Insert the conditional branch based on the result of the memchecks.
Instruction *OrigTerm = RuntimeCheckBB->getTerminator();
- RuntimeCheckBI = BranchInst::Create(NonVersionedLoop->getLoopPreheader(),
- VersionedLoop->getLoopPreheader(), RuntimeCheck, OrigTerm);
+ BranchInst::Create(NonVersionedLoop->getLoopPreheader(),
+ VersionedLoop->getLoopPreheader(), RuntimeCheck, OrigTerm);
OrigTerm->eraseFromParent();
// The loops merge in the original exit block. This is now dominated by the
@@ -131,9 +125,6 @@ void LoopVersioning::versionLoop(
assert(NonVersionedLoop->isLoopSimplifyForm() &&
VersionedLoop->isLoopSimplifyForm() &&
"The versioned loops should be in simplify form.");
-
- // RuntimeCheckBB and RuntimeCheckBI is recorded
- assert(RuntimeCheckBB && RuntimeCheckBI);
}
void LoopVersioning::addPHINodes(
@@ -333,6 +324,9 @@ class LoopVersioningLegacyPass : public FunctionPass {
};
}
+#define LVER_OPTION "loop-versioning"
+#define DEBUG_TYPE LVER_OPTION
+
char LoopVersioningLegacyPass::ID;
static const char LVer_name[] = "Loop Versioning";
More information about the llvm-commits
mailing list