[all-commits] [llvm/llvm-project] 6b85fa: [InstCombine] Don't optimize idempotent `atomicrmw...

qcolombet via All-commits all-commits at lists.llvm.org
Thu Jan 19 01:20:41 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6b85fa6d81b9f50d7a1c347dfd467c9ab01c4a5d
      https://github.com/llvm/llvm-project/commit/6b85fa6d81b9f50d7a1c347dfd467c9ab01c4a5d
  Author: Quentin Colombet <quentin.colombet at gmail.com>
  Date:   2023-01-19 (Thu, 19 Jan 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAtomicRMW.cpp
    M llvm/test/Transforms/InstCombine/atomicrmw.ll

  Log Message:
  -----------
  [InstCombine] Don't optimize idempotent `atomicrmw <op>, 0` into `load atomic`

Turning idempotent `atomicrmw`s into `load atomic` is perfectly legal
with respect to how the loading happens, but it may not be legal for the
whole program semantic.

Indeed, this optimization removes a store that may have some effects on
the legality of other optimizations.
Essentially, we lose some information and depending on the backend
it may or may not produce incorrect code, so don't do it!

This fixes llvm.org/PR56450.

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




More information about the All-commits mailing list