[PATCH] D74999: [WebAssembly] Fix a non-determinism problem in FixIrreducibleControlFlow

Alon Zakai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 21 16:20:57 PST 2020


kripken marked 2 inline comments as done.
kripken added a comment.

In D74999#1887675 <https://reviews.llvm.org/D74999#1887675>, @aheejin wrote:

> There seem to be multiple places that call `Graph.getLoopEntries()`. I guess we should sort all of them..? How about sort `LoopEntries` at the end of `calculate()` once and for all?


We actually don't need to sort all of them - just where it matters. For example at the end of processRegion the different sets are guaranteed to be disjoint, and so we can process them in any order (see comment inside the loop). And it might be a little faster to not sort unnecessarily.



================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp:72
+  llvm::sort(SortedEntries,
+             [&](const MachineBasicBlock *A, const MachineBasicBlock *B) {
+               auto ANum = A->getNumber();
----------------
dschuff wrote:
> do we need to capture everything `[&]` here?
Ah, we don't good point. This code was just copied around but good idea to fix that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74999/new/

https://reviews.llvm.org/D74999





More information about the llvm-commits mailing list