[OpenMP][libomptarget] Set the frame pointer then test empty slot condition
authorGheorghe-Teodor Bercea <gheorghe-teod.bercea@ibm.com>
Tue, 25 Sep 2018 18:48:14 +0000 (18:48 +0000)
committerGheorghe-Teodor Bercea <gheorghe-teod.bercea@ibm.com>
Tue, 25 Sep 2018 18:48:14 +0000 (18:48 +0000)
Summary: NFC - just fixing a bug: the empty slot test was before the re-setting of the Stack pointer.

Reviewers: ABataev, caomhin, Hahnfeld

Reviewed By: ABataev

Subscribers: guansong, openmp-commits

Differential Revision: https://reviews.llvm.org/D52122

llvm-svn: 343006

openmp/libomptarget/deviceRTLs/nvptx/src/data_sharing.cu

index 6e1548b703d2e1bd4c36fd6348ece50d9cdc4bae..2125c36e1d8241f38e0a825b3cf366b14c3a5a4f 100644 (file)
@@ -477,13 +477,13 @@ EXTERN void __kmpc_data_sharing_pop_stack(void *FrameStart) {
     // Pointer to next available stack.
     void *&StackP = DataSharingState.StackPtr[WID];
 
+    // Pop the frame.
+    StackP = FrameStart;
+
     // If the current slot is empty, we need to free the slot after the
     // pop.
     bool SlotEmpty = (StackP == &SlotP->Data[0]);
 
-    // Pop the frame.
-    StackP = FrameStart;
-
     if (SlotEmpty && SlotP->Prev) {
       // Before removing the slot we need to reset StackP.
       StackP = SlotP->PrevSlotStackPtr;