See the added testcase -- the problem happens when trying to apply VFE during LTO, but without CFI at all, and when having a custom section on a vtable global. In that case LowerTypeTestsPass rejects the IR because it enforces that all !type-having globals must not specify a custom section. However, in a non-CFI compilation, this requirement is too strict, using !type metadata for VFE does not have any such requirement.
This diff adds a module flag, "No CFI Section Enforcement", that allows custom sections on globals with !type metadata, and basically is a way of informing LowerTypeTestsPass that the compilation is not doing CFI. Suggestions for alternative solutions welcome!
Shouldn't this test be in lvm/test/Transforms/LowerTypeTests/ and independent of -globaldce?