[llvm] r247931 - Added MD_invariant_group to LLVMContext

Piotr Padlewski via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 13:25:07 PDT 2015


Author: prazek
Date: Thu Sep 17 15:25:07 2015
New Revision: 247931

URL: http://llvm.org/viewvc/llvm-project?rev=247931&view=rev
Log:
Added MD_invariant_group to LLVMContext

http://reviews.llvm.org/D12926

Modified:
    llvm/trunk/include/llvm/IR/LLVMContext.h
    llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
    llvm/trunk/lib/IR/LLVMContext.cpp

Modified: llvm/trunk/include/llvm/IR/LLVMContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/LLVMContext.h?rev=247931&r1=247930&r2=247931&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/LLVMContext.h (original)
+++ llvm/trunk/include/llvm/IR/LLVMContext.h Thu Sep 17 15:25:07 2015
@@ -62,7 +62,8 @@ public:
     MD_dereferenceable = 12, // "dereferenceable"
     MD_dereferenceable_or_null = 13, // "dereferenceable_or_null"
     MD_make_implicit = 14, // "make.implicit"
-    MD_unpredictable = 15 // "unpredictable"
+    MD_unpredictable = 15, // "unpredictable"
+    MD_invariant_group = 16 // "invariant.group"
   };
 
   /// getMDKindID - Return a unique non-zero ID for the specified metadata kind.

Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=247931&r1=247930&r2=247931&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Thu Sep 17 15:25:07 2015
@@ -4836,6 +4836,6 @@ bool CodeGenPrepare::splitBranchConditio
 }
 
 void CodeGenPrepare::stripInvariantGroupMetadata(Instruction &I) {
-  if (auto *InvariantMD = I.getMetadata("invariant.group"))
+  if (auto *InvariantMD = I.getMetadata(LLVMContext::MD_invariant_group))
     I.dropUnknownNonDebugMetadata(InvariantMD->getMetadataID());
 }

Modified: llvm/trunk/lib/IR/LLVMContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContext.cpp?rev=247931&r1=247930&r2=247931&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContext.cpp (original)
+++ llvm/trunk/lib/IR/LLVMContext.cpp Thu Sep 17 15:25:07 2015
@@ -116,6 +116,13 @@ LLVMContext::LLVMContext() : pImpl(new L
   assert(UnpredictableID == MD_unpredictable &&
          "unpredictable kind id drifted");
   (void)UnpredictableID;
+
+  // Create the 'invariant.group' metadata kind.
+  unsigned InvariantGroupId = getMDKindID("invariant.group");
+  assert(InvariantGroupId == MD_invariant_group &&
+         "invariant.group kind id drifted");
+  (void)InvariantGroupId;
+
 }
 LLVMContext::~LLVMContext() { delete pImpl; }
 




More information about the llvm-commits mailing list