[all-commits] [llvm/llvm-project] aae5f8: [Local] Consider atomic loads from constant global...

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon May 2 01:53:16 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aae5f8115a7c9ab2e323cae8a1528d38fc3652f4
      https://github.com/llvm/llvm-project/commit/aae5f8115a7c9ab2e323cae8a1528d38fc3652f4
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-05-02 (Mon, 02 May 2022)

  Changed paths:
    M llvm/lib/Transforms/Utils/Local.cpp
    M llvm/test/CodeGen/PowerPC/atomics-constant.ll
    M llvm/test/Transforms/InstCombine/atomic.ll

  Log Message:
  -----------
  [Local] Consider atomic loads from constant global as dead

Per the guidance in
https://llvm.org/docs/Atomics.html#atomics-and-ir-optimization,
an atomic load from a constant global can be dropped, as there can
be no stores to synchronize with. Any write to the constant global
would be UB.

IPSCCP will already drop such loads, but the main helper in Local
doesn't recognize this currently. This is motivated by D118387.

Differential Revision: https://reviews.llvm.org/D124241




More information about the All-commits mailing list