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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 12:04:42 PST 2020


efriedma 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
----------------
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.


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