<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - opt -loop-vectorizer crashes with Assertion `Ingredient2Recipe[I] != nullptr && "Ingredient doesn't have a recipe"' failed"
   href="https://bugs.llvm.org/show_bug.cgi?id=50298">50298</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt -loop-vectorizer crashes with Assertion `Ingredient2Recipe[I] != nullptr && "Ingredient doesn't have a recipe"' failed
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Loop Optimizer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mikael.holmen@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24849" name="attach_24849" title="bbi-55938.ll reproducer">attachment 24849</a> <a href="attachment.cgi?id=24849&action=edit" title="bbi-55938.ll reproducer">[details]</a></span>
bbi-55938.ll reproducer

Reproduce with
 opt -o /dev/null bbi-55938.ll -loop-vectorize

Result:
opt: ../lib/Transforms/Vectorize/VPRecipeBuilder.h:154: llvm::VPRecipeBase
*llvm::VPRecipeBuilder::getRecipe(llvm::Instruction *): Assertion
`Ingredient2Recipe[I] != nullptr && "Ingredient doesn't have a recipe"' failed.
PLEASE submit a bug report to
<a href="https://developer.internal.ericsson.com/docs/bbi/languages/support/">https://developer.internal.ericsson.com/docs/bbi/languages/support/</a> and include
the crash backtrace.
Stack dump:
0.      Program arguments: build-all/bin/opt -o /dev/null bbi-55938.ll
-loop-vectorize
 #0 0x0000000002b598b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(build-all/bin/opt+0x2b598b8)
 #1 0x0000000002b5756e llvm::sys::RunSignalHandlers()
(build-all/bin/opt+0x2b5756e)
 #2 0x0000000002b5a096 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f2d4bdf8630 __restore_rt sigaction.c:0:0
 #4 0x00007f2d4952b387 raise (/lib64/libc.so.6+0x36387)
 #5 0x00007f2d4952ca78 abort (/lib64/libc.so.6+0x37a78)
 #6 0x00007f2d495241a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
 #7 0x00007f2d49524252 (/lib64/libc.so.6+0x2f252)
 #8 0x0000000002d20576 llvm::VPRecipeBuilder::getRecipe(llvm::Instruction*)
crtstuff.c:0:0
 #9 0x0000000002d20269 llvm::VPRecipeBuilder::fixHeaderPhis()
(build-all/bin/opt+0x2d20269)
#10 0x0000000002d23d60
llvm::LoopVectorizationPlanner::buildVPlanWithVPRecipes(llvm::VFRange&,
llvm::SmallPtrSetImpl<llvm::Instruction*>&, llvm::DenseMap<llvm::Instruction*,
llvm::Instruction*, llvm::DenseMapInfo<llvm::Instruction*>,
llvm::detail::DenseMapPair<llvm::Instruction*, llvm::Instruction*> > const&)
(build-all/bin/opt+0x2d23d60)
#11 0x0000000002d1aa0a
llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount,
llvm::ElementCount) (build-all/bin/opt+0x2d1aa0a)
#12 0x0000000002d19c1d llvm::LoopVectorizationPlanner::plan(llvm::ElementCount,
unsigned int) (build-all/bin/opt+0x2d19c1d)
#13 0x0000000002d29d7d llvm::LoopVectorizePass::processLoop(llvm::Loop*)
(build-all/bin/opt+0x2d29d7d)
#14 0x0000000002d2e9e2 llvm::LoopVectorizePass::runImpl(llvm::Function&,
llvm::ScalarEvolution&, llvm::LoopInfo&, llvm::TargetTransformInfo&,
llvm::DominatorTree&, llvm::BlockFrequencyInfo&, llvm::TargetLibraryInfo*,
llvm::DemandedBits&, llvm::AAResults&, llvm::AssumptionCache&,
std::function<llvm::LoopAccessInfo const& (llvm::Loop&)>&,
llvm::OptimizationRemarkEmitter&, llvm::ProfileSummaryInfo*)
(build-all/bin/opt+0x2d2e9e2)
#15 0x0000000002d2f571 llvm::LoopVectorizePass::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&) (build-all/bin/opt+0x2d2f571)
#16 0x0000000002e364ed llvm::detail::PassModel<llvm::Function,
llvm::LoopVectorizePass, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&) crtstuff.c:0:0
#17 0x00000000023854d9 llvm::PassManager<llvm::Function,
llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&,
llvm::AnalysisManager<llvm::Function>&) (build-all/bin/opt+0x23854d9)
#18 0x0000000000c39c0d llvm::detail::PassModel<llvm::Function,
llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function> >,
llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function>
<span class="quote">>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) crtstuff.c:0:0</span >
#19 0x00000000023897b6 llvm::ModuleToFunctionPassAdaptor::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0x23897b6)
#20 0x000000000077f0dd llvm::detail::PassModel<llvm::Module,
llvm::ModuleToFunctionPassAdaptor, llvm::PreservedAnalyses,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&) crtstuff.c:0:0
#21 0x000000000238433b llvm::PassManager<llvm::Module,
llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&,
llvm::AnalysisManager<llvm::Module>&) (build-all/bin/opt+0x238433b)
#22 0x0000000000777f4d llvm::runPassPipeline(llvm::StringRef, llvm::Module&,
llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*,
llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef,
llvm::ArrayRef<llvm::StringRef>, llvm::opt_tool::OutputKind,
llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool)
(build-all/bin/opt+0x777f4d)
#23 0x0000000000788f06 main (build-all/bin/opt+0x788f06)
#24 0x00007f2d49517555 __libc_start_main (/lib64/libc.so.6+0x22555)
#25 0x0000000000772e00 _start (build-all/bin/opt+0x772e00)
Abort


This starts happening with commit 4ba8720f8844:

    [VPlan] Representing backedge def-use feeding reduction phis.

    This patch updates the code handling reduction recipes to also keep
    track of the incoming value from the latch in the recipe. This is needed
    to model the def-use chains completely in VPlan, so that it is possible
    to replace the incoming value with an arbitrary VPValue.

    Reviewed By: Ayal

    Differential Revision: <a href="https://reviews.llvm.org/D99294">https://reviews.llvm.org/D99294</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>