[PATCH] D110292: Use a deterministic order when updating the DominatorTree

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 22 14:51:22 PDT 2021


bjope created this revision.
bjope added reviewers: lebedev.ri, kuhar.
Herald added subscribers: mgrang, hiraditya.
bjope requested review of this revision.
Herald added a project: LLVM.

This solved a problem with non-deterministic output from opt due
to not performing dominator tree updates in a deterministic order.
The problem found was the JumpThreading used the DomTreeUpdater via
llvm::MergeBasicBlockIntoOnlyPred. And when preparing the list of
updates to send to DomTreeUpdater::applyUpdates we iterated over
a SmallPtrSet, which does not give a well-defined order.

The added domtree-updates.ll test case is an example that would
result in non-deterministic printouts of the domtree. Semantically
those domtree:s where equivalent, but since passes (at least EarlyCSE)
are iterating over nodes in the dominator tree the order in which
transforms are applied transitively also depend on the order in which
dominator tree updates are performed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110292

Files:
  llvm/lib/CodeGen/IndirectBrExpandPass.cpp
  llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp
  llvm/test/Transforms/JumpThreading/domtree-updates.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110292.374374.patch
Type: text/x-patch
Size: 19515 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210922/81d25dea/attachment.bin>


More information about the llvm-commits mailing list