Skip to content

Commit 8e8a2e1

Browse files
committed
[flang][hlfir] get rid of box when translating scalars to extented value (llvm#125059)
The code in `translateToExtendedValue(hlfir::Entity)` was not getting rid of the fir.box for scalars because isSimplyContiguous() returned false for them. This created issues downstream because utilities using fir::ExtendedValue were not implemented to work with intrinsic scalars fir.box. fir.box of intrinsic scalars are not very commonly used as hlfir::Entity but they are allowed and should work where accepted.
1 parent fb36081 commit 8e8a2e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

flang/include/flang/Optimizer/Builder/HLFIRTools.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class Entity : public mlir::Value {
125125
bool isSimplyContiguous() const {
126126
// If this can be described without a fir.box in FIR, this must
127127
// be contiguous.
128-
if (!hlfir::isBoxAddressOrValueType(getFirBase().getType()))
128+
if (!hlfir::isBoxAddressOrValueType(getFirBase().getType()) || isScalar())
129129
return true;
130130
// Otherwise, if this entity has a visible declaration in FIR,
131131
// or is the dereference of an allocatable or contiguous pointer

0 commit comments

Comments
 (0)