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

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Apr 29 15:23:06 PDT 2025


  Branch: refs/heads/release/20.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 1cf8c7797d2b2447a0eadd1443498bc9be38042e
      https://github.com/llvm/llvm-project/commit/1cf8c7797d2b2447a0eadd1443498bc9be38042e
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2025-04-29 (Tue, 29 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.

(cherry picked from commit 57530c23a53b5e003d389437637f61c5b9814e22)



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