summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/IR/AsmWriter.cpp4
-rw-r--r--llvm/test/Assembler/mdlocation.ll2
2 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 215332b8256..c494d6ce3f0 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1291,8 +1291,8 @@ static void writeMDLocation(raw_ostream &Out, const MDLocation *DL,
const Module *Context) {
Out << "!MDLocation(";
FieldSeparator FS;
- if (DL->getLine())
- Out << FS << "line: " << DL->getLine();
+ // Always output the line, since 0 is a relevant and important value for it.
+ Out << FS << "line: " << DL->getLine();
if (DL->getColumn())
Out << FS << "column: " << DL->getColumn();
Out << FS << "scope: ";
diff --git a/llvm/test/Assembler/mdlocation.ll b/llvm/test/Assembler/mdlocation.ll
index e1216fa2750..c1815ff50e0 100644
--- a/llvm/test/Assembler/mdlocation.ll
+++ b/llvm/test/Assembler/mdlocation.ll
@@ -15,6 +15,6 @@
!3 = !MDLocation(scope: !0, inlinedAt: !1, column: 7, line: 3)
!4 = !MDLocation(column: 7, line: 3, scope: !0, inlinedAt: !1)
-; CHECK-NEXT: !3 = !MDLocation(scope: !0)
+; CHECK-NEXT: !3 = !MDLocation(line: 0, scope: !0)
!5 = !MDLocation(scope: !0)
!6 = !MDLocation(scope: !0, column: 0, line: 0)
OpenPOWER on IntegriCloud