Skip to content

Commit 5199b31

Browse files
committed
avoid assert only block
1 parent 88bc182 commit 5199b31

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Transforms/IPO/Attributor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,16 +259,16 @@ AA::getInitialValueForObj(Attributor &A, const AbstractAttribute &QueryingAA,
259259
if (!Initializer)
260260
return nullptr;
261261
} else {
262-
if (GV->hasLocalLinkage()) {
263-
// Globals with local linkage are always initialized.
264-
assert(GV->hasInitializer());
265-
} else {
262+
if (!GV->hasLocalLinkage()) {
266263
// Externally visible global that's either non-constant,
267264
// or a constant with an uncertain initializer.
268265
if (!GV->hasDefinitiveInitializer() || !GV->isConstant())
269266
return nullptr;
270267
}
271268

269+
// Globals with local linkage are always initialized.
270+
assert(!GV->hasLocalLinkage() || GV->hasInitializer());
271+
272272
if (!Initializer)
273273
Initializer = GV->getInitializer();
274274
}

0 commit comments

Comments
 (0)