[all-commits] [llvm/llvm-project] b9c1e1: [LoopIdiomVectorize] Don't add the match-index blo...

Kunal Pathak via All-commits all-commits at lists.llvm.org
Mon Sep 28 12:07:38 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b9c1e19ac6d105ccd98db107716f27e96695625d
      https://github.com/llvm/llvm-project/commit/b9c1e19ac6d105ccd98db107716f27e96695625d
  Author: Kunal Pathak <kunalspathak at hotmail.com>
  Date:   2026-09-28 (Mon, 28 Sep 2026)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoopIdiomVectorize.cpp
    A llvm/test/Transforms/LoopIdiom/AArch64/find-first-byte-nested.ll

  Log Message:
  -----------
  [LoopIdiomVectorize] Don't add the match-index block to the parent loop when it exits (#225576)

`expandFindFirstByte` unconditionally adds BB4, the block that computes
the index of the match, to the parent loop. BB4 branches only to
ExitSucc. When the `find_first_of` idiom is nested inside another loop,
and a match exits that enclosing loop, BB4 always leaves the parent loop
and so is not part of it. `LoopInfo` is then inconsistent, and
`LoopBase::verifyLoop()` fails with `"Loop block has no in-loop
successors!"`.

A release build compiles that check out. It instead crashes later, in a
pass that consumes the stale analysis. IndVarSimplify is the one seen in
practice.

Only add BB4 to the parent loop when the parent loop contains ExitSucc.
The sibling `expandFindMismatch` is unaffected, because its success path
lands in a block split out of the preheader, which is inside the parent
loop already.

This is a regression from #101976. It reproduces from 21.1.0 through
main. It needs `+sve2` in practice, because the expansion is gated on
the cost of `llvm.experimental.vector.match`.

Fixes: https://github.com/llvm/llvm-project/issues/225571

Assisted-by: GPT-5.6



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list