[PATCH] D85332: [SCCP] Do not replace deref'able ptr with un-deref'able one.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 13:28:29 PDT 2020


efriedma added a comment.

LLVM's memory model isn't completely settled with respect to how to determine the "base" of a pointer; see https://bugs.llvm.org/show_bug.cgi?id=34548 etc. But consensus is that the general transform you're describing isn't legal without proving more about the pointer. (e.g. that the two pointers have the same base, or the replaced value isn't used for any memory operations).



================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:1357
+          BasicAAResult::DecomposeGEPExpression(C, Dec, DL, nullptr, nullptr);
+          auto *BaseTy = Dec.Base->getType()->getPointerElementType();
+          if (BaseTy->isArrayTy() &&
----------------
I'm not sure I completely follow what this code is doing, but using getPointerElementType() like this is probably wrong.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85332



More information about the llvm-commits mailing list