[PATCH] D143437: [llvm] Use pointer index type for more GEP offsets (pre-codegen)

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 10 11:38:39 PST 2023


arsenm added inline comments.


================
Comment at: llvm/include/llvm-c/Target.h:249
+    See the method llvm::DataLayout::getPtrIndexType. */
+LLVMTypeRef LLVMPtrIndexType(LLVMTargetDataRef TD);
+
----------------
Adding new stuff to the C API should be done separately and should get unit tests 


================
Comment at: llvm/lib/IR/DataLayout.cpp:866
+                                         unsigned AddressSpace) const {
+  return IntegerType::get(C, getIndexSizeInBits(AddressSpace));
+}
----------------
Can this just be inline in the header?


================
Comment at: llvm/lib/Transforms/Scalar/NaryReassociate.cpp:355
+  unsigned IndexSizeInBits =
+      DL->getIndexSizeInBits(GEP->getType()->getPointerAddressSpace());
+  return cast<IntegerType>(Index->getType())->getBitWidth() < IndexSizeInBits;
----------------
nary reassociate not tested


================
Comment at: llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:694
+          cast<GetElementPtrInst>(Basis.Ins)->getResultElementType(), Basis.Ins,
+          Bump, "", InBounds);
+    }
----------------
slsr not tested


================
Comment at: llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:327
+  unsigned PtrOffsetWidth = DL.getIndexSizeInBits(ASA);
+  APInt Size(PtrOffsetWidth, DL.getTypeStoreSize(PtrATy));
 
----------------
Vectorizer not tested


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