Verifier: fix bug treating debug info issue as non-debug info issue
authorYaxun Liu <Yaxun.Liu@amd.com>
Tue, 23 Jan 2018 16:11:15 +0000 (16:11 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Tue, 23 Jan 2018 16:11:15 +0000 (16:11 +0000)
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.

Differential Revision: https://reviews.llvm.org/D42391

llvm-svn: 323216

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

index b73f9df..4dd5aeb 100644 (file)
@@ -4525,8 +4525,8 @@ void Verifier::visitDbgIntrinsic(StringRef Kind, DbgInfoIntrinsic &DII) {
   // 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());
index c434d44..3f4ce5e 100644 (file)
@@ -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(