[PATCH] D105398: [SCEVExpander] Support opaque pointers

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 6 12:58:37 PDT 2021


nikic added inline comments.


================
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");
----------------
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 :)


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