[all-commits] [llvm/llvm-project] 5b9246: [LV] Fix ScalarIVSteps vplan pattern matcher, remo...

Graham Hunter via All-commits all-commits at lists.llvm.org
Wed May 14 07:01:24 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5b9246517f8f82932f3a171c60b5d656f8f51cb0
      https://github.com/llvm/llvm-project/commit/5b9246517f8f82932f3a171c60b5d656f8f51cb0
  Author: Graham Hunter <graham.hunter at arm.com>
  Date:   2025-05-14 (Wed, 14 May 2025)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
    M llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
    M llvm/unittests/Transforms/Vectorize/CMakeLists.txt
    A llvm/unittests/Transforms/Vectorize/VPlanPatternMatchTest.cpp

  Log Message:
  -----------
  [LV] Fix ScalarIVSteps vplan pattern matcher, remove m_CanonicalIV() (#138298)

783a846 changed VPScalarIVStepsRecipe to take 3 arguments (adding
VF explicitly) instead of 2, but didn't change the corresponding
pattern matcher.

This matcher was only used in vputils::isHeaderMask, and no test
ever reached that function with a ScalarIVSteps recipe for the
value being matched -- it was always a WideCanonicalIV. So the
matcher bailed out immediately before checking arguments and
asserting that the number of arguments in the recipe was the
same provided by the matcher.

Since the constructors for ScalarIVSteps take 3 values, we should
be safe to update the matcher and guard it with a dedicated gtest.

m_CanonicalIV() on the other hand is removed; as a phi recipe it
may not have a consistent number of arguments to match, only
requiring one (the start value) when being constructed with the
assumption that a second incoming value is added for the backedge
later. In order to keep the matcher we would need to add multiple
matchers with different numbers of arguments for it depending on
what phase of vplan construction we were in, and ensure that we
never reorder matcher usage vs. vplan transformation. Since the
main IR PatternMatch.h doesn't contain any matchers for PHI nodes,
I think we can just remove it and match via m_Specific() using the
VPValue we get from Plan.getCanonicalIV().



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