[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
Thu Feb 16 16:28:05 PST 2023


arichardson added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp:927
 
-  Value *ResultPtr = Builder.CreatePtrToInt(Variadic->getOperand(0), IntPtrTy);
+  Value *ResultPtr = Builder.CreatePtrToInt(Variadic->getOperand(0), PtrIdxTy);
   gep_type_iterator GTI = gep_type_begin(*Variadic);
----------------
jrtc27 wrote:
> krzysz00 wrote:
> > arsenm wrote:
> > > Doesn't creating a ptrtoint from a non-integral pointer break horribly?
> > Good catch, I've added guards to make sure non-integral address spaces don't get sent this direction. And that fat pointers don't enter this code path either.
> Hm, weirdly I don't see any changes to this function in CHERI LLVM, which makes me wonder how we don't hit issues here on CHERI-RISC-V given the RISC-V backend doesn't return true for STI->useAA()...
Probably due to the `DL->getIntPtrType` hack that we have (which been hopefully be deleted soon after merging up to this change).


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