diff --git a/llvm/lib/Target/AArch64/AArch64Subtarget.h b/llvm/lib/Target/AArch64/AArch64Subtarget.h --- a/llvm/lib/Target/AArch64/AArch64Subtarget.h +++ b/llvm/lib/Target/AArch64/AArch64Subtarget.h @@ -209,9 +209,7 @@ } unsigned getMaxInterleaveFactor() const { return MaxInterleaveFactor; } - unsigned getVectorInsertExtractBaseCost() const { - return VectorInsertExtractBaseCost; - } + unsigned getVectorInsertExtractBaseCost() const; unsigned getCacheLineSize() const override { return CacheLineSize; } unsigned getPrefetchDistance() const override { return PrefetchDistance; } unsigned getMinPrefetchStride(unsigned NumMemAccesses, diff --git a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp --- a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp +++ b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp @@ -52,6 +52,15 @@ static cl::opt UseAA("aarch64-use-aa", cl::init(true), cl::desc("Enable the use of AA during codegen.")); +static cl::opt VectorInsertExtractCostAdjustment( + "aarch64-insert-extract-cost-adjustment", cl::init(0), + cl::desc("Adjustment to base cost of vector insert/extract"), cl::Hidden); + +unsigned AArch64Subtarget::getVectorInsertExtractBaseCost() const { + return std::max(0, static_cast(VectorInsertExtractBaseCost) + + VectorInsertExtractCostAdjustment); +} + AArch64Subtarget &AArch64Subtarget::initializeSubtargetDependencies( StringRef FS, StringRef CPUString, StringRef TuneCPUString) { // Determine default and user-specified characteristics