Adding instruction ids in debug dumps

Hi all,

During analysis of IR/MIR dumps I sometimes need to investigate behavior of a particular problematic instruction.

To my knowledge there is currently no easy way to map from instruction in dumpfile to a place where it’s created or modified in the compiler.

One simple solution to this which I’ve seen in the past is to add instruction UIDs which could be printed in dumps and then used for setting conditional breakpoints in debugger. Would something like this make sense for mainline?

I’ve put a simple PR at ⚙ D143321 [DRAFT] [IR] Add instruction IDs to simplify debugging. to illustrate this suggestion.

Best regards,
Yuri

Have you considered attaching metadata to the instructions instead?

1 Like

No, I have not. Thank you for the suggestion, I’ll give it a try.

I think my main concern is whether this is appropriate for trunk in general. In my opinion this feature is useful in debugging but I may be wrong.