Skip to content

Commit

Permalink
[CodeGen] Use llvm::LLVMContext::MD_nontemporal (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed May 29, 2023
1 parent 755a73c commit 46deb40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions clang/lib/CodeGen/CGBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);

Expand All @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CodeGen/CGExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 46deb40

Please sign in to comment.