[PATCH] D46399: Skip unreachable blocks for CFIInstrInserter verify
Petar Jovanovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 4 11:33:43 PDT 2018
petarj updated this revision to Diff 145232.
petarj retitled this revision from "Skip blocks with no predecessors for CFIInstrInserter verify" to "Skip unreachable blocks for CFIInstrInserter verify".
petarj edited the summary of this revision.
petarj added a comment.
Thanks Craig for the test example. The issues were related to unreachable blocks that exist with -O0, this patch now skips all of them and hopefully it will resolve issues you are seeing.
Repository:
rL LLVM
https://reviews.llvm.org/D46399
Files:
lib/CodeGen/CFIInstrInserter.cpp
Index: lib/CodeGen/CFIInstrInserter.cpp
===================================================================
--- lib/CodeGen/CFIInstrInserter.cpp
+++ lib/CodeGen/CFIInstrInserter.cpp
@@ -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,13 @@
unsigned CFIInstrInserter::verify(MachineFunction &MF) {
unsigned ErrorNum = 0;
- for (MachineBasicBlock &CurrMBB : MF) {
- const MBBCFAInfo &CurrMBBInfo = MBBVector[CurrMBB.getNumber()];
- for (MachineBasicBlock *Succ : CurrMBB.successors()) {
+ df_iterator_default_set<MachineBasicBlock*> Reachable;
+
+ for (auto DFI = df_ext_begin(&MF, Reachable),
+ DFE = df_ext_end(&MF, Reachable);
+ DFI != DFE; ++DFI) {
+ const MBBCFAInfo &CurrMBBInfo = MBBVector[DFI->getNumber()];
+ for (MachineBasicBlock *Succ : DFI->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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46399.145232.patch
Type: text/x-patch
Size: 1286 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180504/6d647271/attachment.bin>
More information about the llvm-commits
mailing list