[PATCH] D105398: [SCEVExpander] Support opaque pointers
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 6 13:14:03 PDT 2021
dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.
Sounds reasonable
================
Comment at: llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp:642
Casted = InsertNoopCastOfTo(Casted, PTy);
- Value *GEP = Builder.CreateGEP(OriginalElTy, Casted, GepIndices, "scevgep");
+ Value *GEP = Builder.CreateGEP(PTy->getElementType(), Casted, GepIndices,
+ "scevgep");
----------------
nikic wrote:
> dblaikie wrote:
> > can/should we avoid the use of `PointerType::getElementType` here by some means - preserving it through the various choices in the code above?
> This code path is only used for non-opaque pointers, so it's "okay" to use getElementType here. And I don't think we can avoid it -- if we know the element type to use, we wouldn't have to use an i8 GEP for opaque pointers either :)
Ah, fair enough -and getElementType asserts on opaque pointers to check for this.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105398/new/
https://reviews.llvm.org/D105398
More information about the llvm-commits
mailing list