References to functions are in program memory and need a pm() fixup. This should fix trait objects for Rust on AVR.
As a quick review (without looking into this carefully): you need to add tests. Without tests this will not be accepted. It also gives a better idea of what it does exactly and thus makes reviewing easier.
Good bugfix - thanks for the second patch!
This check is not fully sufficient for covering all cases - namely, the constant may not be a function but still might be constrained to program memory and require the new pm fixup. Motivating example: a global variable that is explicitly located in program memory via an addrspace(1) qualifier.
Suggest replacing the "is a function" check with GV->getAddressSpace() == AVR::ProgramMemory which more directly captures what you're wanting to check, and will also add the new pm fixup to regular progmem vars
Order the #include alphabetically
Rename Rust identifier names in this file to something human readable. For this particular line, a more appropriate name might be EmptyType or simple TypeFoo. In general, LLVM tests are committed without the machine-readable naming conventions of the frontend used to generate them. It will also make some of the CHECK lines shorter and more obvious.
Remove attribute specifiers (#n) after functions - most if not all of them should be unnecessary
Drop the linking options and calling convention fastcc - I suspect these are not needed to reproduce
Delete the attributes which are not required for your test to pass
Optional: It might be a good idea to post the version of the Rust compiler used if it's not too much hassle to dig that up again.
Drop unnecessary function attributes as I suspect they are not required to reproduce the issue
Avoid numeric variable names in LLVM tests as they make modfications to the test in the future more difficult as LLVM verifier requires that all numerical vars are defined in order, which makes insertion of new variables mid-function problematic.
There is an existing LLVM pass which can be used to do this automatically, although there are very few numbered variable names in the test already so it might be easier to fixup manually. In the past I've been recommended and used to good success is the instnamer pass, invokable via opt -instnamer ..., although it will strip out your CHECK lines.