[PATCH] D124527: [GVN] Encode GEPs in offset representation

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 09:57:38 PDT 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/GVN.cpp:408
+  APInt ConstantOffset(BitWidth, 0);
+  if (PtrTy->isOpaquePointerTy() &&
+      GEP->collectOffset(DL, BitWidth, VariableOffsets, ConstantOffset)) {
----------------
aeubanks wrote:
> why don't we do this for typed pointers as well?
For typed pointers the source element type is implicitly encoded as part of the pointer operand, so this wouldn't do anything useful. To make this work with typed pointers, we'd have to change GVN to work on stripped pointers and then insert bitcasts as necessary during replacement.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124527/new/

https://reviews.llvm.org/D124527



More information about the llvm-commits mailing list