Skip to content

Commit fc63462

Browse files
committed
Revert deallocation changes + add missing header
I was mistaken about the deallocation. Firstly, all of the other private copies on threads that don't execute the last iteration need to be freed. Secondly, the assign copies the data not the pointer.
1 parent c62761e commit fc63462

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

flang/lib/Lower/OpenMP/DataSharingProcessor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "flang/Lower/SymbolMap.h"
1818
#include "flang/Optimizer/Builder/HLFIRTools.h"
1919
#include "flang/Optimizer/Builder/Todo.h"
20+
#include "flang/Optimizer/HLFIR/HLFIROps.h"
2021
#include "flang/Semantics/tools.h"
2122

2223
namespace Fortran {
@@ -79,8 +80,7 @@ void DataSharingProcessor::processStep2(mlir::Operation *op, bool isLoop) {
7980

8081
void DataSharingProcessor::insertDeallocs() {
8182
for (const semantics::Symbol *sym : allPrivatizedSymbols)
82-
if (semantics::IsAllocatable(sym->GetUltimate()) &&
83-
!sym->test(semantics::Symbol::Flag::OmpLastPrivate)) {
83+
if (semantics::IsAllocatable(sym->GetUltimate())) {
8484
if (!useDelayedPrivatization) {
8585
converter.createHostAssociateVarCloneDealloc(*sym);
8686
continue;

flang/test/Lower/OpenMP/lastprivate-allocatable.f90

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,3 @@ program lastprivate_allocatable
3636
! CHECK-NEXT: }
3737
! CHECK-NEXT: omp.yield
3838
! CHECK-NEXT: }
39-
! CHECK-NEXT: omp.terminator
40-
! CHECK-NEXT: }
41-
! [no deallocation here]
42-
! CHECK-NEXT: omp.terminator
43-
! CHECK-NEXT: }
44-

0 commit comments

Comments
 (0)