diff --git a/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp b/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp --- a/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp +++ b/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp @@ -1131,6 +1131,7 @@ InstructionCost InterleavedCost; InstructionCost InstructionCost = 0; + const TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency; // Get the interleave factor unsigned Factor = InterleavedLoad.size(); @@ -1158,8 +1159,7 @@ // be expected. Also sum the cost of the Instructions beeing left dead. for (auto &I : Is) { // Compute the old cost - InstructionCost += - TTI.getInstructionCost(I, TargetTransformInfo::TCK_Latency); + InstructionCost += TTI.getInstructionCost(I, CostKind); // The final SVIs are allowed not to be dead, all uses will be replaced if (SVIs.find(I) != SVIs.end()) @@ -1212,7 +1212,7 @@ Indices.push_back(i); InterleavedCost = TTI.getInterleavedMemoryOpCost( Instruction::Load, ILTy, Factor, Indices, InsertionPoint->getAlign(), - InsertionPoint->getPointerAddressSpace()); + InsertionPoint->getPointerAddressSpace(), CostKind); if (InterleavedCost >= InstructionCost) { return false;