Until now, it was possible to set an initilizer for e.g. a struct that
contained a global constant from some other module. The verifier would
complain, but the verifier's complaint doesn't point very accurately at
Please clang-format this.
Can you check for ConstantAggregate here, instead of checking ConstantStruct and ConstantArray separately? Would it also make sense to check for ConstantExpr?
Can you use a for-range loop here? (for (auto *Op : V->operands()))
I don't think you actually need a recursion guard; you only recurse on ConstantAggregates, and they can't refer to themselves circularly. But maybe it's a good idea anyway to avoid exponential compile-time in certain edge cases.
This test *still* isn't testing what you want; verification fails due to the other global variable.