[PATCH] D85171: [Polly] Use containers with deterministic iteration order

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 16:08:13 PDT 2020


ctetreau created this revision.
Herald added a reviewer: bollu.
Herald added subscribers: llvm-commits, mgrang.
Herald added a project: LLVM.
ctetreau requested review of this revision.

Use MapVector in BlockGenerators and SmallSetVector in IslNodeBuilder.
DenseMap and SmallSet have non-deterministic iteration order, resulting
in differences in code generation between runs of the compiler on the
same input


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85171

Files:
  polly/include/polly/CodeGen/BlockGenerators.h
  polly/include/polly/CodeGen/IslNodeBuilder.h
  polly/lib/CodeGen/IslNodeBuilder.cpp


Index: polly/lib/CodeGen/IslNodeBuilder.cpp
===================================================================
--- polly/lib/CodeGen/IslNodeBuilder.cpp
+++ polly/lib/CodeGen/IslNodeBuilder.cpp
@@ -1335,7 +1335,7 @@
   // non-finite loop constraints. In such a case we have to bail out and insert
   // a "false" runtime check that will cause the original code to be executed.
   auto PtrId = std::make_pair(IAClass.IdentifyingPointer, IAClass.AccessType);
-  if (!PreloadedPtrs.insert(PtrId).second)
+  if (!PreloadedPtrs.insert(PtrId))
     return false;
 
   // The execution context of the IAClass.
Index: polly/include/polly/CodeGen/IslNodeBuilder.h
===================================================================
--- polly/include/polly/CodeGen/IslNodeBuilder.h
+++ polly/include/polly/CodeGen/IslNodeBuilder.h
@@ -288,7 +288,7 @@
   /// Set to remember materialized invariant loads.
   ///
   /// An invariant load is identified by its pointer (the SCEV) and its type.
-  SmallSet<std::pair<const SCEV *, Type *>, 16> PreloadedPtrs;
+  SmallSetVector<std::pair<const SCEV *, Type *>, 16> PreloadedPtrs;
 
   /// Preload the memory access at @p AccessRange with @p Build.
   ///
Index: polly/include/polly/CodeGen/BlockGenerators.h
===================================================================
--- polly/include/polly/CodeGen/BlockGenerators.h
+++ polly/include/polly/CodeGen/BlockGenerators.h
@@ -34,7 +34,7 @@
   /// Map types to resolve scalar dependences.
   ///
   ///@{
-  using AllocaMapTy = DenseMap<const ScopArrayInfo *, AssertingVH<AllocaInst>>;
+  using AllocaMapTy = MapVector<const ScopArrayInfo *, AssertingVH<AllocaInst>>;
 
   /// Simple vector of instructions to store escape users.
   using EscapeUserVectorTy = SmallVector<Instruction *, 4>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85171.282756.patch
Type: text/x-patch
Size: 1778 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200803/f283933c/attachment.bin>


More information about the llvm-commits mailing list