Skip to content

Commit 98eead0

Browse files
committed
Fix functions getting declared in duplicate in TraceLifter
1 parent 62f16fe commit 98eead0

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

lib/BC/TraceLifter.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,18 @@ bool TraceLifter::Impl::Lift(
257257
auto get_trace_decl = [this](uint64_t trace_addr) -> llvm::Function * {
258258
if (auto trace = GetLiftedTraceDeclaration(trace_addr)) {
259259
return trace;
260-
} else if (trace_work_list.count(trace_addr)) {
261-
return arch->DeclareLiftedFunction(manager.TraceName(trace_addr), module);
262-
} else {
263-
return nullptr;
264260
}
261+
262+
auto trace_name = manager.TraceName(trace_addr);
263+
if (auto trace = module->getFunction(trace_name)) {
264+
return trace;
265+
}
266+
267+
if (trace_work_list.count(trace_addr)) {
268+
return arch->DeclareLiftedFunction(trace_name, module);
269+
}
270+
271+
return nullptr;
265272
};
266273

267274
trace_work_list.insert(addr);

0 commit comments

Comments
 (0)