llvm.org GIT mirror llvm / 83c8485
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`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289973 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjoy Das 3 years ago
2 changed file(s) with 6 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
57345734 }
57355735
57365736 void CodeGenPrepare::stripInvariantGroupMetadata(Instruction &I) {
5737 if (auto *InvariantMD = I.getMetadata(LLVMContext::MD_invariant_group))
5738 I.dropUnknownNonDebugMetadata(InvariantMD->getMetadataID());
5739 }
5737 I.setMetadata(LLVMContext::MD_invariant_group, nullptr);
5738 }
66 enter:
77 ; CHECK-NOT: !invariant.group
88 ; CHECK-NOT: @llvm.invariant.group.barrier(
9 ; CHECK: %val = load i8, i8* @tmp
10 %val = load i8, i8* @tmp, !invariant.group !0
9 ; CHECK: %val = load i8, i8* @tmp, !tbaa
10 %val = load i8, i8* @tmp, !invariant.group !0, !tbaa !{!1, !1, i64 0}
1111 %ptr = call i8* @llvm.invariant.group.barrier(i8* @tmp)
1212
1313 ; CHECK: store i8 42, i8* @tmp
1919
2020 declare i8* @llvm.invariant.group.barrier(i8*)
2121
22 !0 = !{!"something"}
22 !0 = !{!"something"}
23 !1 = !{!"x", !0}