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%."

llvm-svn: 214162
This commit is contained in:
Tobias Grosser 2014-07-29 06:10:47 +00:00
parent d8a5273993
commit 01b923d55b
5 changed files with 21 additions and 5 deletions

View File

@ -1258,6 +1258,9 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *value, LValue lvalue,
/// 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();

View File

@ -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}

View File

@ -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}
}

View File

@ -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; }

View File

@ -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;