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

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 14:48:21 PDT 2023


goldstein.w.n 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?
Assuming I change the `null` version to be the `sub` + `and` version.


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