[PATCH] D149889: [TTI] Use users of GEP to guess access type in getGEPCost
Luke Lau via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 4 12:27:36 PDT 2023
luke added inline comments.
================
Comment at: llvm/include/llvm/Analysis/TargetTransformInfo.h:301
+ GEPUser(const Value *User);
+ };
+
----------------
Not overly thrilled with introducing a struct just for this, nor with the constructors. Suggestions are very welcome here
================
Comment at: llvm/lib/Analysis/TargetTransformInfo.cpp:224-255
+TargetTransformInfo::GEPUser::GEPUser(Type *Ty) : AccessType(Ty) {}
+
+TargetTransformInfo::GEPUser::GEPUser(const Value *User) {
+ if (auto *L = dyn_cast<LoadInst>(User))
+ AccessType = L->getType();
+ else if (auto *S = dyn_cast<StoreInst>(User))
+ AccessType = S->getValueOperand()->getType();
----------------
I remember seeing this logic being duplicated in a few places across llvm, earlycse is the first one that comes to mind. It might be worthwhile addressing this in a follow up patch
================
Comment at: llvm/test/Transforms/SLPVectorizer/RISCV/gep.ll:18
+; CHECK-NEXT: [[Q2:%.*]] = getelementptr i8, ptr [[Q]], i32 17
+; CHECK-NEXT: store i8 [[X2]], ptr [[Q2]], align 1
; CHECK-NEXT: ret void
----------------
This is the main result from all the noise in the test cases.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149889/new/
https://reviews.llvm.org/D149889
More information about the llvm-commits
mailing list