Skip to content

Commit 6e2d9f8

Browse files
Artem Gindinsonigcbot
authored andcommitted
Only use LLVM 14 APIs for attribute manipulation
Rework to avoid using `llvm::AttributeList::addAttribute` API which has been dropped in LLVM 14.
1 parent e6814b1 commit 6e2d9f8

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

IGC/Metrics/IGCMetricImpl.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,15 +1443,16 @@ namespace IGCMetrics
14431443
ArrayRef<Value*> Args,
14441444
llvm::Instruction* insertAfter)
14451445
{
1446-
llvm::AttributeList atrr;
1447-
atrr.addAttribute(pModule->getContext(), 0, llvm::Attribute::AttrKind::OptimizeNone);
1448-
atrr.addAttribute(pModule->getContext(), 1, llvm::Attribute::AttrKind::NoInline);
1449-
atrr.addAttribute(pModule->getContext(), 2, llvm::Attribute::AttrKind::ReadNone);
1450-
atrr.addAttribute(pModule->getContext(), 3, llvm::Attribute::AttrKind::NoAlias);
1446+
auto& ctx = pModule->getContext();
1447+
auto atrr = llvm::AttributeList::get(ctx, {
1448+
{0, llvm::Attribute::get(ctx, llvm::Attribute::AttrKind::OptimizeNone)},
1449+
{1, llvm::Attribute::get(ctx, llvm::Attribute::AttrKind::NoInline)},
1450+
{2, llvm::Attribute::get(ctx, llvm::Attribute::AttrKind::ReadNone)},
1451+
{3, llvm::Attribute::get(ctx, llvm::Attribute::AttrKind::NoAlias)} });
14511452

14521453
auto funcType = llvm::FunctionType::get(
1453-
llvm::Type::getVoidTy(pModule->getContext()),
1454-
{ llvm::Type::getMetadataTy(pModule->getContext()), llvm::Type::getMetadataTy(pModule->getContext()) }, false);
1454+
llvm::Type::getVoidTy(ctx),
1455+
{ llvm::Type::getMetadataTy(ctx), llvm::Type::getMetadataTy(ctx) }, false);
14551456

14561457
auto funcVal = pModule->getOrInsertFunction(trackCall, funcType, atrr);
14571458

0 commit comments

Comments
 (0)