[llvm] [GlobalOpt] Do not fold away addrspacecasts which may be runtime operations (PR #153753)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 15 06:14:40 PDT 2025
================
@@ -0,0 +1,42 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
+; RUN: opt -passes=globalopt < %s -S | FileCheck %s
+
+; Test that we do not fold away addresscasts when optimizing once-stored
+; globals, as these may be runtime operations.
+
+ at g1 = internal global ptr null
+ at g2 = internal addrspace(1) global i32 0
----------------
nikic wrote:
```suggestion
@g2 = addrspace(1) global i32 0
```
And then drop the atomics on the loads?
https://github.com/llvm/llvm-project/pull/153753
More information about the llvm-commits
mailing list