[PATCH] D67974: [Dominators][AMDGPU] Don't use virtual exit node in findNearestCommonDominator. Cleanup MachinePostDominators.

Michael Liao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 14:09:42 PDT 2019


hliao requested changes to this revision.
hliao added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/CodeGen/MachinePostDominators.cpp:59
+  assert(!Blocks.empty());
+  assert(llvm::all_of(Blocks, [](MachineBasicBlock *B) { return B; }) &&
+         "Invalid block found");
----------------
kuhar wrote:
> hliao wrote:
> > no need to (expensive) check every BB is not null. findNearestCommonDomniator asserts on both of them are non-null.
> This should be a very quick scan over the vector of blocks, not more expensive than the inner check.
> The intention was twofold:
> 1. Document the blocks cannot be nullptr.
> 2. Fail quickly where the contract is first violated.
assertions are added to capture abnormal behaviors. we don't need to check abnormal behaviors early and "quick".


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

https://reviews.llvm.org/D67974





More information about the llvm-commits mailing list