From 089c699743614cc99340c694454b4333c44d0198 Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Fri, 16 Dec 2016 18:52:33 +0000 Subject: Fix CodeGenPrepare::stripInvariantGroupMetadata `dropUnknownNonDebugMetadata` takes a list of "known" metadata IDs. The only reason it worked at all is that `getMetadataID` returns something unrelated -- it returns the subclass ID of the receiver (which is used in `dyn_cast` etc.). That does not numerically match `LLVMContext::MD_invariant_group` and ends up dropping `invariant_group` along with every other metadata that does not numerically match `LLVMContext::MD_invariant_group`. llvm-svn: 289973 --- llvm/lib/CodeGen/CodeGenPrepare.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp') diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 0ae57ce0c36..bc333b95ee0 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -5735,6 +5735,5 @@ bool CodeGenPrepare::splitBranchCondition(Function &F) { } void CodeGenPrepare::stripInvariantGroupMetadata(Instruction &I) { - if (auto *InvariantMD = I.getMetadata(LLVMContext::MD_invariant_group)) - I.dropUnknownNonDebugMetadata(InvariantMD->getMetadataID()); + I.setMetadata(LLVMContext::MD_invariant_group, nullptr); } -- cgit v1.2.3