[LLVMdev] Any known-reliable numbering scheme for basic blocks?

Christian Convey christian.convey at gmail.com
Wed Jun 24 18:05:16 PDT 2015


Hi all,

Does anyone know of a good solution to the following?  I'm trying to find a
good way to stably associate distinct ID numbers with different BB in a
module.  As long as the module's IR hasn't changed in any way whatsoever,
I'd like to be guaranteed to always generate the same ID <--> BB mapping.
Or if the mapping is ambiguous, because two or more mappings between BB's
and ID's are indistinguishable (isomorphic?), I'd like to be sure I at
least can reliably re-obtain some mapping in that equivalence class.

This seems related to a debate / bug-report
<https://llvm.org/bugs/show_bug.cgi?id=16043> regarding the arbitrary
nature of (pseudo?) labels in LLVM assembly.  E.g.,*"; label:3"*.

It also looks like *llvm-diff* does something similar to what I want in its
*FunctionDifferenceEngine* class.  But I think *llvm-diff* allows for the
two IR's to differ, and uses approximate matching.  I don't need any
graceful degradation when the IR has changed, but I need exact matching
when the IR hasn't changed.

In the worst-case scenario, I could make a sweep through all of the
module's BB's and just tag each BB with a distinct serial number in its
metadata.  But I'd like to avoid this if possible, partly because I'd like
there to be a chance of the BB <--> ID mapping remaining valid if I run
Clang.

Thanks, Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150624/26ee118c/attachment.html>


More information about the llvm-dev mailing list