[PATCH] D59065: [BasicAA] Simplify inttoptr(and(ptrtoint(X), C)) to X, if C preserves all significant bits.
Hal Finkel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 4 08:50:44 PDT 2019
hfinkel added a comment.
In D59065#1452510 <https://reviews.llvm.org/D59065#1452510>, @sanjoy wrote:
> In D59065#1449614 <https://reviews.llvm.org/D59065#1449614>, @aqjune wrote:
>
> > > @sanjoy I haven't tried to solve this problem myself, but it seems pretty important. It sounds to me like you're laying out an argument for introducing LLVM pointer masking intrinsics that would preserve some sort of inbound property. Is it fair to say that we probably can't fully optimize tagged pointers without using intrinsics to avoid this ptrtoint optimizer trap?
> >
> > I think your understanding is correct. To support full optimization opportunity, an intrinsic like `llvm.ptrmask(p, mask)` would work.
>
>
> I agree, but unfortunately it isn't clear to me how we can generate this intrinsic from frontend code (assuming a C++ frontend) that does pointer arithmetic by casting pointers to integers and back.
I think that we would need the frontend to directly generate the relevant code. It's the source-language semantics that would make that legal. We wouldn't be able to form them later for the same reason that we couldn't do the analysis later in the first place.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59065/new/
https://reviews.llvm.org/D59065
More information about the llvm-commits
mailing list