[PATCH] D79793: Simplify MachineVerifier's block-successor verification.

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 12 12:21:55 PDT 2020


nickdesaulniers added a comment.

Admittedly, I found this code to be a rats nest.  Thanks for making it slightly neater. LGTM



================
Comment at: llvm/lib/CodeGen/MachineVerifier.cpp:691
+    // analyzeBranch.
+    if (TBB && !MBB->isSuccessor(TBB))
+      report("MBB exits via jump or conditional branch, but its target isn't a "
----------------
arsenm wrote:
> Braces
Why? The body is single statement.


================
Comment at: llvm/lib/CodeGen/MachineVerifier.cpp:708
+    // be a successor, because the block might end in unreachable.)
+    if (Fallthrough && !Cond.empty()) {
+      MachineFunction::const_iterator MBBI = std::next(MBB->getIterator());
----------------
It's weird seeing the `bool && <sub expr that made up the bool>`.  Maybe
```
if (!Cond.empty() && !FBB) {
```
Then you could lower the declaration of `Fallthrough` closer to its use below?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79793





More information about the llvm-commits mailing list