[PATCH] D143437: [llvm] Use pointer index type for more GEP offsets (pre-codegen)
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 8 03:22:40 PST 2023
foad added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/NaryReassociate.cpp:454
+ if (RHS->getType() != PtrIdxTy)
+ RHS = Builder.CreateSExtOrTrunc(RHS, PtrIdxTy);
if (IndexedSize != ElementSize) {
----------------
Not necessarily related to your patch, but the "OrTrunc" makes me nervous (here and in a couple of other places in this patch). My understanding of the index type in datalayout is that it is a preferred type to use GEP indexes, but shouldn't actually have any semantic effect, so it would be wrong to truncate an index to the index type unless you can prove that it won't change the value.
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