[polly] r277832 - [CodeGen] Use MapVector instead of DenseMap.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 09:45:52 PDT 2016


Author: meinersbur
Date: Fri Aug  5 11:45:51 2016
New Revision: 277832

URL: http://llvm.org/viewvc/llvm-project?rev=277832&view=rev
Log:
[CodeGen] Use MapVector instead of DenseMap.

The map is iterated over when generating the values escaping the SCoP. The
indeterministic iteration order of DenseMap causes the output IR to change at
every compilation, adding noise to comparisons.

Replace DenseMap by a MapVector to ensure the same iteration order at every
compilation.

Modified:
    polly/trunk/include/polly/CodeGen/BlockGenerators.h
    polly/trunk/lib/CodeGen/BlockGenerators.cpp

Modified: polly/trunk/include/polly/CodeGen/BlockGenerators.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/BlockGenerators.h?rev=277832&r1=277831&r2=277832&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/BlockGenerators.h (original)
+++ polly/trunk/include/polly/CodeGen/BlockGenerators.h Fri Aug  5 11:45:51 2016
@@ -18,7 +18,7 @@
 
 #include "polly/CodeGen/IRBuilder.h"
 #include "polly/Support/ScopHelper.h"
-#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/MapVector.h"
 #include "llvm/Analysis/ScalarEvolutionExpressions.h"
 #include "isl/map.h"
 
@@ -57,8 +57,8 @@ public:
   ///
   /// @see The EscapeMap member.
   using EscapeUsersAllocaMapTy =
-      DenseMap<Instruction *,
-               std::pair<AssertingVH<Value>, EscapeUserVectorTy>>;
+      MapVector<Instruction *,
+                std::pair<AssertingVH<Value>, EscapeUserVectorTy>>;
 
   ///@}
 

Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=277832&r1=277831&r2=277832&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Fri Aug  5 11:45:51 2016
@@ -547,8 +547,8 @@ void BlockGenerator::createScalarFinaliz
   for (const auto &EscapeMapping : EscapeMap) {
     // Extract the escaping instruction and the escaping users as well as the
     // alloca the instruction was demoted to.
-    Instruction *EscapeInst = EscapeMapping.getFirst();
-    const auto &EscapeMappingValue = EscapeMapping.getSecond();
+    Instruction *EscapeInst = EscapeMapping.first;
+    const auto &EscapeMappingValue = EscapeMapping.second;
     const EscapeUserVectorTy &EscapeUsers = EscapeMappingValue.second;
     Value *ScalarAddr = EscapeMappingValue.first;
 




More information about the llvm-commits mailing list