Deleting all unreferenced memref::GlobalOp

Hi,

I have many unreferenced/unused memref global constants. I want to delete all such global constants definitions, this will help in reducing the .rodata size of .o file. Is there a way to walk through such constants and remove it one go?

Or,

if we want to delete a particular global constant op, how we can do the same?

Thanks and Regards
Meena

The -symbol-dce pass should take care of this.

Thank you for your prompt response. It worked!!!

Regards
Meena

I have few undef declarations as well in ll file
@_temp_area = private constant [256 x i32] undef

Is there any way to remove these declarations as well?

Regards
Meena