OSDN Git Service

[UnifyLoopExits] Fix non-deterministic iteration order
authorJay Foad <jay.foad@amd.com>
Fri, 11 Sep 2020 21:00:36 +0000 (22:00 +0100)
committerJay Foad <jay.foad@amd.com>
Mon, 14 Sep 2020 08:09:58 +0000 (09:09 +0100)
This was causing random minor codegen differences in shaders compiled
with the AMDGPU backend.

Differential Revision: https://reviews.llvm.org/D87548

llvm/lib/Transforms/Utils/UnifyLoopExits.cpp

index b10deee..6eacb9a 100644 (file)
@@ -16,6 +16,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/ADT/MapVector.h"
 #include "llvm/Analysis/LoopInfo.h"
 #include "llvm/IR/Dominators.h"
 #include "llvm/InitializePasses.h"
@@ -80,7 +81,7 @@ static void restoreSSA(const DominatorTree &DT, const Loop *L,
                        const SetVector<BasicBlock *> &Incoming,
                        BasicBlock *LoopExitBlock) {
   using InstVector = SmallVector<Instruction *, 8>;
-  using IIMap = DenseMap<Instruction *, InstVector>;
+  using IIMap = MapVector<Instruction *, InstVector>;
   IIMap ExternalUsers;
   for (auto BB : L->blocks()) {
     for (auto &I : *BB) {