[PATCH] D153574: [CostModel] Fix GEP pointer operand in getInstructionCost
Luke Lau via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 22 10:07:17 PDT 2023
luke created this revision.
luke added reviewers: samparker, RKSimon, reames.
Herald added subscribers: asb, pmatos.
Herald added a project: All.
luke requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The current instruction's pointer operand may be different from the one
specified in the Operands argument. We should use the pointer operand
from here instead in case the user has transformed it.
This manifested itself somewhere down the line in
https://reviews.llvm.org/D149889, but I haven't been able to create a
test case on its own yet unfortunately.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D153574
Files:
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
Index: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
===================================================================
--- llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -1130,8 +1130,8 @@
case Instruction::GetElementPtr: {
const auto *GEP = cast<GEPOperator>(U);
return TargetTTI->getGEPCost(GEP->getSourceElementType(),
- GEP->getPointerOperand(),
- Operands.drop_front(), CostKind);
+ Operands.front(), Operands.drop_front(),
+ CostKind);
}
case Instruction::Add:
case Instruction::FAdd:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153574.533676.patch
Type: text/x-patch
Size: 736 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230622/69e9a58b/attachment.bin>
More information about the llvm-commits
mailing list