[PATCH] D152145: [InstSimplify] Fold all global variables with initializers

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 11:29:02 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/MemoryBuiltins.cpp:833
+
+  if (GV.hasExternalWeakLinkage() && Options.NullIsUnknownSize)
     return unknown();
----------------
Sorry for the back and forth here, but after further consideration, I think we always need to return unknown() for `GV.hasExternalWeakLinkage()`, independent of `NullIsUnknownSize`.

The reason is that in NullIsUnknownSize=false mode, we would have to treat null as size 0. However, we only get here in `Min` mode, so we would have 0 as the overall result, which is the same as unknown. So we should just always return unknown for this case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152145



More information about the llvm-commits mailing list