Tapir-LLVM
Tapir-LLVM copied to clipboard
Can't demangle outlined function names
During outlining, Tapir creates a new function name by concatenating the name of the original function with the name of the outlined block.
https://github.com/wsmoses/Tapir-LLVM/blob/681753321c1a53c248e3c957aa0835c25704b3fe/lib/Transforms/Tapir/Outline.cpp#L241
When compiling C++, the new name can no longer be demangled by tools like c++filt
, the additional characters break the format.
$ echo "_ZN10hybrid_bfs36top_down_step_with_migrating_threadsEv" | c++filt
hybrid_bfs::top_down_step_with_migrating_threads()
$ echo "_ZN10hybrid_bfs36top_down_step_with_migrating_threadsEv_if.end.i.i.i.i20.i.i.otd1" | c++filt
_ZN10hybrid_bfs36top_down_step_with_migrating_threadsEv_if.end.i.i.i.i20.i.i.otd1
Not sure what the fix is here, perhaps we can demangle, append, and remangle?
Just noticed the related issue https://github.com/wsmoses/Tapir-LLVM/issues/78, I guess the current solution is to strip everything after .outline_
and then demangle?
That solution should do the trick, yes. Does that work for your case? I'm happy to take other suggestions.
I'm torn. On the one hand, demangling via c++filt
should "just work" without the need for additional tooling. On the other hand, fully qualified names and template instantiations make the demangled output pretty unreadable anyways, so adding one more layer of pre-processing is not a big deal.
LLVM does come with its own version of c++filt
, in llvm-cxxfilt
. Perhaps we can think about defining a scheme to mangle/demangle names of outlined functions for Cilk programs, and then extending Tapir/LLVM to implement that scheme in llvm-cxxfilt
. I haven't investigated how hard this would be, but maybe it's not hard.