mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[LV] Don't let ForceTargetInstructionCost override Invalid cost.
Invalid costs can be used to avoid vectorization with a given VF, which is used for scalable vectors to avoid things that the code-generator cannot handle. If we override the cost using the -force-target-instruction-cost option of the LV, we would override this mechanism, rendering the flag useless. This change ensures the cost is only overriden when the original cost that was calculated is valid. That allows the flag to be used in combination with the -scalable-vectorization option. Reviewed By: david-arm Differential Revision: https://reviews.llvm.org/D106677
This commit is contained in:
parent
bb39cd345a
commit
4f1b8e266e
@ -6887,7 +6887,8 @@ LoopVectorizationCostModel::expectedCost(
|
||||
VectorizationCostTy C = getInstructionCost(&I, VF);
|
||||
|
||||
// Check if we should override the cost.
|
||||
if (ForceTargetInstructionCost.getNumOccurrences() > 0)
|
||||
if (C.first.isValid() &&
|
||||
ForceTargetInstructionCost.getNumOccurrences() > 0)
|
||||
C.first = InstructionCost(ForceTargetInstructionCost);
|
||||
|
||||
// Keep a list of instructions with invalid costs.
|
||||
|
@ -1,6 +1,9 @@
|
||||
; RUN: opt -S -loop-vectorize -force-vector-interleave=1 -instcombine -mattr=+sve -mtriple aarch64-unknown-linux-gnu -scalable-vectorization=on \
|
||||
; RUN: -pass-remarks-missed=loop-vectorize < %s 2>%t | FileCheck %s
|
||||
; RUN: cat %t | FileCheck %s --check-prefix=CHECK-REMARKS
|
||||
; RUN: opt -S -loop-vectorize -force-vector-interleave=1 -force-target-instruction-cost=1 -instcombine -mattr=+sve -mtriple aarch64-unknown-linux-gnu \
|
||||
; RUN: -scalable-vectorization=on -pass-remarks-missed=loop-vectorize < %s 2>%t | FileCheck %s
|
||||
; RUN: cat %t | FileCheck %s --check-prefix=CHECK-REMARKS
|
||||
|
||||
define void @vec_load(i64 %N, double* nocapture %a, double* nocapture readonly %b) {
|
||||
; CHECK-LABEL: @vec_load
|
||||
|
Loading…
Reference in New Issue
Block a user