[llvm] [LoopRotation] Enable LoopRotation with -Oz if header folds (PR #72842)
Daniil Fukalov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 29 13:43:48 PST 2024
================
@@ -365,6 +365,65 @@ static void updateBranchWeights(BranchInst &PreHeaderBI, BranchInst &LoopBI,
}
}
+// Check if duplicating the header to the preheader will fold all duplicated
+// instructions, terminating with an unconditional jump. So No code duplication
+// would be necessary.
+static bool canRotateWithoutDuplication(Loop *L, llvm::LoopInfo *LI,
+ llvm::SimplifyQuery SQ) {
+ BasicBlock *OrigHeader = L->getHeader();
+ BasicBlock *OrigPreheader = L->getLoopPreheader();
+
+ BranchInst *T = dyn_cast<BranchInst>(OrigHeader->getTerminator());
+ assert(T && T->isConditional() && "Header Terminator should be conditional!");
+
+ // a value map to holds the values incoming from preheader
----------------
dfukalov wrote:
Would you please reformat this comment and some of them below, capitalizing first letter and period at the end of sentences.
https://github.com/llvm/llvm-project/pull/72842
More information about the llvm-commits
mailing list