[polly] [Polly] Materialize escaping scalars from empty-domain statements as poison (PR #220008)

Shikhar Jain via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 05:08:38 PDT 2026


ShikharJ-Corp wrote:

> > The problem is that, at that point in the pipeline, we cannot yet determine whether the escaping scalar belongs to a statement whose domain will eventually be null or empty
> 
> That's not relevant. If the value is escaping, it will have to be materialized, whether the statement's domain is null or not. The conclusion is that we have to determine whether values are escaping _before_ pruning statements with empty domains.
> 
> However, the fallout of that may be that order of memory accesses and ScopArrayInfo is different. That's non-semantic, but checked by a lot of tests. The impact of this PR in the current PR is small enough and avoids the fallout, but generally I would prefer patches that fix the original code rather than adding more code that detects afterwards whether the broken situation occured and then patch it up. Please add at least a TODO about what the proper solution would be.
Hi @Meinersbur 
--> "If the value is escaping, it will have to be materialized", this is still true [like with or without the patch], the topic of concern is whether the escaping value also has a corresponding invalid-domain ScopStmt. Cause in such scenario , the ScopStmt (& associated escaping value/instrn ) is removed from optimized side of SCoP. 
Suppose if the domain was valid then the current machinery (most probably via buildAccessRelations()) is able to handle it..
--> _**This leads us to a question "can we skip checking the in-validness of domain for such escaping scalars" the answer is yes , if we can formally prove that in such a case, the "extra" poison materialization happening will not cause any semantic issue/side effects or cleanly handled by passes coming after polly (or after scop build in polly)**_ . As, we have seen in earlier commits , that such an assumption has caused few of the regression test to fail..
--> "The conclusion is that we have to determine whether values are escaping before pruning statements with empty domains." This is exactly this current patch/commit is doing.. like inside the  removeStmtNotInDomainMap(). just when the ScopStmt is about to be pruned.. we check is it escaping or not..
This saves us from reshuffle demand in the existing buildscop pipeline and saves the fallout..

Thus considering the above facts, if this PR is fine then we can proceed further..
Also should we add a todo, if we want then i am thinking to put a todo inside buildEscapingDependences() regarding the non-availability of the domain-info and like by reshuffling the pipeline in buildscop() we can actually do SAI registration there.   


https://github.com/llvm/llvm-project/pull/220008


More information about the llvm-commits mailing list