Skip to content

Commit 9ac5ece

Browse files
committed
Comments
1 parent 06c412f commit 9ac5ece

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

llvm/lib/Transforms/IPO/Attributor.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,16 @@ AA::getInitialValueForObj(Attributor &A, const AbstractAttribute &QueryingAA,
259259
if (!Initializer)
260260
return nullptr;
261261
} else {
262-
if (!GV->hasLocalLinkage() &&
263-
(GV->isInterposable() || GV->isExternallyInitialized() ||
264-
!(GV->isConstant() && GV->hasInitializer())))
265-
return nullptr;
266-
if (!GV->hasInitializer())
267-
return UndefValue::get(&Ty);
262+
if (GV->hasLocalLinkage()) {
263+
// uninitialized local variable
264+
if (!GV->hasInitializer())
265+
return UndefValue::get(&Ty);
266+
} else {
267+
// externally visible variable with uncertain initializer or
268+
// uncertain values.
269+
if (!GV->hasDefinitiveInitializer() || !GV->isConstant())
270+
return nullptr;
271+
}
268272

269273
if (!Initializer)
270274
Initializer = GV->getInitializer();

0 commit comments

Comments
 (0)