Skip to content

Commit 46deb40

Browse files
[CodeGen] Use llvm::LLVMContext::MD_nontemporal (NFC)
1 parent 755a73c commit 46deb40

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14504,7 +14504,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
1450414504

1450514505
// Unaligned nontemporal store of the scalar value.
1450614506
StoreInst *SI = Builder.CreateDefaultAlignedStore(Src, BC);
14507-
SI->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node);
14507+
SI->setMetadata(llvm::LLVMContext::MD_nontemporal, Node);
1450814508
SI->setAlignment(llvm::Align(1));
1450914509
return SI;
1451014510
}
@@ -20226,8 +20226,7 @@ Value *CodeGenFunction::EmitRISCVBuiltinExpr(unsigned BuiltinID,
2022620226
LoadInst *Load = Builder.CreateLoad(
2022720227
Address(Ops[0], ResTy, CharUnits::fromQuantity(Width / 8)));
2022820228

20229-
Load->setMetadata(CGM.getModule().getMDKindID("nontemporal"),
20230-
NontemporalNode);
20229+
Load->setMetadata(llvm::LLVMContext::MD_nontemporal, NontemporalNode);
2023120230
Load->setMetadata(CGM.getModule().getMDKindID("riscv-nontemporal-domain"),
2023220231
RISCVDomainNode);
2023320232

@@ -20246,8 +20245,7 @@ Value *CodeGenFunction::EmitRISCVBuiltinExpr(unsigned BuiltinID,
2024620245
Ops[0], llvm::PointerType::getUnqual(Ops[1]->getType()), "cast");
2024720246

2024820247
StoreInst *Store = Builder.CreateDefaultAlignedStore(Ops[1], BC);
20249-
Store->setMetadata(CGM.getModule().getMDKindID("nontemporal"),
20250-
NontemporalNode);
20248+
Store->setMetadata(llvm::LLVMContext::MD_nontemporal, NontemporalNode);
2025120249
Store->setMetadata(CGM.getModule().getMDKindID("riscv-nontemporal-domain"),
2025220250
RISCVDomainNode);
2025320251

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,7 +1777,7 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile,
17771777
if (isNontemporal) {
17781778
llvm::MDNode *Node = llvm::MDNode::get(
17791779
Load->getContext(), llvm::ConstantAsMetadata::get(Builder.getInt32(1)));
1780-
Load->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node);
1780+
Load->setMetadata(llvm::LLVMContext::MD_nontemporal, Node);
17811781
}
17821782

17831783
CGM.DecorateInstructionWithTBAA(Load, TBAAInfo);
@@ -1916,7 +1916,7 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, Address Addr,
19161916
llvm::MDNode *Node =
19171917
llvm::MDNode::get(Store->getContext(),
19181918
llvm::ConstantAsMetadata::get(Builder.getInt32(1)));
1919-
Store->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node);
1919+
Store->setMetadata(llvm::LLVMContext::MD_nontemporal, Node);
19201920
}
19211921

19221922
CGM.DecorateInstructionWithTBAA(Store, TBAAInfo);

0 commit comments

Comments
 (0)