Need help to add operand for global metadata

Hi llvm-ers,

I try to assign unique IDs for each basic block in a module using globle metadata (NamedMDNode). However, I got an error: ‘Invalide operand for global metadata!’ and I have no idea how to deal with it. My llvm version is 3.6.0 and I use visual studio 2013 to build the project. The way to add MDNode is learnt from LLVM Giri project (their project is based on llvm 3.4).

Thanks for your time. :slight_smile:
Henry

Here is the code snippet: