[flang-commits] [flang] da1f1b2 - Prevent extraneous copy in f752265231c2d15590a53e45bcc850acf2450dfc

Nimish Mishra via flang-commits flang-commits at lists.llvm.org
Mon Jul 31 05:04:21 PDT 2023


Author: Nimish Mishra
Date: 2023-07-31T17:31:19+05:30
New Revision: da1f1b229246a64ebf385a133c5528a8ce622731

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

LOG: Prevent extraneous copy in f752265231c2d15590a53e45bcc850acf2450dfc

Commit f752265231c2d15590a53e45bcc850acf2450dfc uses
extraneous copy to the loop variable. Fixing the same

Added: 
    

Modified: 
    flang/lib/Lower/OpenMP.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp
index 4aa433b3a970f1..a61f8069513bce 100644
--- a/flang/lib/Lower/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP.cpp
@@ -415,7 +415,7 @@ void DataSharingProcessor::privatize() {
   for (const Fortran::semantics::Symbol *sym : privatizedSymbols) {
     if (const auto *commonDet =
             sym->detailsIf<Fortran::semantics::CommonBlockDetails>()) {
-      for (const auto mem : commonDet->objects()) {
+      for (const auto &mem : commonDet->objects()) {
         cloneSymbol(&*mem);
         copyFirstPrivateSymbol(&*mem);
       }
@@ -431,7 +431,7 @@ void DataSharingProcessor::copyLastPrivatize(mlir::Operation *op) {
   for (const Fortran::semantics::Symbol *sym : privatizedSymbols)
     if (const auto *commonDet =
             sym->detailsIf<Fortran::semantics::CommonBlockDetails>()) {
-      for (const auto mem : commonDet->objects()) {
+      for (const auto &mem : commonDet->objects()) {
         copyLastPrivateSymbol(&*mem, &lastPrivIP);
       }
     } else {


        


More information about the flang-commits mailing list