Store to constant global only when it has definitive initializer
MODIFY
llvm_util/llvm2alive.cpp
llvm_util/llvm2alive.cpp
@@ -913,7 +913,7 @@ public:
if (!GV)
continue;
auto gv = getGlobalVariable(GV->getName().substr(1));
- if (!gv->isConstant() || !gv->hasInitializer())
+ if (!gv->isConstant() || !gv->hasDefinitiveInitializer())
continue;
auto storedval = get_operand(gv->getInitializer());

ADD
tests/alive-tv/memory/glb-weak-fail.srctgt.ll
+@g = weak constant i32 0
+
+define i32 @src() {
+ %x = load i32, i32* @g
+ ret i32 %x
+}
+
+define i32 @tgt() {
+ ret i32 0
+}
+
+; ERROR: Value mismatch

Store to constant global only when it has definitive initializer (#312)