[PATCH] D143437: [llvm] Use pointer index type for more GEP offsets (pre-codegen)
Alexander Richardson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 7 15:38:08 PST 2023
arichardson added a comment.
Thanks for this patch! In the CHERI fork I added a rather ugly workaround in getIngPtrType() for this instead of updating all callers (https://github.com/CTSRD-CHERI/llvm-project/blob/19d402e23fcaa197e1d40547da403dc17e13c7ae/llvm/lib/IR/DataLayout.cpp#L862). I will try applying the patch to CHERI LLVM to see if there are any further places that need updating.
================
Comment at: llvm/include/llvm/IR/IRBuilder.h:572
+ /// offset used to index a pointer in the given address space.
+ IntegerType *getPtrIndexTy(const DataLayout &DL, unsigned AddrSpace = 0) {
+ return DL.getPtrIndexType(Context, AddrSpace);
----------------
I'd suggest removing the default zero here to ensure that callers always pass the address space explicitly.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143437/new/
https://reviews.llvm.org/D143437
More information about the llvm-commits
mailing list