diff --git a/flang/include/flang/Optimizer/Builder/FIRBuilder.h b/flang/include/flang/Optimizer/Builder/FIRBuilder.h --- a/flang/include/flang/Optimizer/Builder/FIRBuilder.h +++ b/flang/include/flang/Optimizer/Builder/FIRBuilder.h @@ -377,10 +377,10 @@ } /// Generate code testing \p addr is not a null address. - mlir::Value genIsNotNull(mlir::Location loc, mlir::Value addr); + mlir::Value genIsNotNullAddr(mlir::Location loc, mlir::Value addr); /// Generate code testing \p addr is a null address. - mlir::Value genIsNull(mlir::Location loc, mlir::Value addr); + mlir::Value genIsNullAddr(mlir::Location loc, mlir::Value addr); /// Compute the extent of (lb:ub:step) as max((ub-lb+step)/step, 0). See /// Fortran 2018 9.5.3.3.2 section for more details. diff --git a/flang/lib/Lower/CustomIntrinsicCall.cpp b/flang/lib/Lower/CustomIntrinsicCall.cpp --- a/flang/lib/Lower/CustomIntrinsicCall.cpp +++ b/flang/lib/Lower/CustomIntrinsicCall.cpp @@ -52,14 +52,14 @@ Fortran::evaluate::MayBePassedAsAbsentOptional(*expr, foldingContex); } -/// Is this a call to SYSTEM_CLOCK or RANDOM_SEED intrinsic with arguments that -/// may be absent at runtime? This are special cases because that aspect cannot +/// Is this a call to the RANDOM_SEED intrinsic with arguments that may be +/// absent at runtime? This is a special case because that aspect cannot /// be delegated to the runtime via a null fir.box or address given the current /// runtime entry point. -static bool isSystemClockOrRandomSeedWithOptionalArg( +static bool isRandomSeedWithDynamicallyOptionalArg( llvm::StringRef name, const Fortran::evaluate::ProcedureRef &procRef, Fortran::evaluate::FoldingContext &foldingContex) { - if (name != "system_clock" && name != "random_seed") + if (name != "random_seed") return false; for (const auto &arg : procRef.arguments()) { auto *expr = Fortran::evaluate::UnwrapExpr(arg); @@ -78,7 +78,7 @@ Fortran::evaluate::FoldingContext &fldCtx = converter.getFoldingContext(); return isMinOrMaxWithDynamicallyOptionalArg(name, procRef, fldCtx) || isIshftcWithDynamicallyOptionalArg(name, procRef, fldCtx) || - isSystemClockOrRandomSeedWithOptionalArg(name, procRef, fldCtx); + isRandomSeedWithDynamicallyOptionalArg(name, procRef, fldCtx); } static void prepareMinOrMaxArguments( diff --git a/flang/lib/Lower/HostAssociations.cpp b/flang/lib/Lower/HostAssociations.cpp --- a/flang/lib/Lower/HostAssociations.cpp +++ b/flang/lib/Lower/HostAssociations.cpp @@ -402,7 +402,7 @@ if (!fir::isa_ref_type(eleTy)) eleTy = builder.getRefType(eleTy); auto addr = builder.create(loc, eleTy, box); - mlir::Value isPresent = builder.genIsNotNull(loc, addr); + mlir::Value isPresent = builder.genIsNotNullAddr(loc, addr); auto absentBox = builder.create(loc, boxTy); box = builder.create(loc, isPresent, box, absentBox); diff --git a/flang/lib/Lower/IntrinsicCall.cpp b/flang/lib/Lower/IntrinsicCall.cpp --- a/flang/lib/Lower/IntrinsicCall.cpp +++ b/flang/lib/Lower/IntrinsicCall.cpp @@ -2426,7 +2426,8 @@ fir::runtime::genArgumentValue(builder, loc, number, valBox, errBox); if (isStaticallyPresent(status)) { mlir::Value statAddr = fir::getBase(status); - mlir::Value statIsPresentAtRuntime = builder.genIsNotNull(loc, statAddr); + mlir::Value statIsPresentAtRuntime = + builder.genIsNotNullAddr(loc, statAddr); builder.genIfThen(loc, statIsPresentAtRuntime) .genThen( [&]() { builder.createStoreWithConvert(loc, stat, statAddr); }) @@ -2435,7 +2436,7 @@ } if (isStaticallyPresent(length)) { mlir::Value lenAddr = fir::getBase(length); - mlir::Value lenIsPresentAtRuntime = builder.genIsNotNull(loc, lenAddr); + mlir::Value lenIsPresentAtRuntime = builder.genIsNotNullAddr(loc, lenAddr); builder.genIfThen(loc, lenIsPresentAtRuntime) .genThen([&]() { mlir::Value len = @@ -2465,7 +2466,7 @@ mlir::Type i1Ty = builder.getI1Type(); mlir::Value trimNameAddr = fir::getBase(trimName); mlir::Value trimNameIsPresentAtRuntime = - builder.genIsNotNull(loc, trimNameAddr); + builder.genIsNotNullAddr(loc, trimNameAddr); trim = builder .genIfOp(loc, {i1Ty}, trimNameIsPresentAtRuntime, /*withElseRegion=*/true) @@ -2496,7 +2497,8 @@ valBox, trim, errBox); if (isStaticallyPresent(status)) { mlir::Value statAddr = fir::getBase(status); - mlir::Value statIsPresentAtRuntime = builder.genIsNotNull(loc, statAddr); + mlir::Value statIsPresentAtRuntime = + builder.genIsNotNullAddr(loc, statAddr); builder.genIfThen(loc, statIsPresentAtRuntime) .genThen( [&]() { builder.createStoreWithConvert(loc, stat, statAddr); }) @@ -2506,7 +2508,7 @@ if (isStaticallyPresent(length)) { mlir::Value lenAddr = fir::getBase(length); - mlir::Value lenIsPresentAtRuntime = builder.genIsNotNull(loc, lenAddr); + mlir::Value lenIsPresentAtRuntime = builder.genIsNotNullAddr(loc, lenAddr); builder.genIfThen(loc, lenIsPresentAtRuntime) .genThen([&]() { mlir::Value len = @@ -3311,7 +3313,7 @@ return builder.createConvert( loc, resultType, fir::runtime::genSizeDim(builder, loc, array, dim)); - mlir::Value isDynamicallyAbsent = builder.genIsNull(loc, dim); + mlir::Value isDynamicallyAbsent = builder.genIsNullAddr(loc, dim); return builder .genIfOp(loc, {resultType}, isDynamicallyAbsent, /*withElseRegion=*/true) diff --git a/flang/lib/Lower/Runtime.cpp b/flang/lib/Lower/Runtime.cpp --- a/flang/lib/Lower/Runtime.cpp +++ b/flang/lib/Lower/Runtime.cpp @@ -12,6 +12,7 @@ #include "flang/Optimizer/Builder/FIRBuilder.h" #include "flang/Optimizer/Builder/Runtime/RTBuilder.h" #include "flang/Optimizer/Builder/Todo.h" +#include "flang/Optimizer/Dialect/FIROpsSupport.h" #include "flang/Parser/parse-tree.h" #include "flang/Runtime/misc-intrinsic.h" #include "flang/Runtime/pointer.h" @@ -332,18 +333,35 @@ mlir::Location loc, mlir::Value count, mlir::Value rate, mlir::Value max) { auto makeCall = [&](mlir::func::FuncOp func, mlir::Value arg) { + mlir::Type type = arg.getType(); + fir::IfOp ifOp{}; + const bool isOptionalArg = + fir::valueHasFirAttribute(arg, fir::getOptionalAttrName()); + if (type.dyn_cast() || type.dyn_cast()) { + // Check for a disassociated pointer or an unallocated allocatable. + assert(!isOptionalArg && "invalid optional argument"); + ifOp = builder.create(loc, builder.genIsNotNullAddr(loc, arg), + /*withElseRegion=*/false); + } else if (isOptionalArg) { + ifOp = builder.create( + loc, builder.create(loc, builder.getI1Type(), arg), + /*withElseRegion=*/false); + } + if (ifOp) + builder.setInsertionPointToStart(&ifOp.getThenRegion().front()); mlir::Type kindTy = func.getFunctionType().getInput(0); int integerKind = 8; - if (auto intType = - fir::unwrapRefType(arg.getType()).dyn_cast()) + if (auto intType = fir::unwrapRefType(type).dyn_cast()) integerKind = intType.getWidth() / 8; mlir::Value kind = builder.createIntegerConstant(loc, kindTy, integerKind); mlir::Value res = builder.create(loc, func, mlir::ValueRange{kind}) .getResult(0); mlir::Value castRes = - builder.createConvert(loc, fir::dyn_cast_ptrEleTy(arg.getType()), res); + builder.createConvert(loc, fir::dyn_cast_ptrEleTy(type), res); builder.create(loc, castRes, arg); + if (ifOp) + builder.setInsertionPointAfter(ifOp); }; using fir::runtime::getRuntimeFunc; if (count) diff --git a/flang/lib/Optimizer/Builder/FIRBuilder.cpp b/flang/lib/Optimizer/Builder/FIRBuilder.cpp --- a/flang/lib/Optimizer/Builder/FIRBuilder.cpp +++ b/flang/lib/Optimizer/Builder/FIRBuilder.cpp @@ -510,13 +510,14 @@ return builder.create(loc, condition, ptrToInt, c0); } -mlir::Value fir::FirOpBuilder::genIsNotNull(mlir::Location loc, - mlir::Value addr) { +mlir::Value fir::FirOpBuilder::genIsNotNullAddr(mlir::Location loc, + mlir::Value addr) { return genNullPointerComparison(*this, loc, addr, mlir::arith::CmpIPredicate::ne); } -mlir::Value fir::FirOpBuilder::genIsNull(mlir::Location loc, mlir::Value addr) { +mlir::Value fir::FirOpBuilder::genIsNullAddr(mlir::Location loc, + mlir::Value addr) { return genNullPointerComparison(*this, loc, addr, mlir::arith::CmpIPredicate::eq); } diff --git a/flang/lib/Optimizer/Builder/MutableBox.cpp b/flang/lib/Optimizer/Builder/MutableBox.cpp --- a/flang/lib/Optimizer/Builder/MutableBox.cpp +++ b/flang/lib/Optimizer/Builder/MutableBox.cpp @@ -427,7 +427,7 @@ mlir::Location loc, const fir::MutableBoxValue &box) { auto addr = MutablePropertyReader(builder, loc, box).readBaseAddress(); - return builder.genIsNotNull(loc, addr); + return builder.genIsNotNullAddr(loc, addr); } /// Generate finalizer call and inlined free. This does not check that the @@ -447,7 +447,7 @@ mlir::Location loc, const fir::MutableBoxValue &box) { auto addr = MutablePropertyReader(builder, loc, box).readBaseAddress(); - auto isAllocated = builder.genIsNotNull(loc, addr); + auto isAllocated = builder.genIsNotNullAddr(loc, addr); auto ifOp = builder.create(loc, isAllocated, /*withElseRegion=*/false); auto insPt = builder.saveInsertionPoint(); @@ -714,7 +714,7 @@ auto addr = reader.readBaseAddress(); auto i1Type = builder.getI1Type(); auto addrType = addr.getType(); - auto isAllocated = builder.genIsNotNull(loc, addr); + auto isAllocated = builder.genIsNotNullAddr(loc, addr); auto ifOp = builder .genIfOp(loc, {i1Type, addrType}, isAllocated, diff --git a/flang/lib/Optimizer/Builder/Runtime/Ragged.cpp b/flang/lib/Optimizer/Builder/Runtime/Ragged.cpp --- a/flang/lib/Optimizer/Builder/Runtime/Ragged.cpp +++ b/flang/lib/Optimizer/Builder/Runtime/Ragged.cpp @@ -35,7 +35,7 @@ auto ptrTy = builder.getRefType(eleTy.cast().getType(1)); auto ptr = builder.create(loc, ptrTy, header, one); auto heap = builder.create(loc, ptr); - auto cmp = builder.genIsNull(loc, heap); + auto cmp = builder.genIsNullAddr(loc, heap); builder.genIfThen(loc, cmp) .genThen([&]() { auto asHeadersVal = builder.createIntegerConstant(loc, i1Ty, asHeaders); diff --git a/flang/test/Lower/Intrinsics/system_clock.f90 b/flang/test/Lower/Intrinsics/system_clock.f90 --- a/flang/test/Lower/Intrinsics/system_clock.f90 +++ b/flang/test/Lower/Intrinsics/system_clock.f90 @@ -29,3 +29,137 @@ ! CHECK-NOT: fir.call ! print*, m end subroutine + +! CHECK-LABEL: @_QPss +subroutine ss(count) + ! CHECK: %[[V_0:[0-9]+]] = fir.alloca !fir.box> {bindc_name = "count_max", uniq_name = "_QFssEcount_max"} + ! CHECK: %[[V_1:[0-9]+]] = fir.alloca !fir.heap {uniq_name = "_QFssEcount_max.addr"} + ! CHECK: %[[V_2:[0-9]+]] = fir.zero_bits !fir.heap + ! CHECK: fir.store %[[V_2]] to %[[V_1]] : !fir.ref> + ! CHECK: %[[V_3:[0-9]+]] = fir.alloca !fir.box> {bindc_name = "count_rate", uniq_name = "_QFssEcount_rate"} + ! CHECK: %[[V_4:[0-9]+]] = fir.alloca !fir.ptr {uniq_name = "_QFssEcount_rate.addr"} + ! CHECK: %[[V_5:[0-9]+]] = fir.zero_bits !fir.ptr + ! CHECK: fir.store %[[V_5]] to %[[V_4]] : !fir.ref> + ! CHECK: %[[V_6:[0-9]+]] = fir.alloca i64 {bindc_name = "count_rate_", fir.target, uniq_name = "_QFssEcount_rate_"} + ! CHECK: %[[V_7:[0-9]+]] = fir.convert %[[V_6]] : (!fir.ref) -> !fir.ptr + ! CHECK: fir.store %[[V_7]] to %[[V_4]] : !fir.ref> + ! CHECK: %[[V_8:[0-9]+]] = fir.allocmem i64 {uniq_name = "_QFssEcount_max.alloc"} + ! CHECK: fir.store %[[V_8]] to %[[V_1]] : !fir.ref> + ! CHECK: %[[V_9:[0-9]+]] = fir.load %[[V_4]] : !fir.ref> + ! CHECK: %[[V_10:[0-9]+]] = fir.load %[[V_1]] : !fir.ref> + ! CHECK: %[[V_11:[0-9]+]] = fir.is_present %arg0 : (!fir.ref) -> i1 + ! CHECK: fir.if %[[V_11]] { + ! CHECK: %[[V_29:[0-9]+]] = fir.call @_FortranASystemClockCount(%c8{{.*}}_i32) : (i32) -> i64 + ! CHECK: fir.store %[[V_29]] to %arg0 : !fir.ref + ! CHECK: } + ! CHECK: %[[V_12:[0-9]+]] = fir.convert %[[V_9]] : (!fir.ptr) -> i64 + ! CHECK: %[[V_13:[0-9]+]] = arith.cmpi ne, %[[V_12]], %c0{{.*}}_i64 : i64 + ! CHECK: fir.if %[[V_13]] { + ! CHECK: %[[V_29]] = fir.call @_FortranASystemClockCountRate(%c8{{.*}}_i32) : (i32) -> i64 + ! CHECK: fir.store %[[V_29]] to %[[V_9]] : !fir.ptr + ! CHECK: } + ! CHECK: %[[V_14:[0-9]+]] = fir.convert %[[V_10]] : (!fir.heap) -> i64 + ! CHECK: %[[V_15:[0-9]+]] = arith.cmpi ne, %[[V_14]], %c0{{.*}}_i64_0 : i64 + ! CHECK: fir.if %[[V_15]] { + ! CHECK: %[[V_29]] = fir.call @_FortranASystemClockCountMax(%c8{{.*}}_i32) : (i32) -> i64 + ! CHECK: fir.store %[[V_29]] to %[[V_10]] : !fir.heap + ! CHECK: } + ! CHECK: %[[V_16:[0-9]+]] = fir.is_present %arg0 : (!fir.ref) -> i1 + ! CHECK: fir.if %[[V_16]] { + ! CHECK: %[[V_31:[0-9]+]] = fir.call @_FortranAioBeginExternalListOutput + ! CHECK: %[[V_32:[0-9]+]] = fir.load %arg0 : !fir.ref + ! CHECK: %[[V_33:[0-9]+]] = fir.call @_FortranAioOutputInteger64(%[[V_31]], %[[V_32]]) : (!fir.ref, i64) -> i1 + ! CHECK: %[[V_34:[0-9]+]] = fir.load %[[V_4]] : !fir.ref> + ! CHECK: %[[V_35:[0-9]+]] = fir.load %[[V_34]] : !fir.ptr + ! CHECK: %[[V_36:[0-9]+]] = fir.call @_FortranAioOutputInteger64(%[[V_31]], %[[V_35]]) : (!fir.ref, i64) -> i1 + ! CHECK: %[[V_37:[0-9]+]] = fir.load %[[V_1]] : !fir.ref> + ! CHECK: %[[V_38:[0-9]+]] = fir.load %[[V_37]] : !fir.heap + ! CHECK: %[[V_39:[0-9]+]] = fir.call @_FortranAioOutputInteger64(%[[V_31]], %[[V_38]]) : (!fir.ref, i64) -> i1 + ! CHECK: %[[V_40:[0-9]+]] = fir.call @_FortranAioEndIoStatement(%[[V_31]]) : (!fir.ref) -> i32 + ! CHECK: } else { + ! CHECK: %[[V_29]] = fir.load %[[V_4]] : !fir.ref> + ! CHECK: %[[V_30:[0-9]+]] = fir.load %[[V_1]] : !fir.ref> + ! CHECK: %[[V_31]] = fir.convert %[[V_29]] : (!fir.ptr) -> i64 + ! CHECK: %[[V_32]] = arith.cmpi ne, %[[V_31]], %c0{{.*}}_i64_3 : i64 + ! CHECK: fir.if %[[V_32]] { + ! CHECK: %[[V_45:[0-9]+]] = fir.call @_FortranASystemClockCountRate(%c8{{.*}}_i32) : (i32) -> i64 + ! CHECK: fir.store %[[V_45]] to %[[V_29]] : !fir.ptr + ! CHECK: } + ! CHECK: %[[V_33]] = fir.convert %[[V_30]] : (!fir.heap) -> i64 + ! CHECK: %[[V_34]] = arith.cmpi ne, %[[V_33]], %c0{{.*}}_i64_4 : i64 + ! CHECK: fir.if %[[V_34]] { + ! CHECK: %[[V_45]] = fir.call @_FortranASystemClockCountMax(%c8{{.*}}_i32) : (i32) -> i64 + ! CHECK: fir.store %[[V_45]] to %[[V_30]] : !fir.heap + ! CHECK: } + ! CHECK: %[[V_37]] = fir.call @_FortranAioBeginExternalListOutput + ! CHECK: %[[V_38]] = fir.load %[[V_4]] : !fir.ref> + ! CHECK: %[[V_39]] = fir.load %[[V_38]] : !fir.ptr + ! CHECK: %[[V_40]] = fir.call @_FortranAioOutputInteger64(%[[V_37]], %[[V_39]]) : (!fir.ref, i64) -> i1 + ! CHECK: %[[V_41:[0-9]+]] = fir.load %[[V_1]] : !fir.ref> + ! CHECK: %[[V_42:[0-9]+]] = fir.load %[[V_41]] : !fir.heap + ! CHECK: %[[V_43:[0-9]+]] = fir.call @_FortranAioOutputInteger64(%[[V_37]], %[[V_42]]) : (!fir.ref, i64) -> i1 + ! CHECK: %[[V_44:[0-9]+]] = fir.call @_FortranAioEndIoStatement(%[[V_37]]) : (!fir.ref) -> i32 + ! CHECK: } + ! CHECK: %[[V_17:[0-9]+]] = fir.is_present %arg0 : (!fir.ref) -> i1 + ! CHECK: fir.if %[[V_17]] { + ! CHECK: %[[V_29]] = fir.convert %c0{{.*}}_i32 : (i32) -> i64 + ! CHECK: fir.store %[[V_29]] to %arg0 : !fir.ref + ! CHECK: } else { + ! CHECK: } + ! CHECK: %[[V_18:[0-9]+]] = fir.zero_bits !fir.ptr + ! CHECK: fir.store %[[V_18]] to %[[V_4]] : !fir.ref> + ! CHECK: %[[V_19:[0-9]+]] = fir.load %[[V_1]] : !fir.ref> + ! CHECK: fir.freemem %[[V_19]] : !fir.heap + ! CHECK: %[[V_20:[0-9]+]] = fir.zero_bits !fir.heap + ! CHECK: fir.store %[[V_20]] to %[[V_1]] : !fir.ref> + ! CHECK: %[[V_21:[0-9]+]] = fir.load %[[V_4]] : !fir.ref> + ! CHECK: %[[V_22:[0-9]+]] = fir.load %[[V_1]] : !fir.ref> + ! CHECK: %[[V_23:[0-9]+]] = fir.is_present %arg0 : (!fir.ref) -> i1 + ! CHECK: fir.if %[[V_23]] { + ! CHECK: %[[V_29]] = fir.call @_FortranASystemClockCount(%c8{{.*}}_i32) : (i32) -> i64 + ! CHECK: fir.store %[[V_29]] to %arg0 : !fir.ref + ! CHECK: } + ! CHECK: %[[V_24:[0-9]+]] = fir.convert %[[V_21]] : (!fir.ptr) -> i64 + ! CHECK: %[[V_25:[0-9]+]] = arith.cmpi ne, %[[V_24]], %c0{{.*}}_i64_1 : i64 + ! CHECK: fir.if %[[V_25]] { + ! CHECK: %[[V_29]] = fir.call @_FortranASystemClockCountRate(%c8{{.*}}_i32) : (i32) -> i64 + ! CHECK: fir.store %[[V_29]] to %[[V_21]] : !fir.ptr + ! CHECK: } + ! CHECK: %[[V_26:[0-9]+]] = fir.convert %[[V_22]] : (!fir.heap) -> i64 + ! CHECK: %[[V_27:[0-9]+]] = arith.cmpi ne, %[[V_26]], %c0{{.*}}_i64_2 : i64 + ! CHECK: fir.if %[[V_27]] { + ! CHECK: %[[V_29]] = fir.call @_FortranASystemClockCountMax(%c8{{.*}}_i32) : (i32) -> i64 + ! CHECK: fir.store %[[V_29]] to %[[V_22]] : !fir.heap + ! CHECK: } + ! CHECK: %[[V_28:[0-9]+]] = fir.is_present %arg0 : (!fir.ref) -> i1 + ! CHECK: fir.if %[[V_28]] { + ! CHECK: %[[V_31]] = fir.call @_FortranAioBeginExternalListOutput + ! CHECK: %[[V_32]] = fir.load %arg0 : !fir.ref + ! CHECK: %[[V_33]] = fir.call @_FortranAioOutputInteger64(%[[V_31]], %[[V_32]]) : (!fir.ref, i64) -> i1 + ! CHECK: %[[V_34]] = fir.call @_FortranAioEndIoStatement(%[[V_31]]) : (!fir.ref) -> i32 + ! CHECK: } else { + ! CHECK: } + ! CHECK: return + ! CHECK: } + + integer(8), optional :: count + integer(8), target :: count_rate_ + integer(8), pointer :: count_rate + integer(8), allocatable :: count_max + + count_rate => count_rate_ + allocate(count_max) + call system_clock(count, count_rate, count_max) + if (present(count)) then + print*, count, count_rate, count_max + else + call system_clock(count_rate=count_rate, count_max=count_max) + print*, count_rate, count_max + endif + + if (present(count)) count = 0 + count_rate => null() + deallocate(count_max) + call system_clock(count, count_rate, count_max) + if (present(count)) print*, count +end diff --git a/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp b/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp --- a/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp +++ b/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp @@ -102,23 +102,23 @@ // Helper functions tests //===----------------------------------------------------------------------===// -TEST_F(FIRBuilderTest, genIsNotNull) { +TEST_F(FIRBuilderTest, genIsNotNullAddr) { auto builder = getBuilder(); auto loc = builder.getUnknownLoc(); auto dummyValue = builder.createIntegerConstant(loc, builder.getIndexType(), 0); - auto res = builder.genIsNotNull(loc, dummyValue); + auto res = builder.genIsNotNullAddr(loc, dummyValue); EXPECT_TRUE(mlir::isa(res.getDefiningOp())); auto cmpOp = dyn_cast(res.getDefiningOp()); EXPECT_EQ(arith::CmpIPredicate::ne, cmpOp.getPredicate()); } -TEST_F(FIRBuilderTest, genIsNull) { +TEST_F(FIRBuilderTest, genIsNullAddr) { auto builder = getBuilder(); auto loc = builder.getUnknownLoc(); auto dummyValue = builder.createIntegerConstant(loc, builder.getIndexType(), 0); - auto res = builder.genIsNull(loc, dummyValue); + auto res = builder.genIsNullAddr(loc, dummyValue); EXPECT_TRUE(mlir::isa(res.getDefiningOp())); auto cmpOp = dyn_cast(res.getDefiningOp()); EXPECT_EQ(arith::CmpIPredicate::eq, cmpOp.getPredicate());