Introduce enum values for previously defined metadata types. (NFC)

Our metadata scheme lazily assigns IDs to string metadata, but we have a mechanism to preassign them as well.  Using a preassigned ID is helpful since we get compile time type checking, and avoid some (minimal) string construction and comparison.  This change adds enum value for three existing metadata types:
+    MD_nontemporal = 9, // "nontemporal"
+    MD_mem_parallel_loop_access = 10, // "llvm.mem.parallel_loop_access"
+    MD_nonnull = 11 // "nonnull"

I went through an updated various uses as well.  I made no attempt to get all uses; I focused on the ones which were easily grepable and easily to translate.  For example, there were several items in LoopInfo.cpp I chose not to update.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220248 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Philip Reames
2014-10-21 00:13:20 +00:00
parent c0c4f1b78e
commit 9be9473394
8 changed files with 33 additions and 15 deletions

View File

@@ -329,6 +329,8 @@ static LoadInst *combineLoadToNewType(InstCombiner &IC, LoadInst &LI, Type *NewT
case LLVMContext::MD_invariant_load:
case LLVMContext::MD_alias_scope:
case LLVMContext::MD_noalias:
case LLVMContext::MD_nontemporal:
case LLVMContext::MD_mem_parallel_loop_access:
// All of these directly apply.
NewLoad->setMetadata(ID, N);
break;
@@ -339,12 +341,6 @@ static LoadInst *combineLoadToNewType(InstCombiner &IC, LoadInst &LI, Type *NewT
break;
}
}
// FIXME: These metadata nodes should really have enumerators and be handled
// above.
if (MDNode *N = LI.getMetadata("nontemporal"))
NewLoad->setMetadata("nontemporal", N);
if (MDNode *N = LI.getMetadata("llvm.mem.parallel_loop_access"))
NewLoad->setMetadata("llvm.mem.parallel_loop_access", N);
return NewLoad;
}