[flang-commits] [flang] a803686 - [mlir][MemorySlotInterfaces] Rename `elemType` to `valueType` (NFC) (#228466)

via flang-commits flang-commits at lists.llvm.org
Mon Oct 5 01:51:46 PDT 2026


Author: Andrzej WarzyƄski
Date: 2026-10-05T08:51:37Z
New Revision: a8036869bcccb6236b6ef6785cbe69455cdbd195

URL: https://github.com/llvm/llvm-project/commit/a8036869bcccb6236b6ef6785cbe69455cdbd195
DIFF: https://github.com/llvm/llvm-project/commit/a8036869bcccb6236b6ef6785cbe69455cdbd195.diff

LOG: [mlir][MemorySlotInterfaces] Rename `elemType` to `valueType` (NFC) (#228466)

The name `elemType` is potentially confusing, as "element type" already
has a well-defined meaning for types such as MemRef and Vector.

As of #211880, `MemorySlotInterfaces` also supports vector ops, and the
type represented by `elemType` can itself be a Vector type. In that case, the
Vector is the value stored in the memory slot, while its element type is
a different type.

This PR renames `elemType` to `valueType` to make this distinction
explicit.

Added: 
    

Modified: 
    flang/lib/Optimizer/Dialect/FIROps.cpp
    mlir/include/mlir/Interfaces/MemorySlotInterfaces.h
    mlir/lib/Dialect/Affine/IR/MemorySlot.cpp
    mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp
    mlir/lib/Dialect/MemRef/IR/MemRefMemorySlot.cpp
    mlir/lib/Dialect/SCF/IR/MemorySlot.cpp
    mlir/lib/Dialect/Vector/Transforms/MemorySlotOpInterfaceImpl.cpp
    mlir/lib/Transforms/Mem2Reg.cpp
    mlir/lib/Transforms/SROA.cpp
    mlir/test/lib/Dialect/Test/TestOpDefs.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Optimizer/Dialect/FIROps.cpp b/flang/lib/Optimizer/Dialect/FIROps.cpp
index 2480996cb411c..e89cccaea66d0 100644
--- a/flang/lib/Optimizer/Dialect/FIROps.cpp
+++ b/flang/lib/Optimizer/Dialect/FIROps.cpp
@@ -297,7 +297,7 @@ llvm::SmallVector<mlir::MemorySlot> fir::AllocaOp::getPromotableSlots() {
 
 mlir::Value fir::AllocaOp::getDefaultValue(const mlir::MemorySlot &slot,
                                            mlir::OpBuilder &builder) {
-  return fir::UndefOp::create(builder, getLoc(), slot.elemType);
+  return fir::UndefOp::create(builder, getLoc(), slot.valueType);
 }
 
 void fir::AllocaOp::handleBlockArgument(const mlir::MemorySlot &slot,

diff  --git a/mlir/include/mlir/Interfaces/MemorySlotInterfaces.h b/mlir/include/mlir/Interfaces/MemorySlotInterfaces.h
index 4ddacd67f99c2..b2b5418e1bac1 100644
--- a/mlir/include/mlir/Interfaces/MemorySlotInterfaces.h
+++ b/mlir/include/mlir/Interfaces/MemorySlotInterfaces.h
@@ -23,7 +23,7 @@ struct MemorySlot {
   /// Pointer to the memory slot, used by operations to refer to it.
   Value ptr;
   /// Type of the value contained in the slot.
-  Type elemType;
+  Type valueType;
 };
 
 /// Memory slot attached with information about its destructuring procedure.

diff  --git a/mlir/lib/Dialect/Affine/IR/MemorySlot.cpp b/mlir/lib/Dialect/Affine/IR/MemorySlot.cpp
index 7b74b7eb7bb6b..9d1452a7de6e8 100644
--- a/mlir/lib/Dialect/Affine/IR/MemorySlot.cpp
+++ b/mlir/lib/Dialect/Affine/IR/MemorySlot.cpp
@@ -31,7 +31,7 @@ void AffineForOp::setupPromotion(
   }
 
   getInitsMutable().append(reachingDef);
-  bodyRegion.addArgument(slot.elemType, slot.ptr.getLoc());
+  bodyRegion.addArgument(slot.valueType, slot.ptr.getLoc());
   regionsToProcess.insert({&bodyRegion, bodyRegion.getArguments().back()});
 }
 
@@ -47,7 +47,7 @@ Value AffineForOp::finalizePromotion(
   memoryslot::updateTerminator(getBody(), reachingDef, reachingAtBlockEnd);
 
   SmallVector<Type> resultTypes(getResultTypes());
-  resultTypes.push_back(slot.elemType);
+  resultTypes.push_back(slot.valueType);
 
   IRRewriter rewriter(builder);
   Operation *newOp =

diff  --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp
index b398556d5328c..b76dc8647b91b 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp
@@ -38,7 +38,7 @@ llvm::SmallVector<MemorySlot> LLVM::AllocaOp::getPromotableSlots() {
 
 Value LLVM::AllocaOp::getDefaultValue(const MemorySlot &slot,
                                       OpBuilder &builder) {
-  return LLVM::UndefOp::create(builder, getLoc(), slot.elemType);
+  return LLVM::UndefOp::create(builder, getLoc(), slot.valueType);
 }
 
 void LLVM::AllocaOp::handleBlockArgument(const MemorySlot &slot,
@@ -358,7 +358,7 @@ static Value createInsertAndCast(OpBuilder &builder, Location loc,
 Value LLVM::StoreOp::getStored(const MemorySlot &slot, OpBuilder &builder,
                                Value reachingDef,
                                const DataLayout &dataLayout) {
-  assert(reachingDef && reachingDef.getType() == slot.elemType &&
+  assert(reachingDef && reachingDef.getType() == slot.valueType &&
          "expected the reaching definition's type to match the slot's type");
   return createInsertAndCast(builder, getLoc(), getValue(), reachingDef,
                              dataLayout);
@@ -376,7 +376,8 @@ bool LLVM::LoadOp::canUsesBeRemoved(
   // be removed (provided it is not volatile).
   return blockingUse == slot.ptr && getAddr() == slot.ptr &&
          areConversionCompatible(dataLayout, getResult().getType(),
-                                 slot.elemType, /*narrowingConversion=*/true) &&
+                                 slot.valueType,
+                                 /*narrowingConversion=*/true) &&
          !getVolatile_();
 }
 
@@ -404,7 +405,7 @@ bool LLVM::StoreOp::canUsesBeRemoved(
   // store OF the slot pointer, only INTO the slot pointer.
   return blockingUse == slot.ptr && getAddr() == slot.ptr &&
          getValue() != slot.ptr &&
-         areConversionCompatible(dataLayout, slot.elemType,
+         areConversionCompatible(dataLayout, slot.valueType,
                                  getValue().getType(),
                                  /*narrowingConversion=*/false) &&
          !getVolatile_();
@@ -421,7 +422,7 @@ DeletionKind LLVM::StoreOp::removeBlockingUses(
 static bool isValidAccessType(const MemorySlot &slot, Type accessType,
                               const DataLayout &dataLayout) {
   return dataLayout.getTypeSize(accessType) <=
-         dataLayout.getTypeSize(slot.elemType);
+         dataLayout.getTypeSize(slot.valueType);
 }
 
 LogicalResult LLVM::LoadOp::ensureOnlySafeAccesses(
@@ -442,7 +443,7 @@ LogicalResult LLVM::StoreOp::ensureOnlySafeAccesses(
 static Type getTypeAtIndex(const DestructurableMemorySlot &slot,
                            Attribute index) {
   auto subelementIndexMap =
-      cast<DestructurableTypeInterface>(slot.elemType).getSubelementIndexMap();
+      cast<DestructurableTypeInterface>(slot.valueType).getSubelementIndexMap();
   if (!subelementIndexMap)
     return {};
   assert(!subelementIndexMap->empty());
@@ -783,7 +784,7 @@ getSubslotAccessInfo(const DestructurableMemorySlot &slot,
     return index >= (1 << LLVM::kGEPConstantBitWidth);
   };
 
-  Type type = slot.elemType;
+  Type type = slot.valueType;
   if (*offset >= dataLayout.getTypeSize(type))
     return {};
   return TypeSwitch<Type, std::optional<SubslotAccessInfo>>(type)
@@ -845,7 +846,7 @@ LogicalResult LLVM::GEPOp::ensureOnlySafeAccesses(
   std::optional<uint64_t> gepOffset = gepToByteOffset(dataLayout, *this);
   if (!gepOffset)
     return failure();
-  uint64_t slotSize = dataLayout.getTypeSize(slot.elemType);
+  uint64_t slotSize = dataLayout.getTypeSize(slot.valueType);
   // Check that the access is strictly inside the slot.
   if (*gepOffset >= slotSize)
     return failure();
@@ -1019,7 +1020,7 @@ static bool definitelyWritesOnlyWithinSlot(MemIntr op, const MemorySlot &slot,
     return false;
 
   std::optional<uint64_t> memIntrLen = getStaticMemIntrLen(op);
-  return memIntrLen && *memIntrLen <= dataLayout.getTypeSize(slot.elemType);
+  return memIntrLen && *memIntrLen <= dataLayout.getTypeSize(slot.valueType);
 }
 
 /// Checks whether all indices are i32. This is used to check GEPs can index
@@ -1042,13 +1043,14 @@ static bool memsetCanRewire(MemsetIntr op, const DestructurableMemorySlot &slot,
                             SmallPtrSetImpl<Attribute> &usedIndices,
                             SmallVectorImpl<MemorySlot> &mustBeSafelyUsed,
                             const DataLayout &dataLayout) {
-  if (&slot.elemType.getDialect() != op.getOperation()->getDialect())
+  if (&slot.valueType.getDialect() != op.getOperation()->getDialect())
     return false;
 
   if (op.getIsVolatile())
     return false;
 
-  if (!cast<DestructurableTypeInterface>(slot.elemType).getSubelementIndexMap())
+  if (!cast<DestructurableTypeInterface>(slot.valueType)
+           .getSubelementIndexMap())
     return false;
 
   if (!areAllIndicesI32(slot))
@@ -1099,7 +1101,7 @@ static Value memsetGetStored(MemsetIntr op, const MemorySlot &slot,
 
     return currentValue;
   };
-  return TypeSwitch<Type, Value>(slot.elemType)
+  return TypeSwitch<Type, Value>(slot.valueType)
       .Case([&](IntegerType type) -> Value {
         return buildMemsetValue(type.getWidth());
       })
@@ -1118,7 +1120,7 @@ memsetCanUsesBeRemoved(MemsetIntr op, const MemorySlot &slot,
                        SmallVectorImpl<OpOperand *> &newBlockingUses,
                        const DataLayout &dataLayout) {
   bool canConvertType =
-      TypeSwitch<Type, bool>(slot.elemType)
+      TypeSwitch<Type, bool>(slot.valueType)
           .Case<IntegerType, FloatType>([](auto type) {
             return type.getWidth() % 8 == 0 && type.getWidth() > 0;
           })
@@ -1129,7 +1131,7 @@ memsetCanUsesBeRemoved(MemsetIntr op, const MemorySlot &slot,
   if (op.getIsVolatile())
     return false;
 
-  return getStaticMemIntrLen(op) == dataLayout.getTypeSize(slot.elemType);
+  return getStaticMemIntrLen(op) == dataLayout.getTypeSize(slot.valueType);
 }
 
 template <class MemsetIntr>
@@ -1139,12 +1141,12 @@ memsetRewire(MemsetIntr op, const DestructurableMemorySlot &slot,
              const DataLayout &dataLayout) {
 
   std::optional<DenseMap<Attribute, Type>> types =
-      cast<DestructurableTypeInterface>(slot.elemType).getSubelementIndexMap();
+      cast<DestructurableTypeInterface>(slot.valueType).getSubelementIndexMap();
 
   IntegerAttr memsetLenAttr = createMemsetLenAttr(op);
 
   bool packed = false;
-  if (auto structType = dyn_cast<LLVM::LLVMStructType>(slot.elemType))
+  if (auto structType = dyn_cast<LLVM::LLVMStructType>(slot.valueType))
     packed = structType.isPacked();
 
   Type i32 = IntegerType::get(op.getContext(), 32);
@@ -1291,7 +1293,8 @@ static bool memcpyStoresTo(MemcpyLike op, const MemorySlot &slot) {
 template <class MemcpyLike>
 static Value memcpyGetStored(MemcpyLike op, const MemorySlot &slot,
                              OpBuilder &builder) {
-  return LLVM::LoadOp::create(builder, op.getLoc(), slot.elemType, op.getSrc());
+  return LLVM::LoadOp::create(builder, op.getLoc(), slot.valueType,
+                              op.getSrc());
 }
 
 template <class MemcpyLike>
@@ -1309,7 +1312,7 @@ memcpyCanUsesBeRemoved(MemcpyLike op, const MemorySlot &slot,
   if (op.getIsVolatile())
     return false;
 
-  return getStaticMemIntrLen(op) == dataLayout.getTypeSize(slot.elemType);
+  return getStaticMemIntrLen(op) == dataLayout.getTypeSize(slot.valueType);
 }
 
 template <class MemcpyLike>
@@ -1342,14 +1345,15 @@ static bool memcpyCanRewire(MemcpyLike op, const DestructurableMemorySlot &slot,
   if (op.getIsVolatile())
     return false;
 
-  if (!cast<DestructurableTypeInterface>(slot.elemType).getSubelementIndexMap())
+  if (!cast<DestructurableTypeInterface>(slot.valueType)
+           .getSubelementIndexMap())
     return false;
 
   if (!areAllIndicesI32(slot))
     return false;
 
   // Only full copies are supported.
-  if (getStaticMemIntrLen(op) != dataLayout.getTypeSize(slot.elemType))
+  if (getStaticMemIntrLen(op) != dataLayout.getTypeSize(slot.valueType))
     return false;
 
   if (op.getSrc() == slot.ptr)
@@ -1422,13 +1426,13 @@ memcpyRewire(MemcpyLike op, const DestructurableMemorySlot &slot,
                cast<IntegerAttr>(index).getValue().getZExtValue())};
     Value subslotPtrInOther = LLVM::GEPOp::create(
         builder, op.getLoc(), LLVM::LLVMPointerType::get(op.getContext()),
-        slot.elemType, isDst ? op.getSrc() : op.getDst(), gepIndices);
+        slot.valueType, isDst ? op.getSrc() : op.getDst(), gepIndices);
 
     // Then create a new memcpy out of this source pointer.
     createMemcpyLikeToReplace(builder, dataLayout, op,
                               isDst ? subslot.ptr : subslotPtrInOther,
                               isDst ? subslotPtrInOther : subslot.ptr,
-                              subslot.elemType, op.getIsVolatile());
+                              subslot.valueType, op.getIsVolatile());
   }
 
   assert(subslots.size() == slotsTreated);

diff  --git a/mlir/lib/Dialect/MemRef/IR/MemRefMemorySlot.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefMemorySlot.cpp
index 0b1704b551fdd..7f58e099b45b5 100644
--- a/mlir/lib/Dialect/MemRef/IR/MemRefMemorySlot.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/MemRefMemorySlot.cpp
@@ -137,7 +137,7 @@ SmallVector<MemorySlot> memref::AllocaOp::getPromotableSlots() {
 
 Value memref::AllocaOp::getDefaultValue(const MemorySlot &slot,
                                         OpBuilder &builder) {
-  return ub::PoisonOp::create(builder, getLoc(), slot.elemType);
+  return ub::PoisonOp::create(builder, getLoc(), slot.valueType);
 }
 
 std::optional<PromotableAllocationOpInterface>
@@ -223,7 +223,7 @@ bool memref::LoadOp::canUsesBeRemoved(
     return false;
   Value blockingUse = (*blockingUses.begin())->get();
   return blockingUse == slot.ptr && getMemRef() == slot.ptr &&
-         getResult().getType() == slot.elemType;
+         getResult().getType() == slot.valueType;
 }
 
 DeletionKind memref::LoadOp::removeBlockingUses(
@@ -303,7 +303,7 @@ bool memref::StoreOp::canUsesBeRemoved(
     return false;
   Value blockingUse = (*blockingUses.begin())->get();
   return blockingUse == slot.ptr && getMemRef() == slot.ptr &&
-         getValue() != slot.ptr && getValue().getType() == slot.elemType;
+         getValue() != slot.ptr && getValue().getType() == slot.valueType;
 }
 
 DeletionKind memref::StoreOp::removeBlockingUses(

diff  --git a/mlir/lib/Dialect/SCF/IR/MemorySlot.cpp b/mlir/lib/Dialect/SCF/IR/MemorySlot.cpp
index 92fc3452d4629..6ec36b5bebbb6 100644
--- a/mlir/lib/Dialect/SCF/IR/MemorySlot.cpp
+++ b/mlir/lib/Dialect/SCF/IR/MemorySlot.cpp
@@ -41,7 +41,7 @@ Value ExecuteRegionOp::finalizePromotion(
       memoryslot::updateTerminator(&block, reachingDef, reachingAtBlockEnd);
 
   SmallVector<Type> resultTypes(getResultTypes());
-  resultTypes.push_back(slot.elemType);
+  resultTypes.push_back(slot.valueType);
 
   IRRewriter rewriter(builder);
   Operation *newOp =
@@ -68,7 +68,7 @@ void ForOp::setupPromotion(
   }
 
   getInitArgsMutable().append(reachingDef);
-  bodyRegion.addArgument(slot.elemType, slot.ptr.getLoc());
+  bodyRegion.addArgument(slot.valueType, slot.ptr.getLoc());
   regionsToProcess.insert({&bodyRegion, bodyRegion.getArguments().back()});
 }
 
@@ -84,7 +84,7 @@ Value ForOp::finalizePromotion(
   memoryslot::updateTerminator(getBody(), reachingDef, reachingAtBlockEnd);
 
   SmallVector<Type> resultTypes(getResultTypes());
-  resultTypes.push_back(slot.elemType);
+  resultTypes.push_back(slot.valueType);
 
   IRRewriter rewriter(builder);
   Operation *newOp =
@@ -157,7 +157,7 @@ Value IfOp::finalizePromotion(
   }
 
   SmallVector<Type> resultTypes(getResultTypes());
-  resultTypes.push_back(slot.elemType);
+  resultTypes.push_back(slot.valueType);
 
   Operation *newOp =
       memoryslot::replaceWithNewResults(rewriter, getOperation(), resultTypes);
@@ -199,7 +199,7 @@ Value IndexSwitchOp::finalizePromotion(
                                  reachingAtBlockEnd);
 
   SmallVector<Type> resultTypes(getResultTypes());
-  resultTypes.push_back(slot.elemType);
+  resultTypes.push_back(slot.valueType);
 
   Operation *newOp =
       memoryslot::replaceWithNewResults(rewriter, getOperation(), resultTypes);
@@ -281,10 +281,10 @@ void WhileOp::setupPromotion(
 
   getInitsMutable().append(reachingDef);
 
-  beforeRegion.addArgument(slot.elemType, slot.ptr.getLoc());
+  beforeRegion.addArgument(slot.valueType, slot.ptr.getLoc());
   regionsToProcess.insert({&beforeRegion, beforeRegion.getArguments().back()});
 
-  afterRegion.addArgument(slot.elemType, slot.ptr.getLoc());
+  afterRegion.addArgument(slot.valueType, slot.ptr.getLoc());
   regionsToProcess.insert({&afterRegion, afterRegion.getArguments().back()});
 }
 
@@ -304,7 +304,7 @@ Value WhileOp::finalizePromotion(
       &getAfter().back(), getAfter().getArguments().back(), reachingAtBlockEnd);
 
   SmallVector<Type> resultTypes(getResultTypes());
-  resultTypes.push_back(slot.elemType);
+  resultTypes.push_back(slot.valueType);
 
   IRRewriter rewriter(builder);
   Operation *newOp =

diff  --git a/mlir/lib/Dialect/Vector/Transforms/MemorySlotOpInterfaceImpl.cpp b/mlir/lib/Dialect/Vector/Transforms/MemorySlotOpInterfaceImpl.cpp
index 1acebcb215439..f33b746240d8e 100644
--- a/mlir/lib/Dialect/Vector/Transforms/MemorySlotOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/MemorySlotOpInterfaceImpl.cpp
@@ -62,7 +62,7 @@ isWholeBufferTransfer(VectorTransferOpInterface xferOp, const MemorySlot &slot,
     return false;
 
   // Exact type match pins rank/extents/element type/scalable dims.
-  if (xferOp.getVectorType() != slot.elemType)
+  if (xferOp.getVectorType() != slot.valueType)
     return false;
 
   // Access must start at the buffer origin in every dimension.
@@ -235,7 +235,7 @@ struct SubViewOpAliasModel
 
     // The parent slot must promote to a vector (whole-buffer promotion). A
     // scalar (single-element) parent slot cannot be sliced.
-    auto parentVecType = dyn_cast<VectorType>(parentSlot.elemType);
+    auto parentVecType = dyn_cast<VectorType>(parentSlot.valueType);
     if (!parentVecType)
       return;
 
@@ -259,7 +259,7 @@ struct SubViewOpAliasModel
                                      OpBuilder &builder) const {
     auto subView = cast<memref::SubViewOp>(op);
     SmallVector<int64_t> offsets = *getPromotableSubViewOffsets(subView);
-    auto aliasVecType = cast<VectorType>(aliasSlot.elemType);
+    auto aliasVecType = cast<VectorType>(aliasSlot.valueType);
     SmallVector<int64_t> strides(offsets.size(), 1);
     return vector::ExtractStridedSliceOp::create(
                builder, op->getLoc(), slotValue, offsets,

diff  --git a/mlir/lib/Transforms/Mem2Reg.cpp b/mlir/lib/Transforms/Mem2Reg.cpp
index 12f50d777e79c..f2c9e47deb3d2 100644
--- a/mlir/lib/Transforms/Mem2Reg.cpp
+++ b/mlir/lib/Transforms/Mem2Reg.cpp
@@ -720,7 +720,7 @@ void MemorySlotPromoter::promoteInRegion(Region *region, Value reachingDef) {
 
     if (info.mergePoints.contains(block)) {
       BlockArgument blockArgument =
-          block->addArgument(slot.elemType, slot.ptr.getLoc());
+          block->addArgument(slot.valueType, slot.ptr.getLoc());
       job.reachingDef = blockArgument;
     }
 

diff  --git a/mlir/lib/Transforms/SROA.cpp b/mlir/lib/Transforms/SROA.cpp
index 859c0302185e6..fb26a9264bf3a 100644
--- a/mlir/lib/Transforms/SROA.cpp
+++ b/mlir/lib/Transforms/SROA.cpp
@@ -47,7 +47,7 @@ struct MemorySlotDestructuringInfo {
 static std::optional<MemorySlotDestructuringInfo>
 computeDestructuringInfo(DestructurableMemorySlot &slot,
                          const DataLayout &dataLayout) {
-  assert(isa<DestructurableTypeInterface>(slot.elemType));
+  assert(isa<DestructurableTypeInterface>(slot.valueType));
 
   if (slot.ptr.use_empty())
     return {};

diff  --git a/mlir/test/lib/Dialect/Test/TestOpDefs.cpp b/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
index 9fe2168e11737..ad08c5c6501b7 100644
--- a/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
+++ b/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
@@ -1836,7 +1836,7 @@ llvm::SmallVector<MemorySlot> TestMultiSlotAlloca::getPromotableSlots() {
 
 Value TestMultiSlotAlloca::getDefaultValue(const MemorySlot &slot,
                                            OpBuilder &builder) {
-  return TestOpConstant::create(builder, getLoc(), slot.elemType,
+  return TestOpConstant::create(builder, getLoc(), slot.valueType,
                                 builder.getI32IntegerAttr(42));
 }
 
@@ -1991,10 +1991,10 @@ Value TestTransparentCastAlias::projectSlotValueToAliasValue(
     OpOperand & /*aliasedSlotPointerOperand*/,
     const MemorySlot & /*parentSlot*/, const MemorySlot &aliasSlot,
     Value slotValue, OpBuilder &builder) {
-  if (slotValue.getType() == aliasSlot.elemType)
+  if (slotValue.getType() == aliasSlot.valueType)
     return slotValue;
   return UnrealizedConversionCastOp::create(builder, getLoc(),
-                                            aliasSlot.elemType, slotValue)
+                                            aliasSlot.valueType, slotValue)
       .getResult(0);
 }
 
@@ -2002,10 +2002,10 @@ Value TestTransparentCastAlias::projectAliasValueToSlotValue(
     OpOperand & /*aliasedSlotPointerOperand*/, const MemorySlot &parentSlot,
     const MemorySlot & /*aliasSlot*/, Value aliasValue, Value /*reachingDef*/,
     OpBuilder &builder) {
-  if (aliasValue.getType() == parentSlot.elemType)
+  if (aliasValue.getType() == parentSlot.valueType)
     return aliasValue;
   return UnrealizedConversionCastOp::create(builder, getLoc(),
-                                            parentSlot.elemType, aliasValue)
+                                            parentSlot.valueType, aliasValue)
       .getResult(0);
 }
 
@@ -2047,10 +2047,10 @@ Value TestTransparentDualAlias::projectSlotValueToAliasValue(
     OpOperand & /*aliasedSlotPointerOperand*/,
     const MemorySlot & /*parentSlot*/, const MemorySlot &aliasSlot,
     Value slotValue, OpBuilder &builder) {
-  if (slotValue.getType() == aliasSlot.elemType)
+  if (slotValue.getType() == aliasSlot.valueType)
     return slotValue;
   return UnrealizedConversionCastOp::create(builder, getLoc(),
-                                            aliasSlot.elemType, slotValue)
+                                            aliasSlot.valueType, slotValue)
       .getResult(0);
 }
 
@@ -2058,10 +2058,10 @@ Value TestTransparentDualAlias::projectAliasValueToSlotValue(
     OpOperand & /*aliasedSlotPointerOperand*/, const MemorySlot &parentSlot,
     const MemorySlot & /*aliasSlot*/, Value aliasValue, Value /*reachingDef*/,
     OpBuilder &builder) {
-  if (aliasValue.getType() == parentSlot.elemType)
+  if (aliasValue.getType() == parentSlot.valueType)
     return aliasValue;
   return UnrealizedConversionCastOp::create(builder, getLoc(),
-                                            parentSlot.elemType, aliasValue)
+                                            parentSlot.valueType, aliasValue)
       .getResult(0);
 }
 
@@ -2098,7 +2098,7 @@ Value TestPartialAlias::projectSlotValueToAliasValue(
     Value slotValue, OpBuilder &builder) {
   // Sub-value extraction: 1-input cast.
   return UnrealizedConversionCastOp::create(builder, getLoc(),
-                                            aliasSlot.elemType, slotValue)
+                                            aliasSlot.valueType, slotValue)
       .getResult(0);
 }
 
@@ -2109,7 +2109,7 @@ Value TestPartialAlias::projectAliasValueToSlotValue(
   // Sub-value insertion into the current reaching definition: emit a 2-input
   // cast taking both the new alias value and the existing parent value.
   return UnrealizedConversionCastOp::create(builder, getLoc(),
-                                            parentSlot.elemType,
+                                            parentSlot.valueType,
                                             ValueRange{aliasValue, reachingDef})
       .getResult(0);
 }


        


More information about the flang-commits mailing list