Skip to content

Commit 33d18b2

Browse files
committed
fixup! Switch to fixed MD
Created using spr 1.3.8-beta.1
2 parents cb3d52d + 5397b6b commit 33d18b2

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ void CodeGenFunction::EmitAllocTokenHint(llvm::CallBase *CB,
13391339
// Format: !{<type-name>, <contains-pointer>}
13401340
auto *MDN =
13411341
llvm::MDNode::get(CGM.getLLVMContext(), {TypeNameMD, ContainsPtrMD});
1342-
CB->setMetadata("alloc_token_hint", MDN);
1342+
CB->setMetadata(llvm::LLVMContext::MD_alloc_token_hint, MDN);
13431343
}
13441344

13451345
CodeGenFunction::ComplexPairTy CodeGenFunction::

llvm/include/llvm/IR/FixedMetadataKinds.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ LLVM_FIXED_MD_KIND(MD_mmra, "mmra", 40)
5555
LLVM_FIXED_MD_KIND(MD_noalias_addrspace, "noalias.addrspace", 41)
5656
LLVM_FIXED_MD_KIND(MD_callee_type, "callee_type", 42)
5757
LLVM_FIXED_MD_KIND(MD_nofree, "nofree", 43)
58+
LLVM_FIXED_MD_KIND(MD_alloc_token_hint, "alloc_token_hint", 44)

llvm/lib/Transforms/Instrumentation/AllocToken.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ STATISTIC(NumAllocations, "Allocations found");
149149
///
150150
/// Expected format is: !{<type-name>, <contains-pointer>}
151151
MDNode *getAllocTokenHintMetadata(const CallBase &CB) {
152-
MDNode *Ret = CB.getMetadata("alloc_token_hint");
152+
MDNode *Ret = CB.getMetadata(LLVMContext::MD_alloc_token_hint);
153153
if (!Ret)
154154
return nullptr;
155155
assert(Ret->getNumOperands() == 2 && "bad !alloc_token_hint");

llvm/lib/Transforms/Utils/Local.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3025,6 +3025,10 @@ static void combineMetadata(Instruction *K, const Instruction *J,
30253025
// Preserve !nosanitize if both K and J have it.
30263026
K->setMetadata(Kind, JMD);
30273027
break;
3028+
case LLVMContext::MD_alloc_token_hint:
3029+
// Preserve !alloc_token_hint if both K and J have it.
3030+
K->setMetadata(Kind, JMD);
3031+
break;
30283032
}
30293033
}
30303034
// Set !invariant.group from J if J has it. If both instructions have it

0 commit comments

Comments
 (0)