[PATCH] D46500: [WebAssembly] CFG sort support for exception handling

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 5 21:14:07 PDT 2018


aheejin added inline comments.


================
Comment at: lib/Target/WebAssembly/WebAssemblyCFGSort.cpp:200
                   const MachineBasicBlock *B) const {
+    // We give a higher priority to an EH pad
+    if (A->isEHPad() && !B->isEHPad())
----------------
dschuff wrote:
> Even when comparing backwards? I don't quite understand why this shouldn't just be the inverse of forward comparison.
For some reason I don't fully understand, for `Ready` list later BBs are selected first. But my intention here is no matter whether the list is `Preferred` (which uses `CompareBlockNumbers`) or `Ready` (which uses `CompareBlockNumbersBackwards`), whenever we have an EH pad ready, we want to pick it first.

So `CompareBlockNumbersBackwards` doesn't mean its results will be used in the reverse direction. Regardless of the comparison function, a BB indicated by the function as having higher priority is placed before when sorting.


Repository:
  rL LLVM

https://reviews.llvm.org/D46500





More information about the llvm-commits mailing list