How to modify structure layout in lto with opaque pointers

I would like to make some modifications to the layout of the structure in lto, such as Dead Field Elimination and Field Reorder.

But llvm16 only supports opaque pointers, which makes it difficult to find the following information:

  1. Where are structures and their pointers or arrays defined and used.
  2. Whether the struct and its pointer or array are cast.
  3. Whether the structure and its pointers or arrays escaped outside the current compilation unit.

My current thinking is to recompute the ptr type via the getelementptr instruction.

Is there a better suggestion for these situations?