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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 01:30:17 PDT 2026


================
@@ -0,0 +1,408 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
+; RUN: opt -mtriple=aarch64 -mattr=+sve -passes='loop(loop-idiom-vectorize)' -verify-loop-info -verify-dom-info -S < %s | FileCheck %s
+; RUN: opt -mtriple=aarch64 -mattr=+sve -passes='loop(loop-idiom-vectorize),verify<loops>,print<loops>' -disable-output < %s 2>&1 | FileCheck %s --check-prefix=LOOPS
+
+; Where the expansion's new blocks land in the loop nest. %calculate_match
+; computes the match index and branches only to the successful exit, so it
+; belongs to whichever loop holds that exit: no loop in the first function,
+; the parent in the second, the grandparent but NOT the parent in the third.
+; LOOPS-LABEL: Loop info for function 'find_first_of_i8_nested_exit_outside':
+; LOOPS-NEXT: Loop at depth 1 containing: %outer.header<header>,%search.header,%needle.header<exiting>,%needle.latch,%search.latch,%outer.latch<latch>,%scalar_preheader,%mem_check,%find_first_vec_header,%match_check_vec<exiting>,%search_check_vec,%needle_check_vec
----------------
david-arm wrote:

It's really strange that both `find_first_of_i8_nested_exit_outside` and `find_first_of_i8_nested_exit_inside` only appear to have one loop?

https://github.com/llvm/llvm-project/pull/225576


More information about the llvm-commits mailing list