fix spurious error when a global var is removed
IPO issues must be skipable so alivecc can find the real issues
MODIFY
llvm_util/llvm2alive.cpp
llvm_util/llvm2alive.cpp
@@ -1617,14 +1617,9 @@ public:
auto &entry_name = Fn.getFirstBB().getName();
BB = &Fn.getBB("#init", true);
+ // Ensure all src globals exist in target as well
for (auto &gvname : gvnamesInSrc) {
- auto gv = getGlobalVariable(string(gvname));
- if (!gv) {
- // global variable removed or renamed
- *out << "ERROR: Unsupported interprocedural transformation\n";
- return {};
- }
- // If gvname already exists in tgt, get_operand will immediately return
+ if (auto gv = getGlobalVariable(string(gvname)))
get_operand(gv);
}

ADD
tests/alive-tv/memory/remove-global.src.ll
+; ERROR: Mismatch in memory
+
+@glb = internal global i8 0
+
+define void @f() {
+ store i8 0, ptr @glb
+ ret void
+}

ADD
tests/alive-tv/memory/remove-global.tgt.ll
+define void @f() {
+ ret void
+}

ADD
tests/clang-tv/skip-globalopt.c
+// TEST-ARGS: -O2
+
+static int x;
+
+void fn() {
+ x = 0;
+}

fix spurious error when a global var is removed
IPO issues must be skipable so alivecc can find the real issues