Skip to content

Commit 23dafdb

Browse files
committed
Fix a couple of bugs wrt characters.
- A character of runtime length cannot use load/store to copy the value between memory locations. - Fix a bug where type parameters were being erroneously elided. Code cleanup. Fix comments. Update the tests.
1 parent 539c8b6 commit 23dafdb

File tree

8 files changed

+241
-267
lines changed

8 files changed

+241
-267
lines changed

flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp

Lines changed: 77 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "PassDetail.h"
1010
#include "flang/Lower/Todo.h" // delete!
1111
#include "flang/Optimizer/Builder/BoxValue.h"
12+
#include "flang/Optimizer/Builder/Character.h"
1213
#include "flang/Optimizer/Builder/FIRBuilder.h"
1314
#include "flang/Optimizer/Builder/Factory.h"
1415
#include "flang/Optimizer/Dialect/FIRDialect.h"
@@ -240,7 +241,7 @@ class ReachCollector {
240241
return;
241242
}
242243

243-
fir::emitFatalError(val.getLoc(), "unhandled value");
244+
emitFatalError(val.getLoc(), "unhandled value");
244245
}
245246

246247
/// Return all ops that produce the array value that is stored into the
@@ -249,8 +250,7 @@ class ReachCollector {
249250
mlir::Value seq) {
250251
reach.clear();
251252
mlir::Region *loopRegion = nullptr;
252-
if (auto doLoop =
253-
mlir::dyn_cast_or_null<fir::DoLoopOp>(seq.getDefiningOp()))
253+
if (auto doLoop = mlir::dyn_cast_or_null<DoLoopOp>(seq.getDefiningOp()))
254254
loopRegion = &doLoop->getRegion(0);
255255
ReachCollector collector(reach, loopRegion);
256256
collector.collectArrayMentionFrom(seq);
@@ -392,11 +392,11 @@ static bool conflictOnLoad(llvm::ArrayRef<mlir::Operation *> reach,
392392
ArrayMergeStoreOp st) {
393393
mlir::Value load;
394394
auto addr = st.memref();
395-
auto stEleTy = fir::dyn_cast_ptrOrBoxEleTy(addr.getType());
395+
auto stEleTy = dyn_cast_ptrOrBoxEleTy(addr.getType());
396396
for (auto *op : reach)
397397
if (auto ld = mlir::dyn_cast<ArrayLoadOp>(op)) {
398398
auto ldTy = ld.memref().getType();
399-
if (auto boxTy = ldTy.dyn_cast<fir::BoxType>())
399+
if (auto boxTy = ldTy.dyn_cast<BoxType>())
400400
ldTy = boxTy.getEleTy();
401401
if (ldTy.isa<fir::PointerType>() && stEleTy == dyn_cast_ptrEleTy(ldTy))
402402
return true;
@@ -597,12 +597,12 @@ static mlir::Type getEleTy(mlir::Type ty) {
597597
static void getExtents(llvm::SmallVectorImpl<mlir::Value> &result,
598598
mlir::Value shape) {
599599
auto *shapeOp = shape.getDefiningOp();
600-
if (auto s = mlir::dyn_cast<fir::ShapeOp>(shapeOp)) {
600+
if (auto s = mlir::dyn_cast<ShapeOp>(shapeOp)) {
601601
auto e = s.getExtents();
602602
result.insert(result.end(), e.begin(), e.end());
603603
return;
604604
}
605-
if (auto s = mlir::dyn_cast<fir::ShapeShiftOp>(shapeOp)) {
605+
if (auto s = mlir::dyn_cast<ShapeShiftOp>(shapeOp)) {
606606
auto e = s.getExtents();
607607
result.insert(result.end(), e.begin(), e.end());
608608
return;
@@ -619,31 +619,30 @@ static void getExtents(llvm::SmallVectorImpl<mlir::Value> &result,
619619
// argument of the ArrayLoadOp that is returned.
620620
static mlir::Value
621621
getOrReadExtentsAndShapeOp(mlir::Location loc, mlir::PatternRewriter &rewriter,
622-
fir::ArrayLoadOp loadOp,
622+
ArrayLoadOp loadOp,
623623
llvm::SmallVectorImpl<mlir::Value> &result) {
624624
assert(result.empty());
625-
if (auto boxTy = loadOp.memref().getType().dyn_cast<fir::BoxType>()) {
626-
auto rank = fir::dyn_cast_ptrOrBoxEleTy(boxTy)
627-
.cast<fir::SequenceType>()
628-
.getDimension();
625+
if (auto boxTy = loadOp.memref().getType().dyn_cast<BoxType>()) {
626+
auto rank =
627+
dyn_cast_ptrOrBoxEleTy(boxTy).cast<SequenceType>().getDimension();
629628
auto idxTy = rewriter.getIndexType();
630629
for (decltype(rank) dim = 0; dim < rank; ++dim) {
631630
auto dimVal = rewriter.create<mlir::ConstantIndexOp>(loc, dim);
632-
auto dimInfo = rewriter.create<fir::BoxDimsOp>(loc, idxTy, idxTy, idxTy,
633-
loadOp.memref(), dimVal);
631+
auto dimInfo = rewriter.create<BoxDimsOp>(loc, idxTy, idxTy, idxTy,
632+
loadOp.memref(), dimVal);
634633
result.emplace_back(dimInfo.getResult(1));
635634
}
636-
auto shapeType = fir::ShapeType::get(rewriter.getContext(), rank);
637-
return rewriter.create<fir::ShapeOp>(loc, shapeType, result);
635+
auto shapeType = ShapeType::get(rewriter.getContext(), rank);
636+
return rewriter.create<ShapeOp>(loc, shapeType, result);
638637
}
639638
getExtents(result, loadOp.shape());
640639
return loadOp.shape();
641640
}
642641

643642
static mlir::Type toRefType(mlir::Type ty) {
644-
if (fir::isa_ref_type(ty))
643+
if (isa_ref_type(ty))
645644
return ty;
646-
return fir::ReferenceType::get(ty);
645+
return ReferenceType::get(ty);
647646
}
648647

649648
static mlir::Value
@@ -655,55 +654,73 @@ genCoorOp(mlir::PatternRewriter &rewriter, mlir::Location loc, mlir::Type eleTy,
655654
if (skipOrig)
656655
originated.assign(indices.begin(), indices.end());
657656
else
658-
originated = fir::factory::originateIndices(loc, rewriter, alloc.getType(),
659-
shape, indices);
660-
auto seqTy = fir::dyn_cast_ptrOrBoxEleTy(alloc.getType());
661-
assert(seqTy && seqTy.isa<fir::SequenceType>());
662-
const auto dimension = seqTy.cast<fir::SequenceType>().getDimension();
663-
mlir::Value result = rewriter.create<fir::ArrayCoorOp>(
657+
originated = factory::originateIndices(loc, rewriter, alloc.getType(),
658+
shape, indices);
659+
auto seqTy = dyn_cast_ptrOrBoxEleTy(alloc.getType());
660+
assert(seqTy && seqTy.isa<SequenceType>());
661+
const auto dimension = seqTy.cast<SequenceType>().getDimension();
662+
mlir::Value result = rewriter.create<ArrayCoorOp>(
664663
loc, eleTy, alloc, shape, slice,
665664
llvm::ArrayRef<mlir::Value>{originated}.take_front(dimension),
666665
typeparams);
667666
if (dimension < originated.size())
668-
result = rewriter.create<fir::CoordinateOp>(
667+
result = rewriter.create<CoordinateOp>(
669668
loc, resTy, result,
670669
llvm::ArrayRef<mlir::Value>{originated}.drop_front(dimension));
671670
return result;
672671
}
673672

673+
/// Generate an array copy. This is used for both copy-in and copy-out.
674674
static void genArrayCopy(mlir::Location loc, mlir::PatternRewriter &rewriter,
675675
mlir::Value dst, mlir::Value src, mlir::Value shapeOp,
676-
mlir::Type arrTy) {
676+
ArrayLoadOp arrLoad) {
677+
auto arrTy = arrLoad.getType();
677678
auto insPt = rewriter.saveInsertionPoint();
678679
llvm::SmallVector<mlir::Value> indices;
679680
llvm::SmallVector<mlir::Value> extents;
680681
getExtents(extents, shapeOp);
681682
// Build loop nest from column to row.
682683
for (auto sh : llvm::reverse(extents)) {
683684
auto idxTy = rewriter.getIndexType();
684-
auto ubi = rewriter.create<fir::ConvertOp>(loc, idxTy, sh);
685+
auto ubi = rewriter.create<ConvertOp>(loc, idxTy, sh);
685686
auto zero = rewriter.create<mlir::ConstantIndexOp>(loc, 0);
686687
auto one = rewriter.create<mlir::ConstantIndexOp>(loc, 1);
687688
auto ub = rewriter.create<mlir::SubIOp>(loc, idxTy, ubi, one);
688-
auto loop = rewriter.create<fir::DoLoopOp>(loc, zero, ub, one);
689+
auto loop = rewriter.create<DoLoopOp>(loc, zero, ub, one);
689690
rewriter.setInsertionPointToStart(loop.getBody());
690691
indices.push_back(loop.getInductionVar());
691692
}
692693
// Reverse the indices so they are in column-major order.
693694
std::reverse(indices.begin(), indices.end());
694695
auto ty = getEleTy(arrTy);
695-
auto fromAddr = rewriter.create<fir::ArrayCoorOp>(
696+
auto typeparams = arrLoad.typeparams();
697+
auto fromAddr = rewriter.create<ArrayCoorOp>(
696698
loc, ty, src, shapeOp, mlir::Value{},
697-
fir::factory::originateIndices(loc, rewriter, src.getType(), shapeOp,
698-
indices),
699-
mlir::ValueRange{});
700-
auto load = rewriter.create<fir::LoadOp>(loc, fromAddr);
701-
auto toAddr = rewriter.create<fir::ArrayCoorOp>(
699+
factory::originateIndices(loc, rewriter, src.getType(), shapeOp, indices),
700+
typeparams);
701+
auto toAddr = rewriter.create<ArrayCoorOp>(
702702
loc, ty, dst, shapeOp, mlir::Value{},
703-
fir::factory::originateIndices(loc, rewriter, dst.getType(), shapeOp,
704-
indices),
705-
mlir::ValueRange{});
706-
rewriter.create<fir::StoreOp>(loc, load, toAddr);
703+
factory::originateIndices(loc, rewriter, dst.getType(), shapeOp, indices),
704+
typeparams);
705+
auto eleTy = unwrapSequenceType(unwrapRefType(arrTy));
706+
if (hasDynamicSize(eleTy)) {
707+
if (auto charTy = eleTy.dyn_cast<fir::CharacterType>()) {
708+
assert(charTy.hasDynamicLen() && "dynamic size and constant length");
709+
// Copy from (to) object to (from) temp copy of same object.
710+
auto len = typeparams.back();
711+
CharBoxValue toChar(toAddr, len);
712+
CharBoxValue fromChar(fromAddr, len);
713+
auto module = toAddr->getParentOfType<mlir::ModuleOp>();
714+
FirOpBuilder builder{rewriter, getKindMapping(module)};
715+
factory::CharacterExprHelper helper{builder, loc};
716+
helper.createAssign(ExtendedValue{toChar}, ExtendedValue{fromChar});
717+
} else {
718+
TODO(loc, "copy element of dynamic size");
719+
}
720+
} else {
721+
auto load = rewriter.create<fir::LoadOp>(loc, fromAddr);
722+
rewriter.create<fir::StoreOp>(loc, load, toAddr);
723+
}
707724
rewriter.restoreInsertionPoint(insPt);
708725
}
709726

@@ -740,20 +757,20 @@ class ArrayUpdateConversionBase : public mlir::OpRewritePattern<ArrayOp> {
740757
loc, dyn_cast_ptrOrBoxEleTy(load.memref().getType()), load.typeparams(),
741758
extents);
742759
genArrayCopy(load.getLoc(), rewriter, allocmem, load.memref(), shapeOp,
743-
load.getType());
760+
load);
744761
// Generate the reference for the access.
745762
rewriter.setInsertionPoint(op);
746763
auto coor =
747764
genCoorOp(rewriter, loc, getEleTy(load.getType()), eleTy, allocmem,
748765
shapeOp, load.slice(), access.indices(), load.typeparams(),
749-
access->hasAttr(fir::factory::attrFortranArrayOffsets()));
766+
access->hasAttr(factory::attrFortranArrayOffsets()));
750767
// Copy out.
751768
auto *storeOp = useMap.lookup(loadOp);
752769
auto store = mlir::cast<ArrayMergeStoreOp>(storeOp);
753770
rewriter.setInsertionPoint(storeOp);
754771
// Copy out.
755772
genArrayCopy(store.getLoc(), rewriter, store.memref(), allocmem, shapeOp,
756-
load.getType());
773+
load);
757774
rewriter.create<FreeMemOp>(loc, allocmem);
758775
return coor;
759776
}
@@ -786,19 +803,19 @@ class ArrayUpdateConversionBase : public mlir::OpRewritePattern<ArrayOp> {
786803
loc, dyn_cast_ptrOrBoxEleTy(load.memref().getType()),
787804
load.typeparams(), extents);
788805
genArrayCopy(load.getLoc(), rewriter, allocmem, load.memref(), shapeOp,
789-
load.getType());
806+
load);
790807
rewriter.setInsertionPoint(op);
791808
auto coor = genCoorOp(
792809
rewriter, loc, getEleTy(load.getType()), lhsEltRefType, allocmem,
793810
shapeOp, load.slice(), update.indices(), load.typeparams(),
794-
update->hasAttr(fir::factory::attrFortranArrayOffsets()));
811+
update->hasAttr(factory::attrFortranArrayOffsets()));
795812
assignElement(coor);
796813
auto *storeOp = useMap.lookup(loadOp);
797814
auto store = mlir::cast<ArrayMergeStoreOp>(storeOp);
798815
rewriter.setInsertionPoint(storeOp);
799816
// Copy out.
800817
genArrayCopy(store.getLoc(), rewriter, store.memref(), allocmem, shapeOp,
801-
load.getType());
818+
load);
802819
rewriter.create<FreeMemOp>(loc, allocmem);
803820
return {coor, load.getResult()};
804821
}
@@ -807,10 +824,10 @@ class ArrayUpdateConversionBase : public mlir::OpRewritePattern<ArrayOp> {
807824
LLVM_DEBUG(llvm::outs() << "No, conflict wasn't found\n");
808825
rewriter.setInsertionPoint(op);
809826
auto coorTy = getEleTy(load.getType());
810-
auto coor = genCoorOp(
811-
rewriter, loc, coorTy, lhsEltRefType, load.memref(), load.shape(),
812-
load.slice(), update.indices(), load.typeparams(),
813-
update->hasAttr(fir::factory::attrFortranArrayOffsets()));
827+
auto coor = genCoorOp(rewriter, loc, coorTy, lhsEltRefType, load.memref(),
828+
load.shape(), load.slice(), update.indices(),
829+
load.typeparams(),
830+
update->hasAttr(factory::attrFortranArrayOffsets()));
814831
assignElement(coor);
815832
return {coor, load.getResult()};
816833
}
@@ -833,8 +850,8 @@ class ArrayUpdateConversion : public ArrayUpdateConversionBase<ArrayUpdateOp> {
833850
auto loc = update.getLoc();
834851
auto assignElement = [&](mlir::Value coor) {
835852
auto input = update.merge();
836-
if (auto inEleTy = fir::dyn_cast_ptrEleTy(input.getType())) {
837-
fir::emitFatalError(loc, "array_update on references not supported");
853+
if (auto inEleTy = dyn_cast_ptrEleTy(input.getType())) {
854+
emitFatalError(loc, "array_update on references not supported");
838855
} else {
839856
rewriter.create<fir::StoreOp>(loc, input, coor);
840857
}
@@ -884,12 +901,11 @@ class ArrayFetchConversion : public mlir::OpRewritePattern<ArrayFetchOp> {
884901
rewriter.setInsertionPoint(op);
885902
auto load = mlir::cast<ArrayLoadOp>(useMap.lookup(op));
886903
auto loc = fetch.getLoc();
887-
auto coor =
888-
genCoorOp(rewriter, loc, getEleTy(load.getType()),
889-
toRefType(fetch.getType()), load.memref(), load.shape(),
890-
load.slice(), fetch.indices(), load.typeparams(),
891-
fetch->hasAttr(fir::factory::attrFortranArrayOffsets()));
892-
if (fir::isa_ref_type(fetch.getType()))
904+
auto coor = genCoorOp(
905+
rewriter, loc, getEleTy(load.getType()), toRefType(fetch.getType()),
906+
load.memref(), load.shape(), load.slice(), fetch.indices(),
907+
load.typeparams(), fetch->hasAttr(factory::attrFortranArrayOffsets()));
908+
if (isa_ref_type(fetch.getType()))
893909
rewriter.replaceOp(fetch, coor);
894910
else
895911
rewriter.replaceOpWithNewOp<fir::LoadOp>(fetch, coor);
@@ -924,11 +940,10 @@ class ArrayAccessConversion : public ArrayUpdateConversionBase<ArrayAccessOp> {
924940
}
925941
rewriter.setInsertionPoint(op);
926942
auto load = mlir::cast<ArrayLoadOp>(useMap.lookup(op));
927-
auto coor =
928-
genCoorOp(rewriter, loc, getEleTy(load.getType()),
929-
toRefType(access.getType()), load.memref(), load.shape(),
930-
load.slice(), access.indices(), load.typeparams(),
931-
access->hasAttr(fir::factory::attrFortranArrayOffsets()));
943+
auto coor = genCoorOp(
944+
rewriter, loc, getEleTy(load.getType()), toRefType(access.getType()),
945+
load.memref(), load.shape(), load.slice(), access.indices(),
946+
load.typeparams(), access->hasAttr(factory::attrFortranArrayOffsets()));
932947
rewriter.replaceOp(access, coor);
933948
return mlir::success();
934949
}
@@ -949,7 +964,7 @@ class ArrayAmendConversion : public mlir::OpRewritePattern<ArrayAmendOp> {
949964
auto *op = amend.getOperation();
950965
rewriter.setInsertionPoint(op);
951966
auto loc = amend.getLoc();
952-
auto undef = rewriter.create<fir::UndefOp>(loc, amend.getType());
967+
auto undef = rewriter.create<UndefOp>(loc, amend.getType());
953968
rewriter.replaceOp(amend, undef.getResult());
954969
return mlir::success();
955970
}

flang/test/Fir/array-modify.fir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ func @overlap(%arg0: !fir.ref<!fir.array<100xf32>>) {
8888
// CHECK: %[[VAL_14:.*]] = constant 1 : index
8989
// CHECK: %[[VAL_15:.*]] = addi %[[VAL_13]], %[[VAL_14]] : index
9090
// CHECK: %[[VAL_16:.*]] = fir.array_coor %[[VAL_0]](%[[VAL_7]]) %[[VAL_15]] : (!fir.ref<!fir.array<100xf32>>, !fir.shape<1>, index) -> !fir.ref<f32>
91-
// CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_16]] : !fir.ref<f32>
9291
// CHECK: %[[VAL_18:.*]] = constant 1 : index
9392
// CHECK: %[[VAL_19:.*]] = addi %[[VAL_13]], %[[VAL_18]] : index
9493
// CHECK: %[[VAL_20:.*]] = fir.array_coor %[[VAL_8]](%[[VAL_7]]) %[[VAL_19]] : (!fir.heap<!fir.array<100xf32>>, !fir.shape<1>, index) -> !fir.ref<f32>
94+
// CHECK: %[[VAL_17:.*]] = fir.load %[[VAL_16]] : !fir.ref<f32>
9595
// CHECK: fir.store %[[VAL_17]] to %[[VAL_20]] : !fir.ref<f32>
9696
// CHECK: }
9797
// CHECK: %[[VAL_21:.*]] = fir.undefined !fir.array<100xf32>
@@ -117,10 +117,10 @@ func @overlap(%arg0: !fir.ref<!fir.array<100xf32>>) {
117117
// CHECK: %[[VAL_39:.*]] = constant 1 : index
118118
// CHECK: %[[VAL_40:.*]] = addi %[[VAL_38]], %[[VAL_39]] : index
119119
// CHECK: %[[VAL_41:.*]] = fir.array_coor %[[VAL_8]](%[[VAL_7]]) %[[VAL_40]] : (!fir.heap<!fir.array<100xf32>>, !fir.shape<1>, index) -> !fir.ref<f32>
120-
// CHECK: %[[VAL_42:.*]] = fir.load %[[VAL_41]] : !fir.ref<f32>
121120
// CHECK: %[[VAL_43:.*]] = constant 1 : index
122121
// CHECK: %[[VAL_44:.*]] = addi %[[VAL_38]], %[[VAL_43]] : index
123122
// CHECK: %[[VAL_45:.*]] = fir.array_coor %[[VAL_0]](%[[VAL_7]]) %[[VAL_44]] : (!fir.ref<!fir.array<100xf32>>, !fir.shape<1>, index) -> !fir.ref<f32>
123+
// CHECK: %[[VAL_42:.*]] = fir.load %[[VAL_41]] : !fir.ref<f32>
124124
// CHECK: fir.store %[[VAL_42]] to %[[VAL_45]] : !fir.ref<f32>
125125
// CHECK: }
126126
// CHECK: fir.freemem %[[VAL_8]] : !fir.heap<!fir.array<100xf32>>

flang/test/Lower/array-character.f90

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ subroutine issue(c1, c2)
77
! CHECK: %[[VAL_2:.*]] = constant false
88
! CHECK: %[[VAL_3:.*]] = constant 32 : i8
99
! CHECK: %[[VAL_4:.*]] = constant 3 : index
10-
! CHECK: %[[VAL_5:.*]] = constant 5 : index
10+
! CHECK: %[[VAL_5:.*]] = constant 4 : index
1111
! CHECK: %[[VAL_6:.*]] = constant 0 : index
1212
! CHECK: %[[VAL_7:.*]] = constant 1 : index
1313
! CHECK: %[[VAL_8:.*]]:2 = fir.unboxchar %[[VAL_0]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
@@ -92,6 +92,7 @@ end program p
9292
! CHECK-LABEL: func @_QPcharlit() {
9393
subroutine charlit
9494
! CHECK: %[[VAL_0:.*]] = constant -1 : i32
95+
! CHECK: %[[VAL_3:.*]] = constant 3 : index
9596
! CHECK: %[[VAL_4:.*]] = constant false
9697
! CHECK: %[[VAL_5:.*]] = constant 4 : index
9798
! CHECK: %[[VAL_6:.*]] = constant 0 : index
@@ -110,7 +111,7 @@ subroutine charlit
110111
! CHECK: %[[VAL_17:.*]] = addi %[[VAL_14]], %[[VAL_7]] : index
111112
! CHECK: %[[VAL_18:.*]] = fir.array_coor %[[VAL_11]](%[[VAL_12]]) %[[VAL_17]] : (!fir.ref<!fir.array<4x!fir.char<1,3>>>, !fir.shape<1>, index) -> !fir.ref<!fir.char<1,3>>
112113
! CHECK: %[[VAL_19:.*]] = fir.array_coor %[[VAL_13]](%[[VAL_12]]) %[[VAL_17]] : (!fir.heap<!fir.array<4x!fir.char<1,3>>>, !fir.shape<1>, index) -> !fir.ref<!fir.char<1,3>>
113-
! CHECK: %[[VAL_20:.*]] = fir.convert %[[VAL_5]] : (index) -> i64
114+
! CHECK: %[[VAL_20:.*]] = fir.convert %[[VAL_3]] : (index) -> i64
114115
! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_19]] : (!fir.ref<!fir.char<1,3>>) -> !fir.ref<i8>
115116
! CHECK: %[[VAL_22:.*]] = fir.convert %[[VAL_18]] : (!fir.ref<!fir.char<1,3>>) -> !fir.ref<i8>
116117
! CHECK: fir.call @llvm.memmove.p0i8.p0i8.i64(%[[VAL_21]], %[[VAL_22]], %[[VAL_20]], %[[VAL_4]]) : (!fir.ref<i8>, !fir.ref<i8>, i64, i1) -> ()
@@ -132,7 +133,7 @@ subroutine charlit
132133
! CHECK: %[[VAL_33:.*]] = addi %[[VAL_30]], %[[VAL_7]] : index
133134
! CHECK: %[[VAL_34:.*]] = fir.array_coor %[[VAL_11]](%[[VAL_12]]) %[[VAL_33]] : (!fir.ref<!fir.array<4x!fir.char<1,3>>>, !fir.shape<1>, index) -> !fir.ref<!fir.char<1,3>>
134135
! CHECK: %[[VAL_35:.*]] = fir.array_coor %[[VAL_29]](%[[VAL_12]]) %[[VAL_33]] : (!fir.heap<!fir.array<4x!fir.char<1,3>>>, !fir.shape<1>, index) -> !fir.ref<!fir.char<1,3>>
135-
! CHECK: %[[VAL_36:.*]] = fir.convert %[[VAL_5]] : (index) -> i64
136+
! CHECK: %[[VAL_36:.*]] = fir.convert %[[VAL_3]] : (index) -> i64
136137
! CHECK: %[[VAL_37:.*]] = fir.convert %[[VAL_35]] : (!fir.ref<!fir.char<1,3>>) -> !fir.ref<i8>
137138
! CHECK: %[[VAL_38:.*]] = fir.convert %[[VAL_34]] : (!fir.ref<!fir.char<1,3>>) -> !fir.ref<i8>
138139
! CHECK: fir.call @llvm.memmove.p0i8.p0i8.i64(%[[VAL_37]], %[[VAL_38]], %[[VAL_36]], %[[VAL_4]]) : (!fir.ref<i8>, !fir.ref<i8>, i64, i1) -> ()
@@ -154,7 +155,7 @@ subroutine charlit
154155
! CHECK: %[[VAL_49:.*]] = addi %[[VAL_46]], %[[VAL_7]] : index
155156
! CHECK: %[[VAL_50:.*]] = fir.array_coor %[[VAL_11]](%[[VAL_12]]) %[[VAL_49]] : (!fir.ref<!fir.array<4x!fir.char<1,3>>>, !fir.shape<1>, index) -> !fir.ref<!fir.char<1,3>>
156157
! CHECK: %[[VAL_51:.*]] = fir.array_coor %[[VAL_45]](%[[VAL_12]]) %[[VAL_49]] : (!fir.heap<!fir.array<4x!fir.char<1,3>>>, !fir.shape<1>, index) -> !fir.ref<!fir.char<1,3>>
157-
! CHECK: %[[VAL_52:.*]] = fir.convert %[[VAL_5]] : (index) -> i64
158+
! CHECK: %[[VAL_52:.*]] = fir.convert %[[VAL_3]] : (index) -> i64
158159
! CHECK: %[[VAL_53:.*]] = fir.convert %[[VAL_51]] : (!fir.ref<!fir.char<1,3>>) -> !fir.ref<i8>
159160
! CHECK: %[[VAL_54:.*]] = fir.convert %[[VAL_50]] : (!fir.ref<!fir.char<1,3>>) -> !fir.ref<i8>
160161
! CHECK: fir.call @llvm.memmove.p0i8.p0i8.i64(%[[VAL_53]], %[[VAL_54]], %[[VAL_52]], %[[VAL_4]]) : (!fir.ref<i8>, !fir.ref<i8>, i64, i1) -> ()

0 commit comments

Comments
 (0)