[polly] [Polly] Fix assertion in addUserAssumptions for unreachable blocks (PR #227311)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 30 04:28:08 PDT 2026
================
@@ -1472,6 +1472,12 @@ void ScopBuilder::addUserAssumptions(
SmallVector<isl_set *, 2> ConditionSets;
auto *TI = InScop ? CI->getParent()->getTerminator() : nullptr;
BasicBlock *BB = InScop ? CI->getParent() : R.getEntry();
+
+ // Skip assumptions in blocks with no computed domain (e.g. unreachable
+ // blocks).
----------------
Meinersbur wrote:
Mention BBs in non-affine regions (that are not the entry BB) here as well, which is the case of the bug this fixes. Nothing except the entry BB is known the execute on entering the region, so cannot be sure that the assumption is "executed".
Mentioning this here is particularly important because the standard means to get the domain of a BB is `getDomainConditions` which would return the region's domain, not nullptr. So `getDomainConditions` cannot be used here. (I think it wouold be better if it actually used `getDomainConditions` and determines being unreachable code another way, but that goes beyond fixing this bug)
The other case is the if the assumption is the entry bock of the non-affine region in which case actually returns value for `InvalidDomainMap`. However, I think it is correct to so; it is actually guaranteed to execute.
https://github.com/llvm/llvm-project/pull/227311
More information about the llvm-commits
mailing list