[llvm] ba70f3a - [OpenMP][FIX] Make heap2shared deterministic
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 28 21:53:54 PST 2021
Author: Johannes Doerfert
Date: 2021-12-28T23:53:28-06:00
New Revision: ba70f3a5d9149c7409e0b3436c9b5dfd71d131ea
URL: https://github.com/llvm/llvm-project/commit/ba70f3a5d9149c7409e0b3436c9b5dfd71d131ea
DIFF: https://github.com/llvm/llvm-project/commit/ba70f3a5d9149c7409e0b3436c9b5dfd71d131ea.diff
LOG: [OpenMP][FIX] Make heap2shared deterministic
Issue #52875 reported non-determinism, this is the first step to avoid
it. We iterate over MallocCalls so we should keep the order stable.
Added:
Modified:
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index e0cb736952e8..1de9ccf4bc6c 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -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);
@@ -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;
};
More information about the llvm-commits
mailing list