Use the elementtype attribute introduced in D105407 for the llvm.preserve.array/struct.index intrinsics. It carries the element type of the GEP these intrinsics effectively encode.
This patch:
- Adds a verifier check that the attribute is required.
- Adds it in the IRBuilder methods for these intrinsics.
- Autoupgrades old bitcode without the attribute.
- Updates the lowering code to use the attribute rather than the pointer element type.
- Updates lots of tests to specify the attribute.
- Adds -force-opaque-pointers to the intrinsic-array.ll test to demonstrate they work now.
I noticed too late that this intrinsic also uses the element type to get the alignment. I'll have to follow up with the same change for this intrinsic.
Though I'm not completely sure if this is actually used, because no tests fail if I replace this with dummy values like 1 or 128.