[llvm] [GVNSink] Fix non-determinisms by using Depth-First ordering (PR #90995)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 15:22:50 PDT 2024


================
@@ -886,8 +919,12 @@ void GVNSink::sinkLastInstruction(ArrayRef<BasicBlock *> Blocks,
 } // end anonymous namespace
 
 PreservedAnalyses GVNSinkPass::run(Function &F, FunctionAnalysisManager &AM) {
-  GVNSink G;
+  auto &DT = AM.getResult<DominatorTreeAnalysis>(F);
+  GVNSink G(&DT);
   if (!G.run(F))
     return PreservedAnalyses::all();
+
+  // PHI nodes get inserted which haven't been added to the Dominator Tree.
----------------
hiraditya wrote:

nvm. I found a way to update it. Posting the patch soon.

https://github.com/llvm/llvm-project/pull/90995


More information about the llvm-commits mailing list