[llvm] 1ba42dd - [VPlan] Use MapVector for LiveOuts for deterministic iteration.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 01:30:48 PDT 2022


Author: Florian Hahn
Date: 2022-05-25T09:30:02+01:00
New Revision: 1ba42dd04b8d9310f75d488334526383490e1fa1

URL: https://github.com/llvm/llvm-project/commit/1ba42dd04b8d9310f75d488334526383490e1fa1
DIFF: https://github.com/llvm/llvm-project/commit/1ba42dd04b8d9310f75d488334526383490e1fa1.diff

LOG: [VPlan] Use MapVector for LiveOuts for deterministic iteration.

During code-gen, we iterate over the LiveOuts and the differences in
iteration order can cause slightly different outputs.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlan.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 7f4a5a98d824d..7072deb6a7860 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -30,6 +30,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DepthFirstIterator.h"
 #include "llvm/ADT/GraphTraits.h"
+#include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallBitVector.h"
 #include "llvm/ADT/SmallPtrSet.h"
@@ -2513,7 +2514,7 @@ class VPlan {
   bool Value2VPValueEnabled = true;
 
   /// Values used outside the plan.
-  DenseMap<PHINode *, VPLiveOut *> LiveOuts;
+  MapVector<PHINode *, VPLiveOut *> LiveOuts;
 
 public:
   VPlan(VPBlockBase *Entry = nullptr) : Entry(Entry) {
@@ -2705,7 +2706,7 @@ class VPlan {
     LiveOuts.erase(PN);
   }
 
-  const DenseMap<PHINode *, VPLiveOut *> &getLiveOuts() const {
+  const MapVector<PHINode *, VPLiveOut *> &getLiveOuts() const {
     return LiveOuts;
   }
 


        


More information about the llvm-commits mailing list