[PATCH] D66444: [BlockExtractor] Avoid assert with wrong line format

Jinsong Ji via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 07:48:06 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL369389: [BlockExtractor] Avoid assert with wrong line format (authored by jsji, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D66444?vs=215995&id=216148#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66444

Files:
  llvm/trunk/lib/Transforms/IPO/BlockExtractor.cpp
  llvm/trunk/test/Transforms/BlockExtractor/invalid-line.ll


Index: llvm/trunk/test/Transforms/BlockExtractor/invalid-line.ll
===================================================================
--- llvm/trunk/test/Transforms/BlockExtractor/invalid-line.ll
+++ llvm/trunk/test/Transforms/BlockExtractor/invalid-line.ll
@@ -0,0 +1,9 @@
+; RUN: echo 'foo' > %t
+; RUN: not opt -S -extract-blocks -extract-blocks-file=%t %s 2>&1 | FileCheck %s
+
+; CHECK: Invalid line
+define void @bar() {
+bb:
+  ret void
+}
+
Index: llvm/trunk/lib/Transforms/IPO/BlockExtractor.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/BlockExtractor.cpp
+++ llvm/trunk/lib/Transforms/IPO/BlockExtractor.cpp
@@ -119,6 +119,8 @@
                /*KeepEmpty=*/false);
     if (LineSplit.empty())
       continue;
+    if (LineSplit.size()!=2)
+      report_fatal_error("Invalid line format, expecting lines like: 'funcname bb1[;bb2..]'");
     SmallVector<StringRef, 4> BBNames;
     LineSplit[1].split(BBNames, ';', /*MaxSplit=*/-1,
                        /*KeepEmpty=*/false);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66444.216148.patch
Type: text/x-patch
Size: 1048 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190820/ece5cb05/attachment.bin>


More information about the llvm-commits mailing list