llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[polly] Assertion : “Assertion `isl_set_is_subset(SchedDom, AccDom) && "Access relation not defined on full schedule domain"

Open chrisj-quic opened this issue 5 months ago • 1 comments

Reproducer link: https://godbolt.org/z/cehvbTsc9

Command:

opt -passes=polly test_reduced.ll

Reduced test:

target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "aarch64-unknown-linux-gnu"

define void @foo(i32 %w, ptr %dst, i64 %n) {
entry:
  br label %for.outer

for.outer:
  %i = phi i64 [ %i.next, %for.mid.exit ], [ 0, %entry ]
  br label %for.mid

for.mid:
  br label %for.inner

for.inner:
  %0 = phi i32 [ 0, %for.mid ], [ 1, %for.inner ]
  %1 = load i16, ptr null, align 2
  %cond1 = icmp eq i32 0, %w
  br i1 %cond1, label %for.inner.exit, label %for.inner

for.inner.exit:
  br i1 true, label %for.mid.exit, label %for.mid

for.mid.exit:
  %ptr = getelementptr [4 x i8], ptr %dst, i64 %i
  store i32 %0, ptr %ptr, align 4
  %i.next = add i64 %i, 1
  %cond2 = icmp eq i64 %i, %n
  br i1 %cond2, label %for.outer.exit, label %for.outer

for.outer.exit:
  ret void
}

Above gives the below assertion,

opt: /root/llvm-project/polly/lib/CodeGen/IslNodeBuilder.cpp:806: isl_id_to_ast_expr* polly::IslNodeBuilder::createNewAccesses(polly::ScopStmt*, isl_ast_node*): Assertion `isl_set_is_subset(SchedDom, AccDom) && "Access relation not defined on full schedule domain"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=polly <source>
1.	Running pass "function(polly)" on module "<source>"
 #0 0x0000000005aa38e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5aa38e8)
 #1 0x0000000005aa0824 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5aa0824)
 #2 0x0000000005aa099a SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x00007bd45e045330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #4 0x00007bd45e09eb2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
 #5 0x00007bd45e04527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
 #6 0x00007bd45e0288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
 #7 0x00007bd45e02881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
 #8 0x00007bd45e03b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
 #9 0x0000000002e611e6 polly::IslNodeBuilder::createNewAccesses(polly::ScopStmt*, isl_ast_node*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2e611e6)
#10 0x0000000002e626b9 polly::IslNodeBuilder::createUser(isl_ast_node*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2e626b9)
#11 0x0000000002e681fe polly::IslNodeBuilder::createForSequential(isl::ast_node_for, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2e681fe)
#12 0x0000000002e6bc10 polly::IslNodeBuilder::createFor(isl_ast_node*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2e6bc10)
#13 0x0000000002e5f388 polly::IslNodeBuilder::createBlock(isl_ast_node*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2e5f388)
#14 0x0000000002e31e6a generateCode(polly::Scop&, polly::IslAstInfo&, llvm::LoopInfo&, llvm::DominatorTree&, llvm::ScalarEvolution&, llvm::RegionInfo&) CodeGeneration.cpp:0:0
#15 0x0000000002db8246 polly::runPollyPass(llvm::Function&, llvm::AnalysisManager<llvm::Function>&, polly::PollyPassOptions) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2db8246)
#16 0x0000000002db8e0e polly::PollyFunctionPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2db8e0e)
#17 0x0000000002d39ade llvm::detail::PassModel<llvm::Function, polly::PollyFunctionPass, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2d39ade)
#18 0x00000000058250f6 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x58250f6)
#19 0x000000000093494e llvm::detail::PassModel<llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x93494e)
#20 0x0000000005824727 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5824727)
#21 0x000000000093ed25 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::ArrayRef<std::function<void (llvm::PassBuilder&)>>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x93ed25)
#22 0x0000000000932717 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x932717)
#23 0x00007bd45e02a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#24 0x00007bd45e02a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#25 0x00000000009286a5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9286a5)

chrisj-quic avatar Jun 25 '26 06:06 chrisj-quic

@llvm/issue-subscribers-polly

Author: Chris Jenneisch (chrisj-quic)

Reproducer link: https://godbolt.org/z/cehvbTsc9

Command:

opt -passes=polly test_reduced.ll

Reduced test:

target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "aarch64-unknown-linux-gnu"

define void @<!-- -->foo(i32 %w, ptr %dst, i64 %n) {
entry:
  br label %for.outer

for.outer:
  %i = phi i64 [ %i.next, %for.mid.exit ], [ 0, %entry ]
  br label %for.mid

for.mid:
  br label %for.inner

for.inner:
  %0 = phi i32 [ 0, %for.mid ], [ 1, %for.inner ]
  %1 = load i16, ptr null, align 2
  %cond1 = icmp eq i32 0, %w
  br i1 %cond1, label %for.inner.exit, label %for.inner

for.inner.exit:
  br i1 true, label %for.mid.exit, label %for.mid

for.mid.exit:
  %ptr = getelementptr [4 x i8], ptr %dst, i64 %i
  store i32 %0, ptr %ptr, align 4
  %i.next = add i64 %i, 1
  %cond2 = icmp eq i64 %i, %n
  br i1 %cond2, label %for.outer.exit, label %for.outer

for.outer.exit:
  ret void
}

Above gives the below assertion,

opt: /root/llvm-project/polly/lib/CodeGen/IslNodeBuilder.cpp:806: isl_id_to_ast_expr* polly::IslNodeBuilder::createNewAccesses(polly::ScopStmt*, isl_ast_node*): Assertion `isl_set_is_subset(SchedDom, AccDom) &amp;&amp; "Access relation not defined on full schedule domain"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/opt -o /app/output.s -S -passes=polly &lt;source&gt;
1.	Running pass "function(polly)" on module "&lt;source&gt;"
 #<!-- -->0 0x0000000005aa38e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5aa38e8)
 #<!-- -->1 0x0000000005aa0824 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5aa0824)
 #<!-- -->2 0x0000000005aa099a SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #<!-- -->3 0x00007bd45e045330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #<!-- -->4 0x00007bd45e09eb2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
 #<!-- -->5 0x00007bd45e04527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
 #<!-- -->6 0x00007bd45e0288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
 #<!-- -->7 0x00007bd45e02881b (/lib/x86_64-linux-gnu/libc.so.6+0x2881b)
 #<!-- -->8 0x00007bd45e03b517 (/lib/x86_64-linux-gnu/libc.so.6+0x3b517)
 #<!-- -->9 0x0000000002e611e6 polly::IslNodeBuilder::createNewAccesses(polly::ScopStmt*, isl_ast_node*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2e611e6)
#<!-- -->10 0x0000000002e626b9 polly::IslNodeBuilder::createUser(isl_ast_node*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2e626b9)
#<!-- -->11 0x0000000002e681fe polly::IslNodeBuilder::createForSequential(isl::ast_node_for, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2e681fe)
#<!-- -->12 0x0000000002e6bc10 polly::IslNodeBuilder::createFor(isl_ast_node*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2e6bc10)
#<!-- -->13 0x0000000002e5f388 polly::IslNodeBuilder::createBlock(isl_ast_node*) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2e5f388)
#<!-- -->14 0x0000000002e31e6a generateCode(polly::Scop&amp;, polly::IslAstInfo&amp;, llvm::LoopInfo&amp;, llvm::DominatorTree&amp;, llvm::ScalarEvolution&amp;, llvm::RegionInfo&amp;) CodeGeneration.cpp:0:0
#<!-- -->15 0x0000000002db8246 polly::runPollyPass(llvm::Function&amp;, llvm::AnalysisManager&lt;llvm::Function&gt;&amp;, polly::PollyPassOptions) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2db8246)
#<!-- -->16 0x0000000002db8e0e polly::PollyFunctionPass::run(llvm::Function&amp;, llvm::AnalysisManager&lt;llvm::Function&gt;&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2db8e0e)
#<!-- -->17 0x0000000002d39ade llvm::detail::PassModel&lt;llvm::Function, polly::PollyFunctionPass, llvm::AnalysisManager&lt;llvm::Function&gt;&gt;::run(llvm::Function&amp;, llvm::AnalysisManager&lt;llvm::Function&gt;&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x2d39ade)
#<!-- -->18 0x00000000058250f6 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&amp;, llvm::AnalysisManager&lt;llvm::Module&gt;&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x58250f6)
#<!-- -->19 0x000000000093494e llvm::detail::PassModel&lt;llvm::Module, llvm::ModuleToFunctionPassAdaptor, llvm::AnalysisManager&lt;llvm::Module&gt;&gt;::run(llvm::Module&amp;, llvm::AnalysisManager&lt;llvm::Module&gt;&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x93494e)
#<!-- -->20 0x0000000005824727 llvm::PassManager&lt;llvm::Module, llvm::AnalysisManager&lt;llvm::Module&gt;&gt;::run(llvm::Module&amp;, llvm::AnalysisManager&lt;llvm::Module&gt;&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x5824727)
#<!-- -->21 0x000000000093ed25 llvm::runPassPipeline(llvm::StringRef, llvm::Module&amp;, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef&lt;llvm::PassPlugin&gt;, llvm::ArrayRef&lt;std::function&lt;void (llvm::PassBuilder&amp;)&gt;&gt;, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x93ed25)
#<!-- -->22 0x0000000000932717 optMain (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x932717)
#<!-- -->23 0x00007bd45e02a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#<!-- -->24 0x00007bd45e02a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#<!-- -->25 0x00000000009286a5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/opt+0x9286a5)