[PATCH] D42391: Verifier: fix bug treating debug info issue as non-debug info issue

Yaxun Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 11:59:14 PST 2018


yaxunl created this revision.
yaxunl added a reviewer: arsenm.
Herald added subscribers: JDevlieghere, aprantl, wdng.

Normally when llvm-as sees only debug info errors in LLVM assembly, it simply drops the debug info and outputs a valid LLVM bitcode and returns 0.

There is a bug in LLVM verifier which incorrectly treats a debug info error as non-debug info error, which causes llvm-as returns 1 even though llvm-as can drop the invalid debug info and outputs a valid LLVM bitcode.

This patch fixes that.


https://reviews.llvm.org/D42391

Files:
  lib/IR/Verifier.cpp
  test/Verifier/llvm.dbg.intrinsic-dbg-attachment.ll


Index: test/Verifier/llvm.dbg.intrinsic-dbg-attachment.ll
===================================================================
--- test/Verifier/llvm.dbg.intrinsic-dbg-attachment.ll
+++ test/Verifier/llvm.dbg.intrinsic-dbg-attachment.ll
@@ -1,4 +1,4 @@
-; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
+; RUN: llvm-as -disable-output <%s 2>&1 | FileCheck %s
 define void @foo() {
 entry:
   call void @llvm.dbg.value(
Index: lib/IR/Verifier.cpp
===================================================================
--- lib/IR/Verifier.cpp
+++ lib/IR/Verifier.cpp
@@ -4491,8 +4491,8 @@
   // The scopes for variables and !dbg attachments must agree.
   DILocalVariable *Var = DII.getVariable();
   DILocation *Loc = DII.getDebugLoc();
-  Assert(Loc, "llvm.dbg." + Kind + " intrinsic requires a !dbg attachment",
-         &DII, BB, F);
+  AssertDI(Loc, "llvm.dbg." + Kind + " intrinsic requires a !dbg attachment",
+           &DII, BB, F);
 
   DISubprogram *VarSP = getSubprogram(Var->getRawScope());
   DISubprogram *LocSP = getSubprogram(Loc->getRawScope());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42391.130941.patch
Type: text/x-patch
Size: 1070 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180122/b01edd80/attachment.bin>


More information about the llvm-commits mailing list