[all-commits] [llvm/llvm-project] b58a69: [LICM] Don't promote store to global even in singl...

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Apr 3 05:20:52 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b58a697f3e19437f8525ec31a384c8901b0b736c
      https://github.com/llvm/llvm-project/commit/b58a697f3e19437f8525ec31a384c8901b0b736c
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-04-03 (Mon, 03 Apr 2023)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LICM.cpp
    M llvm/test/Transforms/LICM/promote-single-thread.ll

  Log Message:
  -----------
  [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




More information about the All-commits mailing list