[PATCH] D46444: Add option -verify-cfiinstrs to run verifier in CFIInstrInserter

Petar Jovanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 4 11:51:02 PDT 2018


petarj created this revision.
petarj added reviewers: thegameg, violetav.

Instead of enabling it for non NDEBUG builds, use -verify-cfiinstrs to
run verifier in CFIInstrInserter. It defaults to false.


Repository:
  rL LLVM

https://reviews.llvm.org/D46444

Files:
  lib/CodeGen/CFIInstrInserter.cpp


Index: lib/CodeGen/CFIInstrInserter.cpp
===================================================================
--- lib/CodeGen/CFIInstrInserter.cpp
+++ lib/CodeGen/CFIInstrInserter.cpp
@@ -28,6 +28,11 @@
 #include "llvm/Target/TargetMachine.h"
 using namespace llvm;
 
+static cl::opt<bool> VerifyCFI("verify-cfiinstrs",
+    cl::desc("Verify Call Frame Information instructions"),
+    cl::init(false),
+    cl::Hidden);
+
 namespace {
 class CFIInstrInserter : public MachineFunctionPass {
  public:
@@ -49,11 +54,12 @@
 
     MBBVector.resize(MF.getNumBlockIDs());
     calculateCFAInfo(MF);
-#ifndef NDEBUG
-    if (unsigned ErrorNum = verify(MF))
-      report_fatal_error("Found " + Twine(ErrorNum) +
-                         " in/out CFI information errors.");
-#endif
+
+    if (VerifyCFI) {
+      if (unsigned ErrorNum = verify(MF))
+        report_fatal_error("Found " + Twine(ErrorNum) +
+                           " in/out CFI information errors.");
+    }
     bool insertedCFI = insertCFIInstrs(MF);
     MBBVector.clear();
     return insertedCFI;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46444.145244.patch
Type: text/x-patch
Size: 1063 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180504/d21653c4/attachment.bin>


More information about the llvm-commits mailing list