diff --git a/llvm/include/llvm/Transforms/Utils/LoopVersioning.h b/llvm/include/llvm/Transforms/Utils/LoopVersioning.h --- a/llvm/include/llvm/Transforms/Utils/LoopVersioning.h +++ b/llvm/include/llvm/Transforms/Utils/LoopVersioning.h @@ -75,6 +75,9 @@ /// 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; } + /// Annotate memory instructions in the versioned loop with no-alias /// metadata based on the memchecks issued. /// @@ -115,6 +118,9 @@ /// loop may alias (memchecks failed). Loop *NonVersionedLoop; + /// The basic Block that stores the BranchInst to Versioned / NonVersioned + BasicBlock *RuntimeCheckBB; + /// 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 --- a/llvm/lib/Transforms/Utils/LoopVersioning.cpp +++ b/llvm/lib/Transforms/Utils/LoopVersioning.cpp @@ -58,7 +58,7 @@ Value *RuntimeCheck = nullptr; // Add the memcheck in the original preheader (this is empty initially). - BasicBlock *RuntimeCheckBB = VersionedLoop->getLoopPreheader(); + RuntimeCheckBB = VersionedLoop->getLoopPreheader(); const auto &RtPtrChecking = *LAI.getRuntimePointerChecking(); SCEVExpander Exp2(*RtPtrChecking.getSE(),