[llvm] r331628 - Skip unreachable blocks for CFIInstrInserter verify

Petar Jovanovic via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 04:47:48 PDT 2018


Author: petarj
Date: Mon May  7 04:47:48 2018
New Revision: 331628

URL: http://llvm.org/viewvc/llvm-project?rev=331628&view=rev
Log:
Skip unreachable blocks for CFIInstrInserter verify

Iterate only through reachable blocks. This finetunes r330706 and
it resolves build issue reported by Craig Topper.

Modified:
    llvm/trunk/lib/CodeGen/CFIInstrInserter.cpp

Modified: llvm/trunk/lib/CodeGen/CFIInstrInserter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CFIInstrInserter.cpp?rev=331628&r1=331627&r2=331628&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CFIInstrInserter.cpp (original)
+++ llvm/trunk/lib/CodeGen/CFIInstrInserter.cpp Mon May  7 04:47:48 2018
@@ -18,6 +18,7 @@
 /// blocks in a function.
 //===----------------------------------------------------------------------===//
 
+#include "llvm/ADT/DepthFirstIterator.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 #include "llvm/CodeGen/MachineInstrBuilder.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
@@ -291,9 +292,9 @@ void CFIInstrInserter::report(const MBBC
 
 unsigned CFIInstrInserter::verify(MachineFunction &MF) {
   unsigned ErrorNum = 0;
-  for (MachineBasicBlock &CurrMBB : MF) {
-    const MBBCFAInfo &CurrMBBInfo = MBBVector[CurrMBB.getNumber()];
-    for (MachineBasicBlock *Succ : CurrMBB.successors()) {
+  for (auto *CurrMBB : depth_first(&MF)) {
+    const MBBCFAInfo &CurrMBBInfo = MBBVector[CurrMBB->getNumber()];
+    for (MachineBasicBlock *Succ : CurrMBB->successors()) {
       const MBBCFAInfo &SuccMBBInfo = MBBVector[Succ->getNumber()];
       // Check that incoming offset and register values of successors match the
       // outgoing offset and register values of CurrMBB




More information about the llvm-commits mailing list