How to handle use of attribute group IDs with missing attribute group definition?


We’ve been exploring the test case suite of LLVM recently, and came across quite a few test cases that reference attribute group IDs (e.g. #2), not being defined in the module (i…e no associate attribute group definition #2 = {}).

For instance, test/DebugInfo/X86/parameters.ll 1 uses #0, #1 and #2, but only contains definitions for #0 and #1. The definition for #2 is missing.

So, my question is, is this valid LLVM IR? I tried to run the file through opt -verify, but no error or warning was reported.

If it is valid LLVM IR, what is the behaviour when parsing such files? To insert an empty definition (i.e. #2 = {}), or to remove uses of undefined attribute group definitions (i.e. remove any reference of #2)?