Skip to content
Commit b58a697f authored by Nikita Popov's avatar Nikita Popov
Browse files

[LICM] Don't promote store to global even in single-thread mode

Even if there are no thread-safety concerns, we should not promote
(not guaranteed-to-execute) stores to globals without further
analysis: 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.

Differential Revision: https://reviews.llvm.org/D146233
parent 82df745e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment