[flang-commits] [flang] eb97c89 - [fir] Remove unused fct recordTypeCanBeMemCopied

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Tue Nov 30 08:02:51 PST 2021


Author: Valentin Clement
Date: 2021-11-30T17:02:25+01:00
New Revision: eb97c89cacb85c462e4e56057ae734716ed22324

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

LOG: [fir] Remove unused fct recordTypeCanBeMemCopied

Remove unused fct added with 47f759309eeaf9bd77debe4f6c3e1fe52913b537

Added: 
    

Modified: 
    flang/lib/Optimizer/Builder/FIRBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Optimizer/Builder/FIRBuilder.cpp b/flang/lib/Optimizer/Builder/FIRBuilder.cpp
index acfbee8f34dd..823016ca9940 100644
--- a/flang/lib/Optimizer/Builder/FIRBuilder.cpp
+++ b/flang/lib/Optimizer/Builder/FIRBuilder.cpp
@@ -594,23 +594,3 @@ fir::factory::createExtents(fir::FirOpBuilder &builder, mlir::Location loc,
             : builder.createIntegerConstant(loc, idxTy, ext));
   return extents;
 }
-
-/// Can the assignment of this record type be implement with a simple memory
-/// copy ?
-static bool recordTypeCanBeMemCopied(fir::RecordType recordType) {
-  if (fir::hasDynamicSize(recordType))
-    return false;
-  for (auto [_, fieldType] : recordType.getTypeList()) {
-    // Derived type component may have user assignment (so far, we cannot tell
-    // in FIR, so assume it is always the case, TODO: get the actual info).
-    if (fir::unwrapSequenceType(fieldType).isa<fir::RecordType>())
-      return false;
-    // Allocatable components need deep copy.
-    if (auto boxType = fieldType.dyn_cast<fir::BoxType>())
-      if (boxType.getEleTy().isa<fir::HeapType>())
-        return false;
-  }
-  // Constant size components without user defined assignment and pointers can
-  // be memcopied.
-  return true;
-}


        


More information about the flang-commits mailing list