r214162 - Emit column debug information for loads

Tobias Grosser tobias at grosser.es
Mon Jul 28 23:10:48 PDT 2014


Author: grosser
Date: Tue Jul 29 01:10:47 2014
New Revision: 214162

URL: http://llvm.org/viewvc/llvm-project?rev=214162&view=rev
Log:
Emit column debug information for loads

This allows us to give more precise diagnostics.

Diego kindly tested the impact on debug info size: "The increase on average
debug sizes is 0.1%. The total file size increase is ~0%."

Added:
    cfe/trunk/test/CodeGen/debug-info-column.c
Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/test/CodeGen/linetable-endscope.c
    cfe/trunk/test/CodeGenCXX/PR20038.cpp
    cfe/trunk/test/CodeGenObjC/arc-linetable.m

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=214162&r1=214161&r2=214162&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue Jul 29 01:10:47 2014
@@ -1258,6 +1258,9 @@ void CodeGenFunction::EmitStoreOfScalar(
 /// method emits the address of the lvalue, then loads the result as an rvalue,
 /// returning the rvalue.
 RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, SourceLocation Loc) {
+  if (CGDebugInfo *DI = getDebugInfo())
+    DI->EmitLocation(Builder, Loc, true);
+
   if (LV.isObjCWeak()) {
     // load of a __weak object.
     llvm::Value *AddrWeakObj = LV.getAddress();

Added: cfe/trunk/test/CodeGen/debug-info-column.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-column.c?rev=214162&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-column.c (added)
+++ cfe/trunk/test/CodeGen/debug-info-column.c Tue Jul 29 01:10:47 2014
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -emit-llvm -o - -g %s | FileCheck %s
+void foo(float A[100], float B[100]) {
+  B[12] = A[10] + A[20] + A[30];
+}
+// CHECK-LABEL: foo
+// CHECK: load float* %arrayidx{{.*}}, !dbg [[LOC0:.*]]
+// CHECK: load float* %arrayidx{{.*}}, !dbg [[LOC1:.*]]
+// CHECK: load float* %arrayidx{{.*}}, !dbg [[LOC2:.*]]
+// CHECK: store float {{.*}} float* %arrayidx{{.*}}, !dbg [[LOC3:.*]]
+// CHECK-DAG: [[LOC0]] = metadata !{i32 3, i32 11, metadata {{.*}}, null}
+// CHECK-DAG: [[LOC1]] = metadata !{i32 3, i32 19, metadata {{.*}}, null}
+// CHECK-DAG: [[LOC2]] = metadata !{i32 3, i32 27, metadata {{.*}}, null}
+// CHECK-DAG: [[LOC3]] = metadata !{i32 3, i32 3, metadata {{.*}}, null}

Modified: cfe/trunk/test/CodeGen/linetable-endscope.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/linetable-endscope.c?rev=214162&r1=214161&r2=214162&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/linetable-endscope.c (original)
+++ cfe/trunk/test/CodeGen/linetable-endscope.c Tue Jul 29 01:10:47 2014
@@ -11,7 +11,7 @@
 void foo(char c)
 {
   int i;
-  // CHECK: ![[CONV]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
+  // CHECK: ![[CONV]] = metadata !{i32 [[@LINE+1]], i32 7, metadata !{{.*}}, null}
   i = c;
   // CHECK: ![[RET]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
 }

Modified: cfe/trunk/test/CodeGenCXX/PR20038.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/PR20038.cpp?rev=214162&r1=214161&r2=214162&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/PR20038.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/PR20038.cpp Tue Jul 29 01:10:47 2014
@@ -11,6 +11,6 @@ extern bool b;
 // CHECK: [[DTOR_CALL1_LOC]] = metadata !{i32 [[@LINE+2]], i32 0, metadata [[FUN1_BLOCK:.*]], null}
 // CHECK: [[FUN1_BLOCK]] = metadata !{{{[^,]*}}, {{[^,]*}}, metadata [[FUN1]],
 void fun1() { b && (C(), 1); }
-// CHECK: [[DTOR_CALL2_LOC]] = metadata !{i32 [[@LINE+2]], i32 0, metadata [[FUN2_BLOCK1:.*]], null}
+// CHECK: [[DTOR_CALL2_LOC]] = metadata !{i32 [[@LINE+2]], i32 28, metadata [[FUN2_BLOCK1:.*]], null}
 // CHECK: [[FUN2_BLOCK1]] = metadata !{{{[^,]*}}, {{[^,]*}}, metadata [[FUN2]],
 bool fun2() { return (C(), b) && 0; }

Modified: cfe/trunk/test/CodeGenObjC/arc-linetable.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-linetable.m?rev=214162&r1=214161&r2=214162&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/arc-linetable.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc-linetable.m Tue Jul 29 01:10:47 2014
@@ -76,7 +76,7 @@ typedef signed char BOOL;
 - (int)testMultiline:(NSString *)foo {
   // CHECK: ![[MSG4]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
   int r = [self testSideEffect :foo];
-  // CHECK: ![[EXP4]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
+  // CHECK: ![[EXP4]] = metadata !{i32 [[@LINE+1]], i32 10, metadata !{{.*}}, null}
   return r;
   // CHECK: ![[RET4]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
 }
@@ -94,7 +94,7 @@ typedef signed char BOOL;
 }
 
 - (int)testNoCleanupSideEffect {
-  // CHECK: ![[MSG7]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
+  // CHECK: ![[MSG7]] = metadata !{i32 [[@LINE+1]], i32 4, metadata !{{.*}}, null}
   [self testVoid :@"foo"];
   // CHECK: ![[RET7]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
   return 1;
@@ -102,7 +102,7 @@ typedef signed char BOOL;
 
 - (void)testCleanupVoid:(BOOL)skip withDelegate: (AppDelegate *) delegate {
   static BOOL skip_all;
-  // CHECK: ![[SKIP1]] = metadata !{i32 [[@LINE+1]], i32 0,
+  // CHECK: ![[SKIP1]] = metadata !{i32 [[@LINE+1]], i32 8,
   if (!skip_all) {
     if (!skip) {
       return;





More information about the cfe-commits mailing list