Skip to content

Commit b9a67a9

Browse files
committed
remove argIdx arg + style nits
1 parent f062d78 commit b9a67a9

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class ModuleTranslation {
230230

231231
/// Translates parameter attributes of a call and adds them to the returned
232232
/// AttrBuilder. Returns failure if any of the translations failed.
233-
FailureOr<llvm::AttrBuilder> convertParameterAttrs(CallOp callOp, int argIdx,
233+
FailureOr<llvm::AttrBuilder> convertParameterAttrs(CallOp callOp,
234234
DictionaryAttr paramAttrs);
235235

236236
/// Gets the named metadata in the LLVM IR module being constructed, creating

mlir/lib/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,26 +265,28 @@ convertOperationImpl(Operation &opInst, llvm::IRBuilderBase &builder,
265265
if (callOp.getWillReturnAttr())
266266
call->addFnAttr(llvm::Attribute::WillReturn);
267267

268-
if (ArrayAttr argAttrsArray = callOp.getArgAttrsAttr())
268+
if (ArrayAttr argAttrsArray = callOp.getArgAttrsAttr()) {
269269
for (auto [argIdx, argAttrsAttr] : llvm::enumerate(argAttrsArray)) {
270270
if (auto argAttrs = llvm::cast<DictionaryAttr>(argAttrsAttr)) {
271271
FailureOr<llvm::AttrBuilder> attrBuilder =
272-
moduleTranslation.convertParameterAttrs(callOp, argIdx, argAttrs);
272+
moduleTranslation.convertParameterAttrs(callOp, argAttrs);
273273
if (failed(attrBuilder))
274274
return failure();
275275
call->addParamAttrs(argIdx, *attrBuilder);
276276
}
277277
}
278+
}
278279

279280
ArrayAttr resAttrsArray = callOp.getResAttrsAttr();
280-
if (resAttrsArray && resAttrsArray.size() == 1)
281+
if (resAttrsArray && resAttrsArray.size() == 1) {
281282
if (auto resAttrs = llvm::cast<DictionaryAttr>(resAttrsArray[0])) {
282283
FailureOr<llvm::AttrBuilder> attrBuilder =
283-
moduleTranslation.convertParameterAttrs(callOp, -1, resAttrs);
284+
moduleTranslation.convertParameterAttrs(callOp, resAttrs);
284285
if (failed(attrBuilder))
285286
return failure();
286287
call->addRetAttrs(*attrBuilder);
287288
}
289+
}
288290

289291
if (MemoryEffectsAttr memAttr = callOp.getMemoryEffectsAttr()) {
290292
llvm::MemoryEffects memEffects =

mlir/lib/Target/LLVMIR/ModuleTranslation.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,8 +1604,7 @@ ModuleTranslation::convertParameterAttrs(LLVMFuncOp func, int argIdx,
16041604
}
16051605

16061606
FailureOr<llvm::AttrBuilder>
1607-
ModuleTranslation::convertParameterAttrs(CallOp, int argIdx,
1608-
DictionaryAttr paramAttrs) {
1607+
ModuleTranslation::convertParameterAttrs(CallOp, DictionaryAttr paramAttrs) {
16091608
llvm::AttrBuilder attrBuilder(llvmModule->getContext());
16101609
auto attrNameToKindMapping = getAttrNameToKindMapping();
16111610

mlir/test/Target/LLVMIR/call-argument-attributes.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ llvm.func @test_call_arg_attrs_direct(%arg0: i32, %arg1: !llvm.ptr) {
99
llvm.return
1010
}
1111

12-
// CHECK-LABEL: define i16 @test_call_arg_attrs_indirec
12+
// CHECK-LABEL: define i16 @test_call_arg_attrs_indirect
1313
llvm.func @test_call_arg_attrs_indirect(%arg0: i16, %arg1: !llvm.ptr) -> i16 {
1414
// CHECK: tail call signext i16 %{{.*}}(i16 noundef signext %{{.*}})
1515
%0 = llvm.call tail %arg1(%arg0) : !llvm.ptr, (i16 {llvm.noundef, llvm.signext}) -> (i16 {llvm.signext})

0 commit comments

Comments
 (0)