[PATCH] D152145: [InstSimplify] Fold all global variables with initializers
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 5 13:23:58 PDT 2023
nikic added a comment.
We should also have a test for some case where EvalMode is not Min -- maybe just grep the codebase to find something appropriate.
================
Comment at: llvm/lib/Analysis/MemoryBuiltins.cpp:833
+ if (GV.isInterposable() && (Options.NullIsUnknownSize ||
+ Options.EvalMode != ObjectSizeOpts::Mode::Min))
return unknown();
----------------
We might as well handle the !hasInitializer() case as well, which has the same minimum size requirement as interposable symbols.
Also, I just realized that `NullIsUnknownSize` is only relevant for extern_weak linkage, not for other interposable linkage. So I think the right conditions would be something like this:
```
if ((!hasInitializer || isInterposable) && EvalMode != Min)
return unknown;
if (hasExternalWeakLinkage && NullIsUnkownSize)
return unknown;
```
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