[PATCH] D92210: Don't sink ptrtoint/inttoptr sequences into non-noop addrspacecasts.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 13:29:14 PST 2020


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:5049
+    if (SunkAddr->getType() != Addr->getType()) {
+      // Even though we only considered no-op addrspacecasts,
+      // semantically-meaningful conversions may still be present due to
----------------
efriedma wrote:
> I'd state this comment differently:
> 
> There are two reasons the types might not match: a no-op addrspacecast, or a ptrtoint/inttoptr pair.  Either way, we emit a ptrtoint/inttoptr pair, to ensure we match the original semantics.
> 
> --------
> 
> Ideally, we don't want to convert an addrspacecast to a ptrtoint/inttoptr pair; it's semantically valid, but we lose information.  At this point in the pipeline, it doesn't affect that much, but it does hurt alias analysis a bit.  I'm okay with starting with a conservative fix, and revisiting later.
Ideally we would allow bitcast between different address space pointers with the same size, which would avoid the need for this special case


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92210



More information about the llvm-commits mailing list