[llvm-bugs] [Bug 33464] New: [polly] Assertion `DT.dominates(I->getParent(), L->getHeader()) && "No dominance relationship between SCEV and loop?"' failed. with invariant load hoisting

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 14 17:53:00 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33464

            Bug ID: 33464
           Summary: [polly] Assertion `DT.dominates(I->getParent(),
                    L->getHeader()) && "No dominance relationship between
                    SCEV and loop?"' failed. with invariant load hoisting
           Product: Polly
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Optimizer
          Assignee: polly-dev at googlegroups.com
          Reporter: efriedma at codeaurora.org
                CC: llvm-bugs at lists.llvm.org

Testcase:

void a(int y, int *p, int *j) {
  if (y)
    for (int i = 0; i < 10000; ++i)
      p[*j+i] = i;
  else
    for (int i = 0; i < 10000; ++i)
      p[*j+i] = i*2;
}

Compiling with "clang -mllvm -polly -mllvm -polly-process-unprofitable -mllvm
-polly-invariant-load-hoisting --target=aarch64 -mllvm
-polly-position=before-vectorizer -O2", produces the following crash:

clang-4.0: (src)/llvm/lib/Analysis/ScalarEvolution.cpp:2201: bool
llvm::ScalarEvolution::isAvailableAtLoopEntry(const llvm::SCEV *, const
llvm::Loop *)::FindDominatedSCEVUnknown::checkSCEVUnknown(const
llvm::SCEVUnknown *): Assertion `DT.dominates(I->getParent(), L->getHeader())
&& "No dominance relationship between SCEV and loop?"' failed.
#0 0x0000000001f5b704 PrintStackTraceSignalHandler(void*)
((src)/llvm/bin/clang-4.0+0x1f5b704)
#1 0x0000000001f5b966 SignalHandler(int) ((src)/llvm/bin/clang-4.0+0x1f5b966)
#2 0x00007f303a6de330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#3 0x00007f30390cfc37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#4 0x00007f30390d3028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#5 0x00007f30390c8bf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#6 0x00007f30390c8ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#7 0x000000000161505a
llvm::SCEVTraversal<llvm::ScalarEvolution::isAvailableAtLoopEntry(llvm::SCEV
const*, llvm::Loop const*)::FindDominatedSCEVUnknown>::push(llvm::SCEV const*)
((src)/llvm/bin/clang-4.0+0x161505a)
#8 0x00000000015d8d9d llvm::ScalarEvolution::isAvailableAtLoopEntry(llvm::SCEV
const*, llvm::Loop const*) ((src)/llvm/bin/clang-4.0+0x15d8d9d)
#9 0x00000000015cf88f
llvm::ScalarEvolution::getAddExpr(llvm::SmallVectorImpl<llvm::SCEV const*>&,
llvm::SCEV::NoWrapFlags, unsigned int) ((src)/llvm/bin/clang-4.0+0x15cf88f)
#10 0x0000000002689ea8
llvm::SCEVRewriteVisitor<SCEVSensitiveParameterRewriter>::visitAddExpr(llvm::SCEVAddExpr
const*) ((src)/llvm/bin/clang-4.0+0x2689ea8)
#11 0x0000000002689b1e
llvm::SCEVRewriteVisitor<SCEVSensitiveParameterRewriter>::visit(llvm::SCEV
const*) ((src)/llvm/bin/clang-4.0+0x2689b1e)
#12 0x0000000002689c49 llvm::SCEVVisitor<SCEVSensitiveParameterRewriter,
llvm::SCEV const*>::visit(llvm::SCEV const*)
((src)/llvm/bin/clang-4.0+0x2689c49)
#13 0x0000000002689b1e
llvm::SCEVRewriteVisitor<SCEVSensitiveParameterRewriter>::visit(llvm::SCEV
const*) ((src)/llvm/bin/clang-4.0+0x2689b1e)
#14 0x00000000026763e5 polly::Scop::getIdForParam(llvm::SCEV const*)
((src)/llvm/bin/clang-4.0+0x26763e5)
#15 0x00000000026c5566 polly::SCEVAffinator::visit(llvm::SCEV const*)
((src)/llvm/bin/clang-4.0+0x26c5566)
#16 0x0000000002671ddb polly::Scop::getPwAff(llvm::SCEV const*,
llvm::BasicBlock*, bool) ((src)/llvm/bin/clang-4.0+0x2671ddb)
#17 0x00000000026707dc
polly::MemoryAccess::buildAccessRelation(polly::ScopArrayInfo const*)
((src)/llvm/bin/clang-4.0+0x26707dc)
#18 0x0000000002672911 polly::ScopStmt::buildAccessRelations()
((src)/llvm/bin/clang-4.0+0x2672911)
#19 0x0000000002673f60 polly::ScopStmt::init(llvm::LoopInfo&)
((src)/llvm/bin/clang-4.0+0x2673f60)
#20 0x00000000026970de polly::ScopBuilder::buildScop(llvm::Region&,
llvm::AssumptionCache&) ((src)/llvm/bin/clang-4.0+0x26970de)
#21 0x0000000002697bd9 polly::ScopBuilder::ScopBuilder(llvm::Region*,
llvm::AssumptionCache&, llvm::AAResults&, llvm::DataLayout const&,
llvm::DominatorTree&, llvm::LoopInfo&, polly::ScopDetection&,
llvm::ScalarEvolution&) ((src)/llvm/bin/clang-4.0+0x2697bd9)
#22 0x0000000002687749 polly::ScopInfoRegionPass::runOnRegion(llvm::Region*,
llvm::RGPassManager&) ((src)/llvm/bin/clang-4.0+0x2687749)
#23 0x00000000015c2c53 llvm::RGPassManager::runOnFunction(llvm::Function&)
((src)/llvm/bin/clang-4.0+0x15c2c53)
#24 0x0000000001a38764 llvm::FPPassManager::runOnFunction(llvm::Function&)
((src)/llvm/bin/clang-4.0+0x1a38764)
#25 0x0000000001a389b3 llvm::FPPassManager::runOnModule(llvm::Module&)
((src)/llvm/bin/clang-4.0+0x1a389b3)
#26 0x0000000001a38ef3 llvm::legacy::PassManagerImpl::run(llvm::Module&)
((src)/llvm/bin/clang-4.0+0x1a38ef3)
#27 0x0000000002110ebb clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::__1::unique_ptr<llvm::raw_pwrite_stream,
std::__1::default_delete<llvm::raw_pwrite_stream> >)
((src)/llvm/bin/clang-4.0+0x2110ebb)
#28 0x000000000273cebc
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
((src)/llvm/bin/clang-4.0+0x273cebc)
#29 0x00000000029da125 clang::ParseAST(clang::Sema&, bool, bool)
((src)/llvm/bin/clang-4.0+0x29da125)
#30 0x0000000002588af9 clang::FrontendAction::Execute()
((src)/llvm/bin/clang-4.0+0x2588af9)
#31 0x000000000254d2c1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
((src)/llvm/bin/clang-4.0+0x254d2c1)
#32 0x000000000262e995
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
((src)/llvm/bin/clang-4.0+0x262e995)
#33 0x00000000008e5e02 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) ((src)/llvm/bin/clang-4.0+0x8e5e02)
#34 0x00000000008e46ce main ((src)/llvm/bin/clang-4.0+0x8e46ce)
#35 0x00007f30390baf45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#36 0x00000000008e1649 _start ((src)/llvm/bin/clang-4.0+0x8e1649)

Reproduced using trunk (r305416).

The assertion was added in https://reviews.llvm.org/rL303971 , to ensure SCEV
expressions are computable.  Here, Scop::getRepresentingInvariantLoadSCEV tries
to get a SCEV which is the sum of the load "*j" loop in the first loop, and the
induction variable in the second loop.

I'm not sure what the right solution is here; maybe we can just avoid trying to
construct this particular SCEV expression in the first place?  I think the
lookup into the Parameters map in getIdForParam will always fail for an AddRec
whose loop is inside the scop.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170615/ae8dcec9/attachment-0001.html>


More information about the llvm-bugs mailing list