[PATCH] D87827: [SCEVExpander] Support expanding nonintegral pointers with constant base.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 18 14:34:21 PDT 2020
efriedma added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp:131
+ // inttoptr only works for integral pointers. For non-integral pointers, we
+ // can create a GEP on i8* null with the integral value as index.
+ if (Op == Instruction::IntToPtr && DL.isNonIntegralPointerType(PtrTy)) {
----------------
It's probably worth noting the reason we know this is safe. Semantically, a GEP from null is quite different from an inttoptr: a GEP from null can't be used to access memory. I guess the reason this is safe is that we know the original IR must also have been a GEP from null.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87827/new/
https://reviews.llvm.org/D87827
More information about the llvm-commits
mailing list