[Verifier] Improve incompatible attribute type check
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 14 Jul 2021 18:58:52 +0000 (20:58 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 14 Jul 2021 19:02:10 +0000 (21:02 +0200)
commit5e4b33fe9218703f0b29e2446159bcf4202d15fa
tree0d9685736f306ccf9eefa63564030318db6b4b4f
parent9c2de2382197109388a25c9486f0e4408896d36e
[Verifier] Improve incompatible attribute type check

A couple of attributes had explicit checks for incompatibility
with pointer types. However, this is already handled generically
by the typeIncompatible() check. We can drop these after adding
SwiftError to typeIncompatible().

However, the previous implementation of the check prints out all
attributes that are incompatible with a given type, even though
those attributes aren't actually used. This has the annoying
result that the error message changes every time a new attribute
is added to the list. Improve this by explicitly finding which
attribute isn't compatible and printing just that.
llvm/lib/IR/Attributes.cpp
llvm/lib/IR/Verifier.cpp
llvm/test/Verifier/align.ll
llvm/test/Verifier/byref.ll
llvm/test/Verifier/byval-1.ll
llvm/test/Verifier/inalloca1.ll
llvm/test/Verifier/noundef.ll
llvm/test/Verifier/preallocated-invalid.ll
llvm/test/Verifier/sret.ll
llvm/test/Verifier/swifterror.ll