Skip to content

[LV][VPlan] Remove any-of reduction from precomputeCost. NFC #117109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

ElvisWang123
Copy link
Contributor

The any-of reduction contains phi and select instructions.

The select instruction might be optimized and removed in the vplan which may cause VF difference between legacy and VPlan-based model. But if the select instruction be removed, planContainsAdditionalSimplifications() will catch it and disable the assertion.

Therefore, we can just remove the ayn-of reduction calculation in the precomputeCost().

The any-of reduction contains phi and select instructions. The select
instruction might be optimized and removed in the vplan which may cause
VF difference between legacy and VPlan-based model. But if the select
instruction be removed, `planContainsAdditionalSimplifications()` will
catch it and disable the assertion.

Therefore, we can just remove the ayn-of reduction calculation in the
precomputeCost().
@llvmbot
Copy link
Member

llvmbot commented Nov 21, 2024

@llvm/pr-subscribers-vectorizers

@llvm/pr-subscribers-llvm-transforms

Author: Elvis Wang (ElvisWang123)

Changes

The any-of reduction contains phi and select instructions.

The select instruction might be optimized and removed in the vplan which may cause VF difference between legacy and VPlan-based model. But if the select instruction be removed, planContainsAdditionalSimplifications() will catch it and disable the assertion.

Therefore, we can just remove the ayn-of reduction calculation in the precomputeCost().


Full diff: https://github.com/llvm/llvm-project/pull/117109.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/Vectorize/LoopVectorize.cpp (+2-22)
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 1ebc62f9843905..e2b76948cb6b19 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -7278,34 +7278,14 @@ LoopVectorizationPlanner::precomputeCosts(VPlan &Plan, ElementCount VF,
 
   // The legacy cost model has special logic to compute the cost of in-loop
   // reductions, which may be smaller than the sum of all instructions involved
-  // in the reduction. For AnyOf reductions, VPlan codegen may remove the select
-  // which the legacy cost model uses to assign cost. Pre-compute their costs
-  // for now.
+  // in the reduction.
   // TODO: Switch to costing based on VPlan once the logic has been ported.
   for (const auto &[RedPhi, RdxDesc] : Legal->getReductionVars()) {
     if (ForceTargetInstructionCost.getNumOccurrences())
       continue;
 
-    if (!CM.isInLoopReduction(RedPhi) &&
-        !RecurrenceDescriptor::isAnyOfRecurrenceKind(
-            RdxDesc.getRecurrenceKind()))
-      continue;
-
-    // AnyOf reduction codegen may remove the select. To match the legacy cost
-    // model, pre-compute the cost for AnyOf reductions here.
-    if (RecurrenceDescriptor::isAnyOfRecurrenceKind(
-            RdxDesc.getRecurrenceKind())) {
-      auto *Select = cast<SelectInst>(*find_if(
-          RedPhi->users(), [](User *U) { return isa<SelectInst>(U); }));
-      assert(!CostCtx.SkipCostComputation.contains(Select) &&
-             "reduction op visited multiple times");
-      CostCtx.SkipCostComputation.insert(Select);
-      auto ReductionCost = CostCtx.getLegacyCost(Select, VF);
-      LLVM_DEBUG(dbgs() << "Cost of " << ReductionCost << " for VF " << VF
-                        << ":\n any-of reduction " << *Select << "\n");
-      Cost += ReductionCost;
+    if (!CM.isInLoopReduction(RedPhi))
       continue;
-    }
 
     const auto &ChainOps = RdxDesc.getReductionOpChain(RedPhi, OrigLoop);
     SetVector<Instruction *> ChainOpsAndOperands(ChainOps.begin(),

Copy link
Contributor

@fhahn fhahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@ElvisWang123 ElvisWang123 merged commit ce66b56 into llvm:main Nov 22, 2024
11 checks passed
@ElvisWang123 ElvisWang123 deleted the impl-any-of-reduction-vplan branch November 22, 2024 02:48
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 22, 2024

LLVM Buildbot has detected a new failure on builder ml-opt-dev-x86-64 running on ml-opt-dev-x86-64-b2 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/137/builds/9080

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Transforms/LoopVectorize/AArch64/select-costs.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /b/ml-opt-dev-x86-64-b1/build/bin/opt < /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S 2>&1 | /b/ml-opt-dev-x86-64-b1/build/bin/FileCheck /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
+ /b/ml-opt-dev-x86-64-b1/build/bin/opt -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S
+ /b/ml-opt-dev-x86-64-b1/build/bin/FileCheck /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
/b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll:54:10: error: CHECK: expected string not found in input
; CHECK: any-of reduction %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
         ^
<stdin>:806:21: note: scanning from here
Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
                    ^
<stdin>:832:47: note: possible intended match here
LV: Found an estimated cost of 1 for VF 1 For instruction: %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
                                              ^

Input file: <stdin>
Check file: /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
          801: Cost of 0 for VF 8: EMIT vp<%7> = or ir<%all.off.next>, vp<%6> 
          802: Cost of 0 for VF 8: EMIT vp<%index.next> = add nuw vp<%2>, vp<%0> 
          803: Cost of 0 for VF 8: EMIT branch-on-count vp<%index.next>, vp<%1> 
          804: Cost of 0 for VF 8: vector loop backedge 
          805: Cost for VF 8: 6 (Estimated cost per lane: 0.8) 
          806: Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 
check:54'0                         X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
          807: Cost of 0 for VF 16: induction instruction %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          808: Cost of 1 for VF 16: exit condition instruction %exitcond.not = icmp eq i64 %indvars.iv.next, %n 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          809: Cost of 0 for VF 16: forced scalar %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          810: Cost of 0 for VF 16: EMIT vp<%2> = CANONICAL-INDUCTION ir<0>, vp<%index.next> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          811: Cost of 0 for VF 16: WIDEN-REDUCTION-PHI ir<%all.off.next> = phi ir<false>, vp<%7> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
          827: LV: Found an estimated cost of 0 for VF 1 For instruction: %any.0.off09 = phi i1 [ false, %entry ], [ %.any.0.off0, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 22, 2024

LLVM Buildbot has detected a new failure on builder ml-opt-rel-x86-64 running on ml-opt-rel-x86-64-b2 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/185/builds/8966

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Transforms/LoopVectorize/AArch64/select-costs.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /b/ml-opt-rel-x86-64-b1/build/bin/opt < /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S 2>&1 | /b/ml-opt-rel-x86-64-b1/build/bin/FileCheck /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
+ /b/ml-opt-rel-x86-64-b1/build/bin/opt -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S
+ /b/ml-opt-rel-x86-64-b1/build/bin/FileCheck /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
/b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll:54:10: error: CHECK: expected string not found in input
; CHECK: any-of reduction %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
         ^
<stdin>:806:21: note: scanning from here
Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
                    ^
<stdin>:832:47: note: possible intended match here
LV: Found an estimated cost of 1 for VF 1 For instruction: %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
                                              ^

Input file: <stdin>
Check file: /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
          801: Cost of 0 for VF 8: EMIT vp<%7> = or ir<%all.off.next>, vp<%6> 
          802: Cost of 0 for VF 8: EMIT vp<%index.next> = add nuw vp<%2>, vp<%0> 
          803: Cost of 0 for VF 8: EMIT branch-on-count vp<%index.next>, vp<%1> 
          804: Cost of 0 for VF 8: vector loop backedge 
          805: Cost for VF 8: 6 (Estimated cost per lane: 0.8) 
          806: Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 
check:54'0                         X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
          807: Cost of 0 for VF 16: induction instruction %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          808: Cost of 1 for VF 16: exit condition instruction %exitcond.not = icmp eq i64 %indvars.iv.next, %n 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          809: Cost of 0 for VF 16: forced scalar %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          810: Cost of 0 for VF 16: EMIT vp<%2> = CANONICAL-INDUCTION ir<0>, vp<%index.next> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          811: Cost of 0 for VF 16: WIDEN-REDUCTION-PHI ir<%all.off.next> = phi ir<false>, vp<%7> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
          827: LV: Found an estimated cost of 0 for VF 1 For instruction: %any.0.off09 = phi i1 [ false, %entry ], [ %.any.0.off0, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 22, 2024

LLVM Buildbot has detected a new failure on builder clang-aarch64-quick running on linaro-clang-aarch64-quick while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/8196

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: Transforms/LoopVectorize/AArch64/select-costs.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/opt < /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S 2>&1 | /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
+ /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/opt -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S
+ /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll:54:10: error: CHECK: expected string not found in input
; CHECK: any-of reduction %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
         ^
<stdin>:806:21: note: scanning from here
Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
                    ^
<stdin>:832:47: note: possible intended match here
LV: Found an estimated cost of 1 for VF 1 For instruction: %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
                                              ^

Input file: <stdin>
Check file: /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
          801: Cost of 0 for VF 8: EMIT vp<%7> = or ir<%all.off.next>, vp<%6> 
          802: Cost of 0 for VF 8: EMIT vp<%index.next> = add nuw vp<%2>, vp<%0> 
          803: Cost of 0 for VF 8: EMIT branch-on-count vp<%index.next>, vp<%1> 
          804: Cost of 0 for VF 8: vector loop backedge 
          805: Cost for VF 8: 6 (Estimated cost per lane: 0.8) 
          806: Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 
check:54'0                         X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
          807: Cost of 0 for VF 16: induction instruction %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          808: Cost of 1 for VF 16: exit condition instruction %exitcond.not = icmp eq i64 %indvars.iv.next, %n 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          809: Cost of 0 for VF 16: forced scalar %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          810: Cost of 0 for VF 16: EMIT vp<%2> = CANONICAL-INDUCTION ir<0>, vp<%index.next> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          811: Cost of 0 for VF 16: WIDEN-REDUCTION-PHI ir<%all.off.next> = phi ir<false>, vp<%7> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
          827: LV: Found an estimated cost of 0 for VF 1 For instruction: %any.0.off09 = phi i1 [ false, %entry ], [ %.any.0.off0, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 22, 2024

LLVM Buildbot has detected a new failure on builder llvm-clang-aarch64-darwin running on doug-worker-5 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/9989

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Transforms/LoopVectorize/AArch64/select-costs.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/opt < /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S 2>&1 | /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/opt -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
�[1m/Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll:54:10: �[0m�[0;1;31merror: �[0m�[1mCHECK: expected string not found in input
�[0m; CHECK: any-of reduction %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
�[0;1;32m         ^
�[0m�[1m<stdin>:806:21: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0mCost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
�[0;1;32m                    ^
�[0m�[1m<stdin>:832:47: �[0m�[0;1;30mnote: �[0m�[1mpossible intended match here
�[0mLV: Found an estimated cost of 1 for VF 1 For instruction: %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
�[0;1;32m                                              ^
�[0m
Input file: <stdin>
Check file: /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
�[1m�[0m�[0;1;30m            1: �[0m�[1m�[0;1;46m �[0m
�[0;1;30m            2: �[0m�[1m�[0;1;46m�[0mLV: Checking a loop in 'selects_1'�[0;1;46m from <stdin> �[0m
�[0;1;32mcheck:8        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
�[0m�[0;1;30m            3: �[0m�[1m�[0;1;46mLV: Loop hints: force=? width=0 interleave=0 �[0m
�[0;1;30m            4: �[0m�[1m�[0;1;46mLV: Found a loop: for.body �[0m
�[0;1;30m            5: �[0m�[1m�[0;1;46mLV: Found an induction variable. �[0m
�[0;1;30m            6: �[0m�[1m�[0;1;46mLV: We can vectorize this loop! �[0m
�[0;1;30m            7: �[0m�[1m�[0;1;46mLV: Loop does not require scalar epilogue �[0m
�[0;1;30m            8: �[0m�[1m�[0;1;46mLV: Found trip count: 0 �[0m
�[0;1;30m            9: �[0m�[1m�[0;1;46mLV: Found maximum trip count: 2147483647 �[0m
�[0;1;30m           10: �[0m�[1m�[0;1;46mLV: The max safe fixed VF is: 67108864. �[0m
�[0;1;30m           11: �[0m�[1m�[0;1;46mLV: The max safe scalable VF is: vscale x 0. �[0m
�[0;1;30m           12: �[0m�[1m�[0;1;46mLV: The Smallest and Widest types: 32 / 32 bits. �[0m
�[0;1;30m           13: �[0m�[1m�[0;1;46mLV: The Widest register safe to use is: 128 bits. �[0m
�[0;1;30m           14: �[0m�[1m�[0;1;46mLV: Loop does not require scalar epilogue �[0m
�[0;1;30m           15: �[0m�[1m�[0;1;46mLV(REG): Calculating max register usage: �[0m
�[0;1;30m           16: �[0m�[1m�[0;1;46mLV(REG): At #0 Interval # 0 �[0m
�[0;1;30m           17: �[0m�[1m�[0;1;46mLV(REG): At #1 Interval # 1 �[0m
�[0;1;30m           18: �[0m�[1m�[0;1;46mLV(REG): At #2 Interval # 2 �[0m
�[0;1;30m           19: �[0m�[1m�[0;1;46mLV(REG): At #3 Interval # 3 �[0m
�[0;1;30m           20: �[0m�[1m�[0;1;46mLV(REG): At #4 Interval # 3 �[0m
�[0;1;30m           21: �[0m�[1m�[0;1;46mLV(REG): At #5 Interval # 4 �[0m
�[0;1;30m           22: �[0m�[1m�[0;1;46mLV(REG): At #6 Interval # 4 �[0m
�[0;1;30m           23: �[0m�[1m�[0;1;46mLV(REG): At #7 Interval # 5 �[0m
�[0;1;30m           24: �[0m�[1m�[0;1;46mLV(REG): At #8 Interval # 4 �[0m
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 22, 2024

LLVM Buildbot has detected a new failure on builder ml-opt-devrel-x86-64 running on ml-opt-devrel-x86-64-b1 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/175/builds/8968

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Transforms/LoopVectorize/AArch64/select-costs.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /b/ml-opt-devrel-x86-64-b1/build/bin/opt < /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S 2>&1 | /b/ml-opt-devrel-x86-64-b1/build/bin/FileCheck /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
+ /b/ml-opt-devrel-x86-64-b1/build/bin/FileCheck /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
+ /b/ml-opt-devrel-x86-64-b1/build/bin/opt -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S
/b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll:54:10: error: CHECK: expected string not found in input
; CHECK: any-of reduction %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
         ^
<stdin>:806:21: note: scanning from here
Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
                    ^
<stdin>:832:47: note: possible intended match here
LV: Found an estimated cost of 1 for VF 1 For instruction: %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
                                              ^

Input file: <stdin>
Check file: /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
          801: Cost of 0 for VF 8: EMIT vp<%7> = or ir<%all.off.next>, vp<%6> 
          802: Cost of 0 for VF 8: EMIT vp<%index.next> = add nuw vp<%2>, vp<%0> 
          803: Cost of 0 for VF 8: EMIT branch-on-count vp<%index.next>, vp<%1> 
          804: Cost of 0 for VF 8: vector loop backedge 
          805: Cost for VF 8: 6 (Estimated cost per lane: 0.8) 
          806: Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 
check:54'0                         X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
          807: Cost of 0 for VF 16: induction instruction %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          808: Cost of 1 for VF 16: exit condition instruction %exitcond.not = icmp eq i64 %indvars.iv.next, %n 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          809: Cost of 0 for VF 16: forced scalar %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          810: Cost of 0 for VF 16: EMIT vp<%2> = CANONICAL-INDUCTION ir<0>, vp<%index.next> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          811: Cost of 0 for VF 16: WIDEN-REDUCTION-PHI ir<%all.off.next> = phi ir<false>, vp<%7> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
          827: LV: Found an estimated cost of 0 for VF 1 For instruction: %any.0.off09 = phi i1 [ false, %entry ], [ %.any.0.off0, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 22, 2024

LLVM Buildbot has detected a new failure on builder clang-debian-cpp20 running on clang-debian-cpp20 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/108/builds/6249

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Transforms/LoopVectorize/AArch64/select-costs.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/opt < /vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S 2>&1 | /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/FileCheck /vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
+ /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/opt -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S
+ /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/FileCheck /vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
/vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll:54:10: error: CHECK: expected string not found in input
; CHECK: any-of reduction %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
         ^
<stdin>:806:21: note: scanning from here
Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
                    ^
<stdin>:832:47: note: possible intended match here
LV: Found an estimated cost of 1 for VF 1 For instruction: %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
                                              ^

Input file: <stdin>
Check file: /vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
          801: Cost of 0 for VF 8: EMIT vp<%7> = or ir<%all.off.next>, vp<%6> 
          802: Cost of 0 for VF 8: EMIT vp<%index.next> = add nuw vp<%2>, vp<%0> 
          803: Cost of 0 for VF 8: EMIT branch-on-count vp<%index.next>, vp<%1> 
          804: Cost of 0 for VF 8: vector loop backedge 
          805: Cost for VF 8: 6 (Estimated cost per lane: 0.8) 
          806: Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 
check:54'0                         X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
          807: Cost of 0 for VF 16: induction instruction %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          808: Cost of 1 for VF 16: exit condition instruction %exitcond.not = icmp eq i64 %indvars.iv.next, %n 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          809: Cost of 0 for VF 16: forced scalar %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          810: Cost of 0 for VF 16: EMIT vp<%2> = CANONICAL-INDUCTION ir<0>, vp<%index.next> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          811: Cost of 0 for VF 16: WIDEN-REDUCTION-PHI ir<%all.off.next> = phi ir<false>, vp<%7> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
          827: LV: Found an estimated cost of 0 for VF 1 For instruction: %any.0.off09 = phi i1 [ false, %entry ], [ %.any.0.off0, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...

ElvisWang123 added a commit that referenced this pull request Nov 22, 2024
@ElvisWang123 ElvisWang123 restored the impl-any-of-reduction-vplan branch November 22, 2024 04:02
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 22, 2024

LLVM Buildbot has detected a new failure on builder lld-x86_64-ubuntu-fast running on as-builder-4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/33/builds/6980

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Transforms/LoopVectorize/AArch64/select-costs.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/opt < /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S 2>&1 | /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
+ /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/opt -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S
+ /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/bin/FileCheck /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll:54:10: error: CHECK: expected string not found in input
; CHECK: any-of reduction %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
         ^
<stdin>:806:21: note: scanning from here
Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
                    ^
<stdin>:832:47: note: possible intended match here
LV: Found an estimated cost of 1 for VF 1 For instruction: %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
                                              ^

Input file: <stdin>
Check file: /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
          801: Cost of 0 for VF 8: EMIT vp<%7> = or ir<%all.off.next>, vp<%6> 
          802: Cost of 0 for VF 8: EMIT vp<%index.next> = add nuw vp<%2>, vp<%0> 
          803: Cost of 0 for VF 8: EMIT branch-on-count vp<%index.next>, vp<%1> 
          804: Cost of 0 for VF 8: vector loop backedge 
          805: Cost for VF 8: 6 (Estimated cost per lane: 0.8) 
          806: Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 
check:54'0                         X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
          807: Cost of 0 for VF 16: induction instruction %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          808: Cost of 1 for VF 16: exit condition instruction %exitcond.not = icmp eq i64 %indvars.iv.next, %n 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          809: Cost of 0 for VF 16: forced scalar %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          810: Cost of 0 for VF 16: EMIT vp<%2> = CANONICAL-INDUCTION ir<0>, vp<%index.next> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          811: Cost of 0 for VF 16: WIDEN-REDUCTION-PHI ir<%all.off.next> = phi ir<false>, vp<%7> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
          827: LV: Found an estimated cost of 0 for VF 1 For instruction: %any.0.off09 = phi i1 [ false, %entry ], [ %.any.0.off0, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 22, 2024

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-expensive-checks-debian running on gribozavr4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/16/builds/9385

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Transforms/LoopVectorize/AArch64/select-costs.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/opt < /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S 2>&1 | /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/FileCheck /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
+ /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/opt -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S
+ /b/1/llvm-clang-x86_64-expensive-checks-debian/build/bin/FileCheck /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
/b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll:54:10: error: CHECK: expected string not found in input
; CHECK: any-of reduction %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
         ^
<stdin>:806:21: note: scanning from here
Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
                    ^
<stdin>:832:47: note: possible intended match here
LV: Found an estimated cost of 1 for VF 1 For instruction: %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
                                              ^

Input file: <stdin>
Check file: /b/1/llvm-clang-x86_64-expensive-checks-debian/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
          801: Cost of 0 for VF 8: EMIT vp<%7> = or ir<%all.off.next>, vp<%6> 
          802: Cost of 0 for VF 8: EMIT vp<%index.next> = add nuw vp<%2>, vp<%0> 
          803: Cost of 0 for VF 8: EMIT branch-on-count vp<%index.next>, vp<%1> 
          804: Cost of 0 for VF 8: vector loop backedge 
          805: Cost for VF 8: 6 (Estimated cost per lane: 0.8) 
          806: Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 
check:54'0                         X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
          807: Cost of 0 for VF 16: induction instruction %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          808: Cost of 1 for VF 16: exit condition instruction %exitcond.not = icmp eq i64 %indvars.iv.next, %n 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          809: Cost of 0 for VF 16: forced scalar %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          810: Cost of 0 for VF 16: EMIT vp<%2> = CANONICAL-INDUCTION ir<0>, vp<%index.next> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          811: Cost of 0 for VF 16: WIDEN-REDUCTION-PHI ir<%all.off.next> = phi ir<false>, vp<%7> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
          827: LV: Found an estimated cost of 0 for VF 1 For instruction: %any.0.off09 = phi i1 [ false, %entry ], [ %.any.0.off0, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 22, 2024

LLVM Buildbot has detected a new failure on builder llvm-x86_64-debian-dylib running on gribozavr4 while building llvm at step 7 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/60/builds/13412

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: Transforms/LoopVectorize/AArch64/select-costs.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /b/1/llvm-x86_64-debian-dylib/build/bin/opt < /b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S 2>&1 | /b/1/llvm-x86_64-debian-dylib/build/bin/FileCheck /b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
+ /b/1/llvm-x86_64-debian-dylib/build/bin/opt -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S
+ /b/1/llvm-x86_64-debian-dylib/build/bin/FileCheck /b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll:54:10: error: CHECK: expected string not found in input
; CHECK: any-of reduction %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
         ^
<stdin>:806:21: note: scanning from here
Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
                    ^
<stdin>:832:47: note: possible intended match here
LV: Found an estimated cost of 1 for VF 1 For instruction: %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
                                              ^

Input file: <stdin>
Check file: /b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
          801: Cost of 0 for VF 8: EMIT vp<%7> = or ir<%all.off.next>, vp<%6> 
          802: Cost of 0 for VF 8: EMIT vp<%index.next> = add nuw vp<%2>, vp<%0> 
          803: Cost of 0 for VF 8: EMIT branch-on-count vp<%index.next>, vp<%1> 
          804: Cost of 0 for VF 8: vector loop backedge 
          805: Cost for VF 8: 6 (Estimated cost per lane: 0.8) 
          806: Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 
check:54'0                         X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
          807: Cost of 0 for VF 16: induction instruction %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          808: Cost of 1 for VF 16: exit condition instruction %exitcond.not = icmp eq i64 %indvars.iv.next, %n 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          809: Cost of 0 for VF 16: forced scalar %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          810: Cost of 0 for VF 16: EMIT vp<%2> = CANONICAL-INDUCTION ir<0>, vp<%index.next> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          811: Cost of 0 for VF 16: WIDEN-REDUCTION-PHI ir<%all.off.next> = phi ir<false>, vp<%7> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
          827: LV: Found an estimated cost of 0 for VF 1 For instruction: %any.0.off09 = phi i1 [ false, %entry ], [ %.any.0.off0, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 22, 2024

LLVM Buildbot has detected a new failure on builder clang-x86_64-debian-fast running on gribozavr4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/56/builds/12827

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: Transforms/LoopVectorize/AArch64/select-costs.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: /b/1/clang-x86_64-debian-fast/llvm.obj/bin/opt < /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S 2>&1 | /b/1/clang-x86_64-debian-fast/llvm.obj/bin/FileCheck /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/opt -passes=loop-vectorize -debug-only=loop-vectorize -disable-output -S
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/FileCheck /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll
/b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll:54:10: error: CHECK: expected string not found in input
; CHECK: any-of reduction %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
         ^
<stdin>:806:21: note: scanning from here
Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
                    ^
<stdin>:832:47: note: possible intended match here
LV: Found an estimated cost of 1 for VF 1 For instruction: %all.off = select i1 %cmp1, i1 %all.off.next, i1 false
                                              ^

Input file: <stdin>
Check file: /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/Transforms/LoopVectorize/AArch64/select-costs.ll

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
          801: Cost of 0 for VF 8: EMIT vp<%7> = or ir<%all.off.next>, vp<%6> 
          802: Cost of 0 for VF 8: EMIT vp<%index.next> = add nuw vp<%2>, vp<%0> 
          803: Cost of 0 for VF 8: EMIT branch-on-count vp<%index.next>, vp<%1> 
          804: Cost of 0 for VF 8: vector loop backedge 
          805: Cost for VF 8: 6 (Estimated cost per lane: 0.8) 
          806: Cost of 1 for VF 16: induction instruction %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 
check:54'0                         X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
          807: Cost of 0 for VF 16: induction instruction %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          808: Cost of 1 for VF 16: exit condition instruction %exitcond.not = icmp eq i64 %indvars.iv.next, %n 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          809: Cost of 0 for VF 16: forced scalar %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          810: Cost of 0 for VF 16: EMIT vp<%2> = CANONICAL-INDUCTION ir<0>, vp<%index.next> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          811: Cost of 0 for VF 16: WIDEN-REDUCTION-PHI ir<%all.off.next> = phi ir<false>, vp<%7> 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            .
            .
            .
          827: LV: Found an estimated cost of 0 for VF 1 For instruction: %any.0.off09 = phi i1 [ false, %entry ], [ %.any.0.off0, %for.body ] 
check:54'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...

ElvisWang123 added a commit that referenced this pull request Nov 28, 2024
#117109)" (#117289)

Update the test cases contains `any-of` printings from the
precomputeCost().

Origin message: 

The any-of reduction contains phi and select instructions.

The select instruction might be optimized and removed in the vplan which
may cause VF difference between legacy and VPlan-based model. But if the
select instruction be removed, planContainsAdditionalSimplifications()
will catch it and disable the assertion.

Therefore, we can just remove the ayn-of reduction calculation in the
precomputeCost().



Recommit "[LV][VPlan] Remove any-of reduction from precomputeCost. NFC
(#117109)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants