Index: cfe/trunk/lib/CodeGen/CodeGenModule.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp @@ -565,12 +565,8 @@ void CodeGenModule::DecorateInstructionWithInvariantGroup( llvm::Instruction *I, const CXXRecordDecl *RD) { - llvm::Metadata *MD = CreateMetadataIdentifierForType(QualType(RD->getTypeForDecl(), 0)); - auto *MetaDataNode = dyn_cast(MD); - // Check if we have to wrap MDString in MDNode. - if (!MetaDataNode) - MetaDataNode = llvm::MDNode::get(getLLVMContext(), MD); - I->setMetadata(llvm::LLVMContext::MD_invariant_group, MetaDataNode); + I->setMetadata(llvm::LLVMContext::MD_invariant_group, + llvm::MDNode::get(getLLVMContext(), {})); } void CodeGenModule::Error(SourceLocation loc, StringRef message) { Index: cfe/trunk/test/CodeGenCXX/invariant.group-for-vptrs.cpp =================================================================== --- cfe/trunk/test/CodeGenCXX/invariant.group-for-vptrs.cpp +++ cfe/trunk/test/CodeGenCXX/invariant.group-for-vptrs.cpp @@ -12,15 +12,15 @@ void testExternallyVisible() { A *a = new A; - // CHECK: load {{.*}} !invariant.group ![[A_MD:[0-9]+]] + // CHECK: load {{.*}} !invariant.group ![[MD:[0-9]+]] a->foo(); D *d = new D; // CHECK: call void @_ZN1DC1Ev( - // CHECK: load {{.*}} !invariant.group ![[D_MD:[0-9]+]] + // CHECK: load {{.*}} !invariant.group ![[MD]] d->foo(); A *a2 = d; - // CHECK: load {{.*}} !invariant.group ![[A_MD]] + // CHECK: load {{.*}} !invariant.group ![[MD]] a2->foo(); } // CHECK-LABEL: {{^}}} @@ -40,35 +40,32 @@ // CHECK-LABEL: define void @_Z21testInternallyVisibleb( void testInternallyVisible(bool p) { B *b = new B; - // CHECK: = load {{.*}}, !invariant.group ![[B_MD:[0-9]+]] + // CHECK: = load {{.*}}, !invariant.group ![[MD]] b->bar(); // CHECK: call void @_ZN12_GLOBAL__N_11CC1Ev( C *c = new C; - // CHECK: = load {{.*}}, !invariant.group ![[C_MD:[0-9]+]] + // CHECK: = load {{.*}}, !invariant.group ![[MD]] c->bar(); } // Checking A::A() // CHECK-LABEL: define linkonce_odr void @_ZN1AC2Ev( -// CHECK: store {{.*}}, !invariant.group ![[A_MD]] +// CHECK: store {{.*}}, !invariant.group ![[MD]] // CHECK-LABEL: {{^}}} // Checking D::D() // CHECK-LABEL: define linkonce_odr void @_ZN1DC2Ev( // CHECK: = call i8* @llvm.invariant.group.barrier(i8* // CHECK: call void @_ZN1AC2Ev(%struct.A* -// CHECK: store {{.*}} !invariant.group ![[D_MD]] +// CHECK: store {{.*}} !invariant.group ![[MD]] // Checking B::B() // CHECK-LABEL: define internal void @_ZN12_GLOBAL__N_11BC2Ev( -// CHECK: store {{.*}}, !invariant.group ![[B_MD]] +// CHECK: store {{.*}}, !invariant.group ![[MD]] // Checking C::C() // CHECK-LABEL: define internal void @_ZN12_GLOBAL__N_11CC2Ev( -// CHECK: store {{.*}}, !invariant.group ![[C_MD]] +// CHECK: store {{.*}}, !invariant.group ![[MD]] -// CHECK: ![[A_MD]] = !{!"_ZTS1A"} -// CHECK: ![[D_MD]] = !{!"_ZTS1D"} -// CHECK: ![[B_MD]] = distinct !{} -// CHECK: ![[C_MD]] = distinct !{} +// CHECK: ![[MD]] = !{}