[llvm] [Local] Make combineAAMetadata() more principled (PR #122091)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 07:46:01 PST 2025


================
@@ -3323,16 +3321,13 @@ void llvm::combineMetadata(Instruction *K, const Instruction *J,
 
     switch (Kind) {
       default:
-        // FIXME: https://github.com/llvm/llvm-project/issues/121495
-        // Change to removing only explicitly listed other metadata, and assert
-        // on unknown metadata, to avoid inadvertently dropping newly added
-        // metadata types.
         K->setMetadata(Kind, nullptr); // Remove unknown metadata
----------------
nikic wrote:

Yes, that's possible in principle. We'd need an extra value to indicate what the last fixed MD kind is and make it a named enum so that we can switch over the enum and get a `-Werror` on uncovered enum case. Just asserting it would be too much of a liability, as people wouldn't be aware they have to update this code.

I've left a TODO for now.

https://github.com/llvm/llvm-project/pull/122091


More information about the llvm-commits mailing list