[PATCH] D154010: [InstCombine] Canonicalize `getelementptr` patterns to `@llvm.ptrmask`

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 14:47:35 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:2247
+                   Constant::getNullValue(GEP.getPointerOperand()->getType()),
+                   Index));
+    Value *Mask;
----------------
goldstein.w.n wrote:
> nikic wrote:
> > This is not legal, because it does not preserve pointer provenance. This one even fails to preserve it in a particularly catastrophic way, because the resulting pointer has nullary provenance (i.e. it is UB to perform any accesses through it).
> I see, is the codes to create `@llvm.ptrmask` okay? Or should that too be abandoned?
If you start at the documented GEP pattern (rather than the one based on null), then that should be okay.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154010



More information about the llvm-commits mailing list