Skip to content

Commit 161f259

Browse files
committed
Change intrinsic table entries for dot_product for array arguments from
asAddr to asBox. This means we will not create array copies for array slices used in arguments to dot_product. Also, made this change to SUM and PRODUCT. There are probably other intrinsics to make this change to. We will address these later. We will track these changes in issue #1121.
1 parent cf1fa29 commit 161f259

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

flang/lib/Lower/IntrinsicCall.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,9 @@ genDotProd(FN func, mlir::Type resultType, fir::FirOpBuilder &builder,
214214
assert(args.size() == 2);
215215

216216
// Handle required vector arguments
217-
fir::BoxValue vecTmpA = builder.createBox(loc, args[0]);
218-
mlir::Value vectorA = fir::getBase(vecTmpA);
219-
fir::BoxValue vecTmpB = builder.createBox(loc, args[1]);
220-
mlir::Value vectorB = fir::getBase(vecTmpB);
217+
mlir::Value vectorA = fir::getBase(args[0]);
218+
mlir::Value vectorB = fir::getBase(args[1]);
219+
221220

222221
auto eleTy = fir::dyn_cast_ptrOrBoxEleTy(vectorA.getType())
223222
.cast<fir::SequenceType>()
@@ -679,7 +678,7 @@ static constexpr IntrinsicHandler handlers[]{
679678
{"dim", &I::genDim},
680679
{"dot_product",
681680
&I::genDotProduct,
682-
{{{"vector_a", asAddr}, {"vector_b", asAddr}}},
681+
{{{"vector_a", asBox}, {"vector_b", asBox}}},
683682
/*isElemental=*/false},
684683
{"dprod", &I::genDprod},
685684
{"eoshift",
@@ -768,7 +767,7 @@ static constexpr IntrinsicHandler handlers[]{
768767
/*isElemental=*/false},
769768
{"product",
770769
&I::genProduct,
771-
{{{"array", asAddr}, {"dim", asValue}, {"mask", asAddr}}},
770+
{{{"array", asBox}, {"dim", asValue}, {"mask", asBox}}},
772771
/*isElemental=*/false},
773772
{"random_init",
774773
&I::genRandomInit,
@@ -818,7 +817,7 @@ static constexpr IntrinsicHandler handlers[]{
818817
/*isElemental=*/false},
819818
{"sum",
820819
&I::genSum,
821-
{{{"array", asAddr}, {"dim", asValue}, {"mask", asAddr}}},
820+
{{{"array", asBox}, {"dim", asValue}, {"mask", asBox}}},
822821
/*isElemental=*/false},
823822
{"system_clock",
824823
&I::genSystemClock,

0 commit comments

Comments
 (0)