Index: include/llvm/Analysis/TargetTransformInfoImpl.h =================================================================== --- include/llvm/Analysis/TargetTransformInfoImpl.h +++ include/llvm/Analysis/TargetTransformInfoImpl.h @@ -736,6 +736,13 @@ return static_cast(this)->getExtCost(CI, Operands.back()); } + if (const LoadInst *LI = dyn_cast(U)) { + return static_cast(this)->getMemoryOpCost(LI->getOpcode(), + LI->getType(), + LI->getAlignment(), + LI->getPointerAddressSpace(), LI); + } + return static_cast(this)->getOperationCost( Operator::getOpcode(U), U->getType(), U->getNumOperands() == 1 ? U->getOperand(0)->getType() : nullptr);