[all-commits] [llvm/llvm-project] 57530c: [GlobalOpt] Do not promote malloc if there are ato...

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Apr 24 06:16:08 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 57530c23a53b5e003d389437637f61c5b9814e22
      https://github.com/llvm/llvm-project/commit/57530c23a53b5e003d389437637f61c5b9814e22
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2025-04-24 (Thu, 24 Apr 2025)

  Changed paths:
    M llvm/lib/Transforms/IPO/GlobalOpt.cpp
    A llvm/test/Transforms/GlobalOpt/malloc-promote-atomic.ll

  Log Message:
  -----------
  [GlobalOpt] Do not promote malloc if there are atomic loads/stores (#137158)

When converting a malloc stored to a global into a global, we will
introduce an i1 flag to track whether the global has been initialized.

In case of atomic loads/stores, this will result in verifier failures,
because atomic ops on i1 are illegal. Even if we changed this to i8, I
don't think it is a good idea to change atomic types in that way.

Instead, bail out of the transform is we encounter any atomic
loads/stores of the global.

Fixes https://github.com/llvm/llvm-project/issues/137152.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list