From d3368cf5c7a955418e8bff5fc171f98bd7cd7291 Mon Sep 17 00:00:00 2001 From: Raimund Merkert Date: Wed, 13 Nov 2024 08:03:29 -0500 Subject: [PATCH] Handle missing profile stats gracefully instead of asserting. There is a bug #2426, which causes an assertion in the SelingerProfileSipsMetric::getReordering. There is no need to assert, since we can handle the problem gracefully by not reordering atoms. --- src/ast2ram/utility/SipsMetric.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ast2ram/utility/SipsMetric.cpp b/src/ast2ram/utility/SipsMetric.cpp index fb94638d0db..3fe3feb1ebe 100644 --- a/src/ast2ram/utility/SipsMetric.cpp +++ b/src/ast2ram/utility/SipsMetric.cpp @@ -131,7 +131,12 @@ std::vector SelingerProfileSipsMetric::getReordering( auto sccAtoms = filter(ast::getBodyLiterals(*clause), [&](auto* atom) { return contains(sccRelations, program.getRelation(*atom)); }); - assert(profileUseAnalysis->hasAutoSchedulerStats() && "Must have stats in order to auto-schedule!"); + if (!profileUseAnalysis->hasAutoSchedulerStats()) { + std::vector res; + res.resize(atoms.size()); + std::iota(res.begin(), res.end(), 0); + return res; + } auto* prof = profileUseAnalysis; auto getJoinSize = [&prof](bool isRecursive, const std::string& rel, std::set joinKeys,