Skip to content

Revert "[flang][hlfir] get rid of box when translating scalars to extented value" #125222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

jeanPerier
Copy link
Contributor

Reverts #125059

Broke OPTIONAL lowering for some intrinsics.

I have a proper fix for review #125215, but I would like to better test it, so I am reverting in the meantime.

@jeanPerier jeanPerier requested a review from tblah January 31, 2025 13:53
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir labels Jan 31, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 31, 2025

@llvm/pr-subscribers-flang-fir-hlfir

Author: None (jeanPerier)

Changes

Reverts llvm/llvm-project#125059

Broke OPTIONAL lowering for some intrinsics.

I have a proper fix for review #125215, but I would like to better test it, so I am reverting in the meantime.


Full diff: https://github.com/llvm/llvm-project/pull/125222.diff

2 Files Affected:

  • (modified) flang/include/flang/Optimizer/Builder/HLFIRTools.h (+1-1)
  • (modified) flang/test/HLFIR/assign-codegen.fir (-10)
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>

Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to merge this now to fix the build bots.

@DavidSpickett DavidSpickett merged commit 85d4175 into main Jan 31, 2025
8 of 10 checks passed
@DavidSpickett DavidSpickett deleted the revert-125059-assign-scalar-box branch January 31, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:fir-hlfir flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants