Skip to content

Commit 12ba74e

Browse files
authored
[flang] Do not produce result for void runtime call (#123155)
Runtime function call to a void function are producing a ssa value because the FunctionType result is set to NoneType with is later translated to a empty struct. This is not an issue when going to LLVM IR but it breaks when lowering a gpu module to PTX. This patch update the RTModel to correctly set the FunctionType result type to nothing. This is one runtime call before this patch at the LLVM IR dialect step. ``` %45 = llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> !llvm.struct<()> ``` After the patch the call would be correctly formed ``` llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> () ``` Without the patch it would lead to error like: ``` ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 10; error : Output parameter cannot be an incomplete array. ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 125; error : Call has wrong number of parameters ``` The change is pretty much mechanical.
1 parent cc61929 commit 12ba74e

File tree

161 files changed

+639
-647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+639
-647
lines changed

flang/docs/OpenACC-descriptor-management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ acc.attach.recipe @attach_ref :
348348
%offset : index,
349349
%size : index):
350350
fir.call _FortranAOpenACCAttachDescriptor(%aug_ptr, %base_addr_val, %offset, %size) :
351-
(!fir.ref<none>, !fir.ref<!fir.box<none>>, index, index) -> none
351+
(!fir.ref<none>, !fir.ref<!fir.box<none>>, index, index) -> ()
352352
acc.yield
353353
}
354354

flang/docs/ParameterizedDerivedTypes.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -435,16 +435,16 @@ allocate(t1(2)::p)
435435
**FIR**
436436
```
437437
// For allocatable
438-
%5 = fir.call @_FortranAAllocatableInitDerived(%desc, %type) : (!fir.box<none>, ) -> ()
438+
fir.call @_FortranAAllocatableInitDerived(%desc, %type) : (!fir.box<none>, ) -> ()
439439
// The AllocatableSetDerivedLength functions is called for each length type parameters.
440-
%6 = fir.call @_FortranAAllocatableSetDerivedLength(%desc, %pos, %value) : (!fir.box<none>, i32, i64) -> ()
441-
%7 = fir.call @_FortranAAllocatableAllocate(%3) : (!fir.box<none>) -> ()
440+
fir.call @_FortranAAllocatableSetDerivedLength(%desc, %pos, %value) : (!fir.box<none>, i32, i64) -> ()
441+
fir.call @_FortranAAllocatableAllocate(%3) : (!fir.box<none>) -> ()
442442
443443
// For pointer
444-
%5 = fir.call @_FortranAPointerNullifyDerived(%desc, %type) : (!fir.box<none>, ) -> ()
444+
fir.call @_FortranAPointerNullifyDerived(%desc, %type) : (!fir.box<none>, ) -> ()
445445
// The PointerSetDerivedLength functions is called for each length type parameters.
446-
%6 = fir.call @_FortranAPointerSetDerivedLength(%desc, %pos, %value) : (!fir.box<none>, i32, i64) -> ()
447-
%7 = fir.call @_FortranAPointerAllocate(%3) : (!fir.box<none>) -> ()
446+
fir.call @_FortranAPointerSetDerivedLength(%desc, %pos, %value) : (!fir.box<none>, i32, i64) -> ()
447+
fir.call @_FortranAPointerAllocate(%3) : (!fir.box<none>) -> ()
448448
```
449449

450450
`DEALLOCATE`
@@ -478,7 +478,7 @@ NULLIFY(p)
478478

479479
**FIR**
480480
```
481-
%0 = fir.call @_FortranAPointerNullifyDerived(%desc, %type) : (!fir.box<none>, !fir.tdesc) -> ()
481+
fir.call @_FortranAPointerNullifyDerived(%desc, %type) : (!fir.box<none>, !fir.tdesc) -> ()
482482
```
483483

484484
#### Formatted I/O
@@ -518,7 +518,7 @@ func.func @_QMpdtPprint_pdt() {
518518
%c8_i32 = arith.constant 8 : i32
519519
%3 = fir.convert %1 : (!fir.box<!fir.type<_QMpdtTt{l:i32,i:!fir.array<?xi32>}>>) -> !fir.box<none>
520520
%4 = fir.convert %2 : (!fir.ref<!fir.char<1,22>>) -> !fir.ref<i8>
521-
%5 = fir.call @_FortranAInitialize(%3, %4, %c8_i32) : (!fir.box<none>, !fir.ref<i8>, i32) -> none
521+
fir.call @_FortranAInitialize(%3, %4, %c8_i32) : (!fir.box<none>, !fir.ref<i8>, i32) -> ()
522522
%c-1_i32 = arith.constant -1 : i32
523523
%6 = fir.address_of(@_QQcl.2E2F6669725F7064745F6578616D706C652E66393000) : !fir.ref<!fir.char<1,22>>
524524
%7 = fir.convert %6 : (!fir.ref<!fir.char<1,22>>) -> !fir.ref<i8>
@@ -882,7 +882,7 @@ func.func @_QMpdt_initPlocal() {
882882
%c8_i32 = arith.constant 8 : i32
883883
%3 = fir.convert %1 : (!fir.box<!fir.type<_QMpdt_initTt{l:i32,i:!fir.array<?xi32>}>>) -> !fir.box<none>
884884
%4 = fir.convert %2 : (!fir.ref<!fir.char<1,22>>) -> !fir.ref<i8>
885-
%5 = fir.call @_FortranAInitialize(%3, %4, %c8_i32) : (!fir.box<none>, !fir.ref<i8>, i32) -> none
885+
fir.call @_FortranAInitialize(%3, %4, %c8_i32) : (!fir.box<none>, !fir.ref<i8>, i32) -> ()
886886
return
887887
}
888888
```

flang/docs/PolymorphicEntities.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ finalization with a call the the `@_FortranADestroy` function
609609

610610
**FIR**
611611
```
612-
%5 = fir.call @_FortranADestroy(%desc) : (!fir.box<none>) -> none
612+
fir.call @_FortranADestroy(%desc) : (!fir.box<none>) -> ()
613613
```
614614

615615
The `@_FortranADestroy` function will take care to call the final subroutines

flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,8 @@ struct RuntimeTableKey<RT(ATs...)> {
674674
llvm::SmallVector<mlir::Type, sizeof...(ATs)> argTys;
675675
for (auto f : args)
676676
argTys.push_back(f(ctxt));
677+
if (mlir::isa<mlir::NoneType>(retTy))
678+
return mlir::FunctionType::get(ctxt, argTys, {});
677679
return mlir::FunctionType::get(ctxt, argTys, {retTy});
678680
};
679681
}

flang/include/flang/Optimizer/Dialect/FIRType.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ inline mlir::Type wrapInClassOrBoxType(mlir::Type eleTy,
439439
/// Return the elementType where intrinsic types are replaced with none for
440440
/// unlimited polymorphic entities.
441441
///
442-
/// i32 -> none
442+
/// i32 -> ()
443443
/// !fir.array<2xf32> -> !fir.array<2xnone>
444444
/// !fir.heap<!fir.array<2xf32>> -> !fir.heap<!fir.array<2xnone>>
445445
inline mlir::Type updateTypeForUnlimitedPolymorphic(mlir::Type ty) {

flang/lib/Lower/Runtime.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void Fortran::lower::genPointerAssociate(fir::FirOpBuilder &builder,
210210
fir::runtime::getRuntimeFunc<mkRTKey(PointerAssociate)>(loc, builder);
211211
llvm::SmallVector<mlir::Value> args = fir::runtime::createArguments(
212212
builder, loc, func.getFunctionType(), pointer, target);
213-
builder.create<fir::CallOp>(loc, func, args).getResult(0);
213+
builder.create<fir::CallOp>(loc, func, args);
214214
}
215215

216216
void Fortran::lower::genPointerAssociateRemapping(fir::FirOpBuilder &builder,
@@ -228,7 +228,7 @@ void Fortran::lower::genPointerAssociateRemapping(fir::FirOpBuilder &builder,
228228
llvm::SmallVector<mlir::Value> args = fir::runtime::createArguments(
229229
builder, loc, func.getFunctionType(), pointer, target, bounds, sourceFile,
230230
sourceLine);
231-
builder.create<fir::CallOp>(loc, func, args).getResult(0);
231+
builder.create<fir::CallOp>(loc, func, args);
232232
}
233233

234234
void Fortran::lower::genPointerAssociateLowerBounds(fir::FirOpBuilder &builder,
@@ -241,5 +241,5 @@ void Fortran::lower::genPointerAssociateLowerBounds(fir::FirOpBuilder &builder,
241241
loc, builder);
242242
llvm::SmallVector<mlir::Value> args = fir::runtime::createArguments(
243243
builder, loc, func.getFunctionType(), pointer, target, lbounds);
244-
builder.create<fir::CallOp>(loc, func, args).getResult(0);
244+
builder.create<fir::CallOp>(loc, func, args);
245245
}

flang/lib/Optimizer/Builder/Runtime/Inquiry.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void fir::runtime::genLbound(fir::FirOpBuilder &builder, mlir::Location loc,
4040
fir::factory::locationToLineNo(builder, loc, fTy.getInput(4));
4141
auto args = fir::runtime::createArguments(
4242
builder, loc, fTy, resultAddr, array, kind, sourceFile, sourceLine);
43-
builder.create<fir::CallOp>(loc, func, args).getResult(0);
43+
builder.create<fir::CallOp>(loc, func, args);
4444
}
4545

4646
/// Generate call to `Ubound` runtime routine. Calls to UBOUND with a DIM
@@ -57,7 +57,7 @@ void fir::runtime::genUbound(fir::FirOpBuilder &builder, mlir::Location loc,
5757
fir::factory::locationToLineNo(builder, loc, fTy.getInput(2));
5858
auto args = fir::runtime::createArguments(builder, loc, fTy, resultBox, array,
5959
kind, sourceFile, sourceLine);
60-
builder.create<fir::CallOp>(loc, uboundFunc, args).getResult(0);
60+
builder.create<fir::CallOp>(loc, uboundFunc, args);
6161
}
6262

6363
/// Generate call to `Size` runtime routine. This routine is a version when
@@ -113,5 +113,5 @@ void fir::runtime::genShape(fir::FirOpBuilder &builder, mlir::Location loc,
113113
fir::factory::locationToLineNo(builder, loc, fTy.getInput(4));
114114
auto args = fir::runtime::createArguments(
115115
builder, loc, fTy, resultAddr, array, kind, sourceFile, sourceLine);
116-
builder.create<fir::CallOp>(loc, func, args).getResult(0);
116+
builder.create<fir::CallOp>(loc, func, args);
117117
}

flang/lib/Optimizer/Builder/Runtime/Intrinsics.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ struct ForcedRandomNumberReal16 {
3838
auto strTy = fir::runtime::getModel<const char *>()(ctx);
3939
auto intTy = fir::runtime::getModel<int>()(ctx);
4040
;
41-
return mlir::FunctionType::get(ctx, {boxTy, strTy, intTy},
42-
mlir::NoneType::get(ctx));
41+
return mlir::FunctionType::get(ctx, {boxTy, strTy, intTy}, {});
4342
};
4443
}
4544
};

flang/lib/Optimizer/Builder/Runtime/Reduction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ struct ForcedNorm2DimReal16 {
209209
auto intTy = mlir::IntegerType::get(ctx, 8 * sizeof(int));
210210
return mlir::FunctionType::get(
211211
ctx, {fir::ReferenceType::get(boxTy), boxTy, intTy, strTy, intTy},
212-
mlir::NoneType::get(ctx));
212+
{});
213213
};
214214
}
215215
};

flang/lib/Optimizer/Builder/Runtime/Transformational.cpp

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ struct ForcedBesselJn_10 {
3030
fir::runtime::getModel<Fortran::runtime::Descriptor &>()(ctx);
3131
auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8));
3232
auto intTy = mlir::IntegerType::get(ctx, 32);
33-
auto noneTy = mlir::NoneType::get(ctx);
3433
return mlir::FunctionType::get(
35-
ctx, {boxTy, intTy, intTy, ty, ty, ty, strTy, intTy}, {noneTy});
34+
ctx, {boxTy, intTy, intTy, ty, ty, ty, strTy, intTy}, {});
3635
};
3736
}
3837
};
@@ -47,9 +46,8 @@ struct ForcedBesselJn_16 {
4746
fir::runtime::getModel<Fortran::runtime::Descriptor &>()(ctx);
4847
auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8));
4948
auto intTy = mlir::IntegerType::get(ctx, 32);
50-
auto noneTy = mlir::NoneType::get(ctx);
5149
return mlir::FunctionType::get(
52-
ctx, {boxTy, intTy, intTy, ty, ty, ty, strTy, intTy}, {noneTy});
50+
ctx, {boxTy, intTy, intTy, ty, ty, ty, strTy, intTy}, {});
5351
};
5452
}
5553
};
@@ -63,9 +61,8 @@ struct ForcedBesselJnX0_10 {
6361
fir::runtime::getModel<Fortran::runtime::Descriptor &>()(ctx);
6462
auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8));
6563
auto intTy = mlir::IntegerType::get(ctx, 32);
66-
auto noneTy = mlir::NoneType::get(ctx);
6764
return mlir::FunctionType::get(ctx, {boxTy, intTy, intTy, strTy, intTy},
68-
{noneTy});
65+
{});
6966
};
7067
}
7168
};
@@ -79,9 +76,8 @@ struct ForcedBesselJnX0_16 {
7976
fir::runtime::getModel<Fortran::runtime::Descriptor &>()(ctx);
8077
auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8));
8178
auto intTy = mlir::IntegerType::get(ctx, 32);
82-
auto noneTy = mlir::NoneType::get(ctx);
8379
return mlir::FunctionType::get(ctx, {boxTy, intTy, intTy, strTy, intTy},
84-
{noneTy});
80+
{});
8581
};
8682
}
8783
};
@@ -96,9 +92,8 @@ struct ForcedBesselYn_10 {
9692
fir::runtime::getModel<Fortran::runtime::Descriptor &>()(ctx);
9793
auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8));
9894
auto intTy = mlir::IntegerType::get(ctx, 32);
99-
auto noneTy = mlir::NoneType::get(ctx);
10095
return mlir::FunctionType::get(
101-
ctx, {boxTy, intTy, intTy, ty, ty, ty, strTy, intTy}, {noneTy});
96+
ctx, {boxTy, intTy, intTy, ty, ty, ty, strTy, intTy}, {});
10297
};
10398
}
10499
};
@@ -113,9 +108,8 @@ struct ForcedBesselYn_16 {
113108
fir::runtime::getModel<Fortran::runtime::Descriptor &>()(ctx);
114109
auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8));
115110
auto intTy = mlir::IntegerType::get(ctx, 32);
116-
auto noneTy = mlir::NoneType::get(ctx);
117111
return mlir::FunctionType::get(
118-
ctx, {boxTy, intTy, intTy, ty, ty, ty, strTy, intTy}, {noneTy});
112+
ctx, {boxTy, intTy, intTy, ty, ty, ty, strTy, intTy}, {});
119113
};
120114
}
121115
};
@@ -129,9 +123,8 @@ struct ForcedBesselYnX0_10 {
129123
fir::runtime::getModel<Fortran::runtime::Descriptor &>()(ctx);
130124
auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8));
131125
auto intTy = mlir::IntegerType::get(ctx, 32);
132-
auto noneTy = mlir::NoneType::get(ctx);
133126
return mlir::FunctionType::get(ctx, {boxTy, intTy, intTy, strTy, intTy},
134-
{noneTy});
127+
{});
135128
};
136129
}
137130
};
@@ -145,9 +138,8 @@ struct ForcedBesselYnX0_16 {
145138
fir::runtime::getModel<Fortran::runtime::Descriptor &>()(ctx);
146139
auto strTy = fir::ReferenceType::get(mlir::IntegerType::get(ctx, 8));
147140
auto intTy = mlir::IntegerType::get(ctx, 32);
148-
auto noneTy = mlir::NoneType::get(ctx);
149141
return mlir::FunctionType::get(ctx, {boxTy, intTy, intTy, strTy, intTy},
150-
{noneTy});
142+
{});
151143
};
152144
}
153145
};
@@ -339,9 +331,8 @@ struct ForcedMatmulTypeModel {
339331
fir::runtime::getModel<const Fortran::runtime::Descriptor &>()(ctx);
340332
auto strTy = fir::runtime::getModel<const char *>()(ctx);
341333
auto intTy = fir::runtime::getModel<int>()(ctx);
342-
auto voidTy = fir::runtime::getModel<void>()(ctx);
343334
return mlir::FunctionType::get(
344-
ctx, {boxRefTy, boxTy, boxTy, strTy, intTy}, {voidTy});
335+
ctx, {boxRefTy, boxTy, boxTy, strTy, intTy}, {});
345336
};
346337
}
347338
};

flang/test/Analysis/AliasAnalysis/ptr-component.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func.func @_QMmPfoo.fir(%arg0: !fir.ref<!fir.type<_QMmTt{next:!fir.box<!fir.ptr<
101101
%17 = fir.convert %0 : (!fir.ref<!fir.box<!fir.type<_QMmTt{next:!fir.box<!fir.ptr<!fir.type<_QMmTt>>>,i:i32}>>>) -> !fir.ref<!fir.box<none>>
102102
%18 = fir.convert %15 : (!fir.box<!fir.type<_QMmTt{next:!fir.box<!fir.ptr<!fir.type<_QMmTt>>>,i:i32}>>) -> !fir.box<none>
103103
%19 = fir.convert %16 : (!fir.ref<!fir.char<1,9>>) -> !fir.ref<i8>
104-
%20 = fir.call @_FortranAAssign(%17, %18, %19, %c14_i32) : (!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.ref<i8>, i32) -> none
104+
fir.call @_FortranAAssign(%17, %18, %19, %c14_i32) : (!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.ref<i8>, i32) -> ()
105105
%21 = fir.field_index next, !fir.type<_QMmTt{next:!fir.box<!fir.ptr<!fir.type<_QMmTt>>>,i:i32}>
106106
%22 = fir.coordinate_of %5, %21 {test.ptr="xnext2.fir"}: (!fir.ref<!fir.type<_QMmTt{next:!fir.box<!fir.ptr<!fir.type<_QMmTt>>>,i:i32}>>, !fir.field) -> !fir.ref<!fir.box<!fir.ptr<!fir.type<_QMmTt{next:!fir.box<!fir.ptr<!fir.type<_QMmTt>>>,i:i32}>>>>
107107
%23 = fir.load %22 : !fir.ref<!fir.box<!fir.ptr<!fir.type<_QMmTt{next:!fir.box<!fir.ptr<!fir.type<_QMmTt>>>,i:i32}>>>>

flang/test/Fir/CUDA/cuda-alloc-free.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func.func @_QPsub1() {
1515
// CHECK: %[[CONV:.*]] = fir.convert %3 : (!fir.llvm_ptr<i8>) -> !fir.ref<i32>
1616
// CHECK: %[[DECL:.*]]:2 = hlfir.declare %[[CONV]] {data_attr = #cuf.cuda<device>, uniq_name = "_QFsub1Eidev"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
1717
// CHECK: %[[DEVPTR:.*]] = fir.convert %[[DECL]]#1 : (!fir.ref<i32>) -> !fir.llvm_ptr<i8>
18-
// CHECK: fir.call @_FortranACUFMemFree(%[[DEVPTR]], %c0{{.*}}, %{{.*}}, %{{.*}}) : (!fir.llvm_ptr<i8>, i32, !fir.ref<i8>, i32) -> none
18+
// CHECK: fir.call @_FortranACUFMemFree(%[[DEVPTR]], %c0{{.*}}, %{{.*}}, %{{.*}}) : (!fir.llvm_ptr<i8>, i32, !fir.ref<i8>, i32) -> ()
1919

2020
func.func @_QPsub2() {
2121
%0 = cuf.alloc !fir.array<10xf32> {bindc_name = "a", data_attr = #cuf.cuda<device>, uniq_name = "_QMcuda_varFcuda_alloc_freeEa"} -> !fir.ref<!fir.array<10xf32>>

flang/test/Fir/CUDA/cuda-allocate.fir

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func.func @_QPsub1() {
2424
// CHECK: %[[BOX_NONE:.*]] = fir.convert %[[DECL_DESC]]#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>>
2525
// CHECK: %{{.*}} = fir.call @_FortranAAllocatableDeallocate(%[[BOX_NONE]], %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!fir.ref<!fir.box<none>>, i1, !fir.box<none>, !fir.ref<i8>, i32) -> i32
2626
// CHECK: %[[BOX_NONE:.*]] = fir.convert %[[DECL_DESC]]#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>>
27-
// CHECK: fir.call @_FortranACUFFreeDescriptor(%[[BOX_NONE]], %{{.*}}, %{{.*}}) : (!fir.ref<!fir.box<none>>, !fir.ref<i8>, i32) -> none
27+
// CHECK: fir.call @_FortranACUFFreeDescriptor(%[[BOX_NONE]], %{{.*}}, %{{.*}}) : (!fir.ref<!fir.box<none>>, !fir.ref<i8>, i32) -> ()
2828

2929
fir.global @_QMmod1Ea {data_attr = #cuf.cuda<device>} : !fir.box<!fir.heap<!fir.array<?xf32>>> {
3030
%0 = fir.zero_bits !fir.heap<!fir.array<?xf32>>
@@ -80,7 +80,7 @@ func.func @_QPsub5() {
8080
%6 = fir.convert %5#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>>
8181
%7 = fir.convert %c1 : (index) -> i64
8282
%8 = fir.convert %c10_i32 : (i32) -> i64
83-
%9 = fir.call @_FortranAAllocatableSetBounds(%6, %c0_i32, %7, %8) fastmath<contract> : (!fir.ref<!fir.box<none>>, i32, i64, i64) -> none
83+
fir.call @_FortranAAllocatableSetBounds(%6, %c0_i32, %7, %8) fastmath<contract> : (!fir.ref<!fir.box<none>>, i32, i64, i64) -> ()
8484
%10 = cuf.allocate %5#1 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> {data_attr = #cuf.cuda<pinned>} -> i32
8585
%11 = cuf.deallocate %5#1 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> {data_attr = #cuf.cuda<pinned>} -> i32
8686
return
@@ -108,7 +108,7 @@ func.func @_QQsub6() attributes {fir.bindc_name = "test"} {
108108
%2 = fir.convert %1#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>) -> !fir.ref<!fir.box<none>>
109109
%3 = fir.convert %c1 : (index) -> i64
110110
%4 = fir.convert %c10_i32 : (i32) -> i64
111-
%5 = fir.call @_FortranAAllocatableSetBounds(%2, %c0_i32, %3, %4) fastmath<contract> : (!fir.ref<!fir.box<none>>, i32, i64, i64) -> none
111+
fir.call @_FortranAAllocatableSetBounds(%2, %c0_i32, %3, %4) fastmath<contract> : (!fir.ref<!fir.box<none>>, i32, i64, i64) -> ()
112112
%6 = cuf.allocate %1#1 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>> {data_attr = #cuf.cuda<device>} -> i32
113113
return
114114
}

flang/test/Fir/CUDA/cuda-code-gen.mlir

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<f80 = dense<128> : vector<2xi64>
9191
%16 = fir.convert %6 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>) -> !fir.ref<!fir.box<none>>
9292
%17 = fir.convert %c1 : (index) -> i64
9393
%18 = fir.convert %c16_i32 : (i32) -> i64
94-
%19 = fir.call @_FortranAAllocatableSetBounds(%16, %c0_i32, %17, %18) fastmath<contract> : (!fir.ref<!fir.box<none>>, i32, i64, i64) -> none
95-
%20 = fir.call @_FortranAAllocatableSetBounds(%16, %c1_i32, %17, %18) fastmath<contract> : (!fir.ref<!fir.box<none>>, i32, i64, i64) -> none
94+
fir.call @_FortranAAllocatableSetBounds(%16, %c0_i32, %17, %18) fastmath<contract> : (!fir.ref<!fir.box<none>>, i32, i64, i64) -> ()
95+
fir.call @_FortranAAllocatableSetBounds(%16, %c1_i32, %17, %18) fastmath<contract> : (!fir.ref<!fir.box<none>>, i32, i64, i64) -> ()
9696
%21 = fir.address_of(@_QQclX64756D6D792E6D6C697200) : !fir.ref<!fir.char<1,11>>
9797
%c31_i32 = arith.constant 31 : i32
9898
%false = arith.constant false
@@ -102,7 +102,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<f80 = dense<128> : vector<2xi64>
102102
%24 = fir.convert %21 : (!fir.ref<!fir.char<1,11>>) -> !fir.ref<i8>
103103
%25 = fir.call @_FortranACUFAllocatableAllocate(%23, %c-1_i64, %false, %22, %24, %c31_i32) : (!fir.ref<!fir.box<none>>, i64, i1, !fir.box<none>, !fir.ref<i8>, i32) -> i32
104104
%26 = fir.convert %13 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>>
105-
%27 = fir.call @_FortranAAllocatableSetBounds(%26, %c0_i32, %17, %18) fastmath<contract> : (!fir.ref<!fir.box<none>>, i32, i64, i64) -> none
105+
fir.call @_FortranAAllocatableSetBounds(%26, %c0_i32, %17, %18) fastmath<contract> : (!fir.ref<!fir.box<none>>, i32, i64, i64) -> ()
106106
%28 = fir.address_of(@_QQclX64756D6D792E6D6C697200) : !fir.ref<!fir.char<1,11>>
107107
%c34_i32 = arith.constant 34 : i32
108108
%false_0 = arith.constant false
@@ -115,7 +115,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<f80 = dense<128> : vector<2xi64>
115115
%34 = fircg.ext_rebox %33 : (!fir.box<!fir.heap<!fir.array<?x?xf32>>>) -> !fir.box<!fir.array<?x?xf32>>
116116
return
117117
}
118-
func.func private @_FortranAAllocatableSetBounds(!fir.ref<!fir.box<none>>, i32, i64, i64) -> none attributes {fir.runtime}
118+
func.func private @_FortranAAllocatableSetBounds(!fir.ref<!fir.box<none>>, i32, i64, i64) -> () attributes {fir.runtime}
119119
fir.global linkonce @_QQclX64756D6D792E6D6C697200 constant : !fir.char<1,11> {
120120
%0 = fir.string_lit "dummy.mlir\00"(11) : !fir.char<1,11>
121121
fir.has_value %0 : !fir.char<1,11>
@@ -165,7 +165,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<!llvm.ptr<270> = dense<32> : vec
165165
fir.has_value %0 : !fir.char<1,8>
166166
}
167167
func.func private @_FortranACUFAllocDescriptor(i64, !fir.ref<i8>, i32) -> !fir.ref<!fir.box<none>> attributes {fir.runtime}
168-
func.func private @_FortranACUFFreeDescriptor(!fir.ref<!fir.box<none>>, !fir.ref<i8>, i32) -> none attributes {fir.runtime}
168+
func.func private @_FortranACUFFreeDescriptor(!fir.ref<!fir.box<none>>, !fir.ref<i8>, i32) -> () attributes {fir.runtime}
169169
}
170170

171171
// CHECK-LABEL: llvm.func @_QQmain()

0 commit comments

Comments
 (0)