getMetadata for function

Dear All,

I have the following piece of code, which gives an ID to every openmp outlined region.

Metadata *Ops[1] = {ConstantAsMetadata::get(ConstantInt::get(Int64, ompRegionsUID++))};
MDNode *N = MDNode::get(currentRegion->getContext(), Ops);
currentRegion->setMetadata(“omp.region.ID”, N);

Later, I would like to retrieve given IDs to regions, but I do not know how!

I am using the following code which is not working:

currentRegion->getMetadata(“omp.region.ID”)->getOperand(0)

Thank you very much for your help.

Best,

Mohammad