Destroying MDNodeOperand

Hello,

From VTune profiler, we notice that function MDNodeOperand::deleted, called from destructor ~llvmContextImpl, consumes ~18% (0.67 sec) of the total compilation time (3.7sec). This llvm module has ~400 metadata. Is this destruction time unexpectedly high or just expected? Or we should avoid to use this amount of metadata in the first place. Any thoughts or suggestions?

Thanks,
Wei

it would be better if u can post the llvm module her if it’s not too large?
-Xin

I'm not surprised by this. The Metadata hierarchy generally was
stuck with some inefficient API prior to 3.6.

Note that the class no longer exists in ToT. You might want to check
out the 3.6 release notes to see how Metadata changed; it should be a
fair bit more efficient. It's been tuned for memory usage so far
(not yet compile time), but I've noticed compile time improvements as
well.

If you can reproduce such a bottleneck in LLVMContextImpl teardown on
ToT, please file a PR and CC me and I'll look into it.