Skip to content

Commit 6e41180

Browse files
committed
[LV] Fix missing precomptueCosts() in emitInvalidCostRemarks().
We should always update the SkipComputation set in VPCostContext before VPlan.cost(). This patch prevent assertion of in-loop reduction in the `VPReductionRecipe::computeCost()` and other potentail assertions of partially implemented VPlan-based cost model.
1 parent 3243e3d commit 6e41180

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4363,6 +4363,7 @@ void LoopVectorizationPlanner::emitInvalidCostRemarks(
43634363
for (ElementCount VF : Plan->vectorFactors()) {
43644364
VPCostContext CostCtx(CM.TTI, *CM.TLI, Legal->getWidestInductionType(),
43654365
CM);
4366+
precomputeCosts(*Plan, VF, CostCtx);
43664367
auto Iter = vp_depth_first_deep(Plan->getVectorLoopRegion()->getEntry());
43674368
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(Iter)) {
43684369
for (auto &R : *VPBB) {

llvm/test/Transforms/LoopVectorize/reduction-inloop.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
22
; RUN: opt < %s -passes=loop-vectorize,dce,instcombine -force-vector-interleave=1 -force-vector-width=4 -prefer-inloop-reductions -S | FileCheck %s
3+
; Check remark analysis runs successfully.
4+
; RUN: opt < %s -passes=loop-vectorize,dce,instcombine -force-vector-interleave=1 -force-vector-width=4 -prefer-inloop-reductions -pass-remarks-analysis=loop-vectorize -S
35

46
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
57

0 commit comments

Comments
 (0)