[PATCH] D146233: [LICM] Don't promote store to global even in single-thread mode
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 16 09:15:31 PDT 2023
nikic created this revision.
nikic added reviewers: efriedma, reames, jdoerfert, fhahn, asbirlea.
Herald added subscribers: jeroen.dobbelaere, StephenFan, kosarev, hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Even if there are no thread-safety concerns, we should not promote (not guaranteed-to-execute) stores to globals: While the global may be writable, we may not have provenance to perform the write. The `@promote_global_noalias` test case illustrates a miscompile in the presence of a `noalias` pointer to the global.
Worth noting that the load-only promotion may also not be well-defined depending on precise semantics (we don't specify whether load violating noalias is poison or UB -- though I believe the general inclination is to make it poison, and only stores UB), but that's a more general issue.
This is inspired by https://github.com/llvm/llvm-project/issues/60860, which is a related issue with TBAA metadata.
https://reviews.llvm.org/D146233
Files:
llvm/lib/Transforms/Scalar/LICM.cpp
llvm/test/Transforms/LICM/promote-single-thread.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146233.505829.patch
Type: text/x-patch
Size: 6886 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230316/62acc36f/attachment.bin>
More information about the llvm-commits
mailing list