tv: recreate tgt function since preprocess may have touched it
MODIFY
tv/tv.cpp
tv/tv.cpp
@@ -217,8 +217,11 @@ struct TVPass final : public llvm::FunctionPass {
}
auto [I, first] = fns.try_emplace(F.getName().str());
- auto fn = llvm2alive(F, *TLI, first ? vector<string_view>()
- : I->second.fn.getGlobalVarNames());
+
+ vector<string_view> src_global_vars;
+ if (!first)
+ src_global_vars = I->second.fn.getGlobalVarNames();
+ auto fn = llvm2alive(F, *TLI, src_global_vars);
if (!fn) {
fns.erase(I);
return false;
@@ -285,7 +288,8 @@ struct TVPass final : public llvm::FunctionPass {
*out << "Transformation seems to be correct!\n\n";
}
- I->second.fn = move(t.tgt);
+ // Regenerate tgt because preprocessing may have changed it
+ I->second.fn = *llvm2alive(F, *TLI, move(src_global_vars));
return false;
}

tv: recreate tgt function since preprocess may have touched it (#578)