[llvm-branch-commits] [llvm] [ProfCheck][Matrix] Add profile data where relevant (PR #181292)
Mircea Trofin via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Feb 12 19:31:06 PST 2026
================
@@ -42,7 +49,15 @@ BasicBlock *TileInfo::CreateLoop(BasicBlock *Preheader, BasicBlock *Exit,
B.SetInsertPoint(Latch);
Value *Inc = B.CreateAdd(IV, Step, Name + ".step");
Value *Cond = B.CreateICmpNE(Inc, Bound, Name + ".cond");
- BranchInst::Create(Header, Exit, Cond, Latch);
+ auto *BR = BranchInst::Create(Header, Exit, Cond, Latch);
+ if (!ProfcheckDisableMetadataFixes) {
+ assert(Step->getZExtValue() != 0 &&
+ "Expected a non-zero step size. A step size of zero produces an "
----------------
mtrofin wrote:
ok, but that's not the reason you're not expecting 0. You're not expecting 0 because "The bounds end up getting set by the matrix size, which has to be specified as an immediate value to the intrinsics according to LangRef. We should never end up with a zero step as that value is decided by the pass." (which I take to mean it really cannot be 0)
So, if it *can* be 0, then a dynamic check is needed. If it cannot be 0 (i.e. it'd mean a bug somewhere else), then assert. Either way, the reason for the assert is that, not the fact that it would result in a bad profile.
https://github.com/llvm/llvm-project/pull/181292
More information about the llvm-branch-commits
mailing list