[llvm] [GlobalOpt] Don't replace aliasee with alias that has weak linkage (PR #91483)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri May 17 17:49:40 PDT 2024
MaskRay wrote:
Ah, I misread the code.
In `bar`, `call void @f1()` calling the aliasee was replaced with the alias before (`RenameTarget`).
This was problematic and this patch have fixed it.
This patch and its backport to release/18.x looks good to me.
I agree that some cleanup could be made to improve readability of this code.
---
> At -O0, the initialization of "a" and "b" happens in define internal void @__tls_init(). At -Oz, this becomes linkonce_odr dso_local void @_ZTH1a()... so if a is also defined in another file, we can skip the constructor for b.
Thanks for the example.
At -O0, `define internal void @__tls_init()` initializes `a` and `b`.
Previously, `__tls_init` was incorrectly renamed (due to `RenameTarget`) to `_ZTH1a` (like derefinement).
If the linker picks the prevailing definition of `_ZTH1a` from another module, we would skip the constructor of `b`.
https://github.com/llvm/llvm-project/pull/91483
More information about the llvm-commits
mailing list