Skip to content

Commit

Permalink
[OpenMP][FIX] Make heap2shared deterministic
Browse files Browse the repository at this point in the history
Issue #52875 reported non-determinism, this is the first step to avoid
it. We iterate over MallocCalls so we should keep the order stable.
  • Loading branch information
jdoerfert committed Dec 29, 2021
1 parent 7de5da2 commit ba70f3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/IPO/OpenMPOpt.cpp
Expand Up @@ -2808,7 +2808,7 @@ struct AAHeapToSharedFunction : public AAHeapToShared {
if (CallBase *CB = dyn_cast<CallBase>(U))
if (!isa<ConstantInt>(CB->getArgOperand(0)) ||
!ED.isExecutedByInitialThreadOnly(*CB))
MallocCalls.erase(CB);
MallocCalls.remove(CB);
}

findPotentialRemovedFreeCalls(A);
Expand All @@ -2820,7 +2820,7 @@ struct AAHeapToSharedFunction : public AAHeapToShared {
}

/// Collection of all malloc calls in a function.
SmallPtrSet<CallBase *, 4> MallocCalls;
SmallSetVector<CallBase *, 4> MallocCalls;
/// Collection of potentially removed free calls in a function.
SmallPtrSet<CallBase *, 4> PotentialRemovedFreeCalls;
};
Expand Down

0 comments on commit ba70f3a

Please sign in to comment.