From 46deb4092d84c02463c5e8ebd664288eab6cdc56 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 29 May 2023 00:41:51 -0700 Subject: [PATCH] [CodeGen] Use llvm::LLVMContext::MD_nontemporal (NFC) --- clang/lib/CodeGen/CGBuiltin.cpp | 8 +++----- clang/lib/CodeGen/CGExpr.cpp | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index a0bb35d..3a61fdd 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -14504,7 +14504,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID, // Unaligned nontemporal store of the scalar value. StoreInst *SI = Builder.CreateDefaultAlignedStore(Src, BC); - SI->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node); + SI->setMetadata(llvm::LLVMContext::MD_nontemporal, Node); SI->setAlignment(llvm::Align(1)); return SI; } @@ -20226,8 +20226,7 @@ Value *CodeGenFunction::EmitRISCVBuiltinExpr(unsigned BuiltinID, LoadInst *Load = Builder.CreateLoad( Address(Ops[0], ResTy, CharUnits::fromQuantity(Width / 8))); - Load->setMetadata(CGM.getModule().getMDKindID("nontemporal"), - NontemporalNode); + Load->setMetadata(llvm::LLVMContext::MD_nontemporal, NontemporalNode); Load->setMetadata(CGM.getModule().getMDKindID("riscv-nontemporal-domain"), RISCVDomainNode); @@ -20246,8 +20245,7 @@ Value *CodeGenFunction::EmitRISCVBuiltinExpr(unsigned BuiltinID, Ops[0], llvm::PointerType::getUnqual(Ops[1]->getType()), "cast"); StoreInst *Store = Builder.CreateDefaultAlignedStore(Ops[1], BC); - Store->setMetadata(CGM.getModule().getMDKindID("nontemporal"), - NontemporalNode); + Store->setMetadata(llvm::LLVMContext::MD_nontemporal, NontemporalNode); Store->setMetadata(CGM.getModule().getMDKindID("riscv-nontemporal-domain"), RISCVDomainNode); diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index c074732..35d4a1a 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -1777,7 +1777,7 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile, if (isNontemporal) { llvm::MDNode *Node = llvm::MDNode::get( Load->getContext(), llvm::ConstantAsMetadata::get(Builder.getInt32(1))); - Load->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node); + Load->setMetadata(llvm::LLVMContext::MD_nontemporal, Node); } CGM.DecorateInstructionWithTBAA(Load, TBAAInfo); @@ -1916,7 +1916,7 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, Address Addr, llvm::MDNode *Node = llvm::MDNode::get(Store->getContext(), llvm::ConstantAsMetadata::get(Builder.getInt32(1))); - Store->setMetadata(CGM.getModule().getMDKindID("nontemporal"), Node); + Store->setMetadata(llvm::LLVMContext::MD_nontemporal, Node); } CGM.DecorateInstructionWithTBAA(Store, TBAAInfo); -- 2.7.4