[flang-commits] [flang] Revert "[flang][hlfir] get rid of box when translating scalars to extented value" (PR #125222)
via flang-commits
flang-commits at lists.llvm.org
Fri Jan 31 05:53:27 PST 2025
https://github.com/jeanPerier created https://github.com/llvm/llvm-project/pull/125222
Reverts llvm/llvm-project#125059
Broke OPTIONAL lowering for some intrinsics.
I have a proper fix for review https://github.com/llvm/llvm-project/pull/125215, but I would like to better test it, so I am reverting in the meantime.
>From a42f023c8c235b791cdff1366e5e444c735c849f Mon Sep 17 00:00:00 2001
From: jeanPerier <jean.perier.polytechnique at gmail.com>
Date: Fri, 31 Jan 2025 14:51:06 +0100
Subject: [PATCH] =?UTF-8?q?Revert=20"[flang][hlfir]=20get=20rid=20of=20box?=
=?UTF-8?q?=20when=20translating=20scalars=20to=20extented=20va=E2=80=A6"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 242aa8c743fe4344844753d8faf59744235319df.
---
flang/include/flang/Optimizer/Builder/HLFIRTools.h | 2 +-
flang/test/HLFIR/assign-codegen.fir | 10 ----------
2 files changed, 1 insertion(+), 11 deletions(-)
diff --git a/flang/include/flang/Optimizer/Builder/HLFIRTools.h b/flang/include/flang/Optimizer/Builder/HLFIRTools.h
index d8785969bb72471..0684ad0f926ec93 100644
--- a/flang/include/flang/Optimizer/Builder/HLFIRTools.h
+++ b/flang/include/flang/Optimizer/Builder/HLFIRTools.h
@@ -125,7 +125,7 @@ class Entity : public mlir::Value {
bool isSimplyContiguous() const {
// If this can be described without a fir.box in FIR, this must
// be contiguous.
- if (!hlfir::isBoxAddressOrValueType(getFirBase().getType()) || isScalar())
+ if (!hlfir::isBoxAddressOrValueType(getFirBase().getType()))
return true;
// Otherwise, if this entity has a visible declaration in FIR,
// or is the dereference of an allocatable or contiguous pointer
diff --git a/flang/test/HLFIR/assign-codegen.fir b/flang/test/HLFIR/assign-codegen.fir
index 5e48784284a8b4b..581d1ab0e7739c4 100644
--- a/flang/test/HLFIR/assign-codegen.fir
+++ b/flang/test/HLFIR/assign-codegen.fir
@@ -427,13 +427,3 @@ func.func @test_upoly_expr_assignment(%arg0: !fir.class<!fir.array<?xnone>> {fir
// CHECK: }
// CHECK: return
// CHECK: }
-
-func.func @test_scalar_box(%arg0: f32, %arg1: !fir.box<!fir.ptr<f32>>) {
- hlfir.assign %arg0 to %arg1 : f32, !fir.box<!fir.ptr<f32>>
- return
-}
-// CHECK-LABEL: func.func @test_scalar_box(
-// CHECK-SAME: %[[VAL_0:.*]]: f32,
-// CHECK-SAME: %[[VAL_1:.*]]: !fir.box<!fir.ptr<f32>>) {
-// CHECK: %[[VAL_2:.*]] = fir.box_addr %[[VAL_1]] : (!fir.box<!fir.ptr<f32>>) -> !fir.ptr<f32>
-// CHECK: fir.store %[[VAL_0]] to %[[VAL_2]] : !fir.ptr<f32>
More information about the flang-commits
mailing list