[llvm] [Attributor] Do not optimize away externally_initialized loads. (PR #128170)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 21 06:38:29 PST 2025


================
@@ -259,11 +259,16 @@ AA::getInitialValueForObj(Attributor &A, const AbstractAttribute &QueryingAA,
     if (!Initializer)
       return nullptr;
   } else {
-    if (!GV->hasLocalLinkage() &&
-        (GV->isInterposable() || !(GV->isConstant() && GV->hasInitializer())))
-      return nullptr;
-    if (!GV->hasInitializer())
-      return UndefValue::get(&Ty);
+    if (GV->hasLocalLinkage()) {
+      // uninitialized local variable
----------------
shiltian wrote:

nit: I'd not call them local variable as they are global variables with local linkage.

https://github.com/llvm/llvm-project/pull/128170


More information about the llvm-commits mailing list