[PATCH] D47720: [DebugInfo] Inline for without DebugLocation
This revision was automatically updated to reflect the committed changes. Closed by commit rL335255: [DebugInfo] Inline for without DebugLocation (authored by gramanas, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D47720 Files: cfe/trunk/lib/CodeGen/CGExprScalar.cpp cfe/trunk/test/CodeGen/debug-info-inline-for.c Index: cfe/trunk/lib/CodeGen/CGExprScalar.cpp === --- cfe/trunk/lib/CodeGen/CGExprScalar.cpp +++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp @@ -3431,6 +3431,12 @@ // Insert an entry into the phi node for the edge with the value of RHSCond. PN->addIncoming(RHSCond, RHSBlock); + // Artificial location to preserve the scope information + { +auto NL = ApplyDebugLocation::CreateArtificial(CGF); +PN->setDebugLoc(Builder.getCurrentDebugLocation()); + } + // ZExt result to int. return Builder.CreateZExtOrBitCast(PN, ResTy, "land.ext"); } Index: cfe/trunk/test/CodeGen/debug-info-inline-for.c === --- cfe/trunk/test/CodeGen/debug-info-inline-for.c +++ cfe/trunk/test/CodeGen/debug-info-inline-for.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s +// Check that clang emits Debug location in the phi instruction + +int func(int n) { + int a; + for(a = 10; a>0 && n++; a--); + return n; +} + +// CHECK: land.end: +// CHECK-NEXT: {{.*}} = phi i1 {{.*}} !dbg ![[DbgLoc:[0-9]+]] + +// CHECK: ![[DbgLoc]] = !DILocation(line: 0 Index: cfe/trunk/lib/CodeGen/CGExprScalar.cpp === --- cfe/trunk/lib/CodeGen/CGExprScalar.cpp +++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp @@ -3431,6 +3431,12 @@ // Insert an entry into the phi node for the edge with the value of RHSCond. PN->addIncoming(RHSCond, RHSBlock); + // Artificial location to preserve the scope information + { +auto NL = ApplyDebugLocation::CreateArtificial(CGF); +PN->setDebugLoc(Builder.getCurrentDebugLocation()); + } + // ZExt result to int. return Builder.CreateZExtOrBitCast(PN, ResTy, "land.ext"); } Index: cfe/trunk/test/CodeGen/debug-info-inline-for.c === --- cfe/trunk/test/CodeGen/debug-info-inline-for.c +++ cfe/trunk/test/CodeGen/debug-info-inline-for.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s +// Check that clang emits Debug location in the phi instruction + +int func(int n) { + int a; + for(a = 10; a>0 && n++; a--); + return n; +} + +// CHECK: land.end: +// CHECK-NEXT: {{.*}} = phi i1 {{.*}} !dbg ![[DbgLoc:[0-9]+]] + +// CHECK: ![[DbgLoc]] = !DILocation(line: 0 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47720: [DebugInfo] Inline for without DebugLocation
gramanas added a comment. ping! should I commit this? Repository: rC Clang https://reviews.llvm.org/D47720 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47097: [DebugInfo] Preserve scope in auto generated StoreInst
gramanas updated this revision to Diff 150357. gramanas added a comment. Make more elaborate comment. Repository: rC Clang https://reviews.llvm.org/D47097 Files: lib/CodeGen/CGDecl.cpp test/CodeGen/debug-info-preserve-scope.c Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +// RUN: %clang_cc1 -O1 -debug-info-kind=limited -emit-llvm -mllvm \ +// RUN: -opt-bisect-limit=2 -o - %s 2> /dev/null | FileCheck %s \ +// RUN: --check-prefix PHI + +extern int map[]; +// PHI-LABEL: define void @test1 +void test1(int a, int n) { + for (int i = 0; i < n; ++i) +a = map[a]; +} + +// PHI: for.cond: +// PHI-NEXT: {{.*}} = phi i32 {{.*}} !dbg ![[test1DbgLoc:[0-9]+]] + +// PHI: ![[test1DbgLoc]] = !DILocation(line: 0 + + +static int i; +// CHECK-LABEL: define void @test2 +void test2(int b) { + i = b; +} + +// CHECK: store i32 {{.*}} !dbg ![[test2DbgLoc:[0-9]+]] + +// CHECK: ![[test2DbgLoc]] = !DILocation(line: 0 + Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1946,6 +1946,10 @@ } } + // Set artificial debug location to preserve the scope. This is later + // used by mem2reg to assign DL at the phi's it generates. + auto DL = ApplyDebugLocation::CreateArtificial(*this); + Address DeclPtr = Address::invalid(); bool DoStore = false; bool IsScalar = hasScalarEvaluationKind(Ty); Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +// RUN: %clang_cc1 -O1 -debug-info-kind=limited -emit-llvm -mllvm \ +// RUN: -opt-bisect-limit=2 -o - %s 2> /dev/null | FileCheck %s \ +// RUN: --check-prefix PHI + +extern int map[]; +// PHI-LABEL: define void @test1 +void test1(int a, int n) { + for (int i = 0; i < n; ++i) +a = map[a]; +} + +// PHI: for.cond: +// PHI-NEXT: {{.*}} = phi i32 {{.*}} !dbg ![[test1DbgLoc:[0-9]+]] + +// PHI: ![[test1DbgLoc]] = !DILocation(line: 0 + + +static int i; +// CHECK-LABEL: define void @test2 +void test2(int b) { + i = b; +} + +// CHECK: store i32 {{.*}} !dbg ![[test2DbgLoc:[0-9]+]] + +// CHECK: ![[test2DbgLoc]] = !DILocation(line: 0 + Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1946,6 +1946,10 @@ } } + // Set artificial debug location to preserve the scope. This is later + // used by mem2reg to assign DL at the phi's it generates. + auto DL = ApplyDebugLocation::CreateArtificial(*this); + Address DeclPtr = Address::invalid(); bool DoStore = false; bool IsScalar = hasScalarEvaluationKind(Ty); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47720: [DebugInfo] Inline for without DebugLocation
gramanas updated this revision to Diff 150135. gramanas added a comment. make code more readable Repository: rC Clang https://reviews.llvm.org/D47720 Files: lib/CodeGen/CGExprScalar.cpp test/CodeGen/debug-info-inline-for.c Index: test/CodeGen/debug-info-inline-for.c === --- /dev/null +++ test/CodeGen/debug-info-inline-for.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s +// Check that clang emits Debug location in the phi instruction + +int func(int n) { + int a; + for(a = 10; a>0 && n++; a--); + return n; +} + +// CHECK: land.end: +// CHECK-NEXT: {{.*}} = phi i1 {{.*}} !dbg ![[DbgLoc:[0-9]+]] + +// CHECK: ![[DbgLoc]] = !DILocation(line: 0 Index: lib/CodeGen/CGExprScalar.cpp === --- lib/CodeGen/CGExprScalar.cpp +++ lib/CodeGen/CGExprScalar.cpp @@ -3428,6 +3428,12 @@ // Insert an entry into the phi node for the edge with the value of RHSCond. PN->addIncoming(RHSCond, RHSBlock); + // Artificial location to preserve the scope information + { +auto NL = ApplyDebugLocation::CreateArtificial(CGF); +PN->setDebugLoc(Builder.getCurrentDebugLocation()); + } + // ZExt result to int. return Builder.CreateZExtOrBitCast(PN, ResTy, "land.ext"); } Index: test/CodeGen/debug-info-inline-for.c === --- /dev/null +++ test/CodeGen/debug-info-inline-for.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s +// Check that clang emits Debug location in the phi instruction + +int func(int n) { + int a; + for(a = 10; a>0 && n++; a--); + return n; +} + +// CHECK: land.end: +// CHECK-NEXT: {{.*}} = phi i1 {{.*}} !dbg ![[DbgLoc:[0-9]+]] + +// CHECK: ![[DbgLoc]] = !DILocation(line: 0 Index: lib/CodeGen/CGExprScalar.cpp === --- lib/CodeGen/CGExprScalar.cpp +++ lib/CodeGen/CGExprScalar.cpp @@ -3428,6 +3428,12 @@ // Insert an entry into the phi node for the edge with the value of RHSCond. PN->addIncoming(RHSCond, RHSBlock); + // Artificial location to preserve the scope information + { +auto NL = ApplyDebugLocation::CreateArtificial(CGF); +PN->setDebugLoc(Builder.getCurrentDebugLocation()); + } + // ZExt result to int. return Builder.CreateZExtOrBitCast(PN, ResTy, "land.ext"); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47097: [DebugInfo] Preserve scope in auto generated StoreInst
gramanas added a comment. What about this? Ping! Repository: rC Clang https://reviews.llvm.org/D47097 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47720: [DebugInfo] Inline for without DebugLocation
gramanas added inline comments. Comment at: test/CodeGen/debug-info-inline-for.c:13 + +// CHECK: ![[DbgLoc]] = !DILocation( aprantl wrote: > Shouldn't you also check *which* location is attached to it? I wasn't sure if this should be an artificial location or not so I left it like that for the time being. It's been updated to reflect the latest changes now. Repository: rC Clang https://reviews.llvm.org/D47720 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47720: [DebugInfo] Inline for without DebugLocation
gramanas updated this revision to Diff 150036. gramanas marked an inline comment as done. gramanas added a comment. Add artificial debug location to the phi instruction Repository: rC Clang https://reviews.llvm.org/D47720 Files: lib/CodeGen/CGExprScalar.cpp test/CodeGen/debug-info-inline-for.c Index: test/CodeGen/debug-info-inline-for.c === --- /dev/null +++ test/CodeGen/debug-info-inline-for.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s +// Check that clang emits Debug location in the phi instruction + +int func(int n) { + int a; + for(a = 10; a>0 && n++; a--); + return n; +} + +// CHECK: land.end: +// CHECK-NEXT: {{.*}} = phi i1 {{.*}} !dbg ![[DbgLoc:[0-9]+]] + +// CHECK: ![[DbgLoc]] = !DILocation(line: 0 Index: lib/CodeGen/CGExprScalar.cpp === --- lib/CodeGen/CGExprScalar.cpp +++ lib/CodeGen/CGExprScalar.cpp @@ -3427,6 +3427,11 @@ } // Insert an entry into the phi node for the edge with the value of RHSCond. PN->addIncoming(RHSCond, RHSBlock); + { +// Artificial location to preserve the scope information +auto NL = ApplyDebugLocation::CreateArtificial(CGF); +PN->setDebugLoc(Builder.getCurrentDebugLocation()); + } // ZExt result to int. return Builder.CreateZExtOrBitCast(PN, ResTy, "land.ext"); Index: test/CodeGen/debug-info-inline-for.c === --- /dev/null +++ test/CodeGen/debug-info-inline-for.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s +// Check that clang emits Debug location in the phi instruction + +int func(int n) { + int a; + for(a = 10; a>0 && n++; a--); + return n; +} + +// CHECK: land.end: +// CHECK-NEXT: {{.*}} = phi i1 {{.*}} !dbg ![[DbgLoc:[0-9]+]] + +// CHECK: ![[DbgLoc]] = !DILocation(line: 0 Index: lib/CodeGen/CGExprScalar.cpp === --- lib/CodeGen/CGExprScalar.cpp +++ lib/CodeGen/CGExprScalar.cpp @@ -3427,6 +3427,11 @@ } // Insert an entry into the phi node for the edge with the value of RHSCond. PN->addIncoming(RHSCond, RHSBlock); + { +// Artificial location to preserve the scope information +auto NL = ApplyDebugLocation::CreateArtificial(CGF); +PN->setDebugLoc(Builder.getCurrentDebugLocation()); + } // ZExt result to int. return Builder.CreateZExtOrBitCast(PN, ResTy, "land.ext"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47720: [DebugInfo] Inline for without DebugLocation
gramanas updated this revision to Diff 149996. gramanas added a comment. Add comment explaining the test Repository: rC Clang https://reviews.llvm.org/D47720 Files: test/CodeGen/debug-info-inline-for.c Index: test/CodeGen/debug-info-inline-for.c === --- /dev/null +++ test/CodeGen/debug-info-inline-for.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s +// Check that clang emits Debug location in the phi instruction + +int func(int n) { + int a; + for(a = 10; a>0 && n++; a--); + return n; +} + +// CHECK: land.end: +// CHECK-NEXT: {{.*}} = phi i1 {{.*}} !dbg ![[DbgLoc:[0-9]+]] + +// CHECK: ![[DbgLoc]] = !DILocation( Index: test/CodeGen/debug-info-inline-for.c === --- /dev/null +++ test/CodeGen/debug-info-inline-for.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s +// Check that clang emits Debug location in the phi instruction + +int func(int n) { + int a; + for(a = 10; a>0 && n++; a--); + return n; +} + +// CHECK: land.end: +// CHECK-NEXT: {{.*}} = phi i1 {{.*}} !dbg ![[DbgLoc:[0-9]+]] + +// CHECK: ![[DbgLoc]] = !DILocation( ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47720: [DebugInfo] Inline for without DebugLocation
gramanas created this revision. gramanas added a reviewer: vsk. Herald added subscribers: cfe-commits, JDevlieghere, eraman, aprantl. This test is a strip down version of a function inside the amalgamated sqlite source. When converted to IR clang produces a phi instruction without debug location. It is a continuation of https://reviews.llvm.org/D47097 focusing on a different problem of similar structure. This was found while investigating instructions with missing DebugLoc after running SROA on the amalgamated sqlite source, in an attempt to try and preserve as much debug information as possible during the early stage passes. Repository: rC Clang https://reviews.llvm.org/D47720 Files: test/CodeGen/debug-info-inline-for.c Index: test/CodeGen/debug-info-inline-for.c === --- /dev/null +++ test/CodeGen/debug-info-inline-for.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +int func(int n) { + int a; + for(a = 10; a>0 && n++; a--); + return n; +} + +// CHECK: land.end: +// CHECK-NEXT: {{.*}} = phi i1 {{.*}} !dbg ![[DbgLoc:[0-9]+]] + +// CHECK: ![[DbgLoc]] = !DILocation( Index: test/CodeGen/debug-info-inline-for.c === --- /dev/null +++ test/CodeGen/debug-info-inline-for.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +int func(int n) { + int a; + for(a = 10; a>0 && n++; a--); + return n; +} + +// CHECK: land.end: +// CHECK-NEXT: {{.*}} = phi i1 {{.*}} !dbg ![[DbgLoc:[0-9]+]] + +// CHECK: ![[DbgLoc]] = !DILocation( ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47097: [DebugInfo] Preserve scope in auto generated StoreInst
gramanas updated this revision to Diff 148588. gramanas added a comment. I added a test that illustrates what @vsk is talking about. Sorry for not providing the relevant information but I thought this would be a simple one liner like https://reviews.llvm.org/rL327800. I will update the revision's description to include everything I know about this. Repository: rC Clang https://reviews.llvm.org/D47097 Files: lib/CodeGen/CGDecl.cpp test/CodeGen/debug-info-preserve-scope.c Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +// RUN: %clang_cc1 -O1 -debug-info-kind=limited -emit-llvm -mllvm \ +// RUN: -opt-bisect-limit=2 -o - %s 2> /dev/null | FileCheck %s \ +// RUN: --check-prefix PHI + +extern int map[]; +// PHI-LABEL: define void @test1 +void test1(int a, int n) { + for (int i = 0; i < n; ++i) +a = map[a]; +} + +// PHI: for.cond: +// PHI-NEXT: {{.*}} = phi i32 {{.*}} !dbg ![[test1DbgLoc:[0-9]+]] + +// PHI: ![[test1DbgLoc]] = !DILocation(line: 0 + + +static int i; +// CHECK-LABEL: define void @test2 +void test2(int b) { + i = b; +} + +// CHECK: store i32 {{.*}} !dbg ![[test2DbgLoc:[0-9]+]] + +// CHECK: ![[test2DbgLoc]] = !DILocation(line: 0 + Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1946,6 +1946,9 @@ } } + // Set artificial debug location in order to preserve the scope + auto DL = ApplyDebugLocation::CreateArtificial(*this); + Address DeclPtr = Address::invalid(); bool DoStore = false; bool IsScalar = hasScalarEvaluationKind(Ty); Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +// RUN: %clang_cc1 -O1 -debug-info-kind=limited -emit-llvm -mllvm \ +// RUN: -opt-bisect-limit=2 -o - %s 2> /dev/null | FileCheck %s \ +// RUN: --check-prefix PHI + +extern int map[]; +// PHI-LABEL: define void @test1 +void test1(int a, int n) { + for (int i = 0; i < n; ++i) +a = map[a]; +} + +// PHI: for.cond: +// PHI-NEXT: {{.*}} = phi i32 {{.*}} !dbg ![[test1DbgLoc:[0-9]+]] + +// PHI: ![[test1DbgLoc]] = !DILocation(line: 0 + + +static int i; +// CHECK-LABEL: define void @test2 +void test2(int b) { + i = b; +} + +// CHECK: store i32 {{.*}} !dbg ![[test2DbgLoc:[0-9]+]] + +// CHECK: ![[test2DbgLoc]] = !DILocation(line: 0 + Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1946,6 +1946,9 @@ } } + // Set artificial debug location in order to preserve the scope + auto DL = ApplyDebugLocation::CreateArtificial(*this); + Address DeclPtr = Address::invalid(); bool DoStore = false; bool IsScalar = hasScalarEvaluationKind(Ty); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47097: [DebugInfo] Preserve scope in auto generated StoreInst
gramanas added a comment. In https://reviews.llvm.org/D47097#149, @probinson wrote: > Can we step back a second and better explain what the problem is? With > current Clang the debug info for this function looks okay to me. > The store that is "missing" a debug location is homing the formal parameter > to its local stack location; this is part of prolog setup, not "real" code. Isn't this the reason the artificial debug loc exists? The store in the prolog might not be real code but it should still have the scope that the rest of the function has. Repository: rC Clang https://reviews.llvm.org/D47097 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47097: [DebugInfo] Preserve scope in auto generated StoreInst
gramanas updated this revision to Diff 148414. gramanas added a comment. Adress review comments. Limit changes to the storeInst Repository: rC Clang https://reviews.llvm.org/D47097 Files: lib/CodeGen/CGDecl.cpp test/CodeGen/debug-info-preserve-scope.c Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: store i32 {{.*}} !dbg ![[artificialDbgLoc:[0-9]+]] + +// CHECK: ![[artificialDbgLoc]] = !DILocation(line: 0 Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1946,6 +1946,9 @@ } } + // Set artificial debug location in order to preserve the scope + auto DL = ApplyDebugLocation::CreateArtificial(*this); + Address DeclPtr = Address::invalid(); bool DoStore = false; bool IsScalar = hasScalarEvaluationKind(Ty); Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: store i32 {{.*}} !dbg ![[artificialDbgLoc:[0-9]+]] + +// CHECK: ![[artificialDbgLoc]] = !DILocation(line: 0 Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1946,6 +1946,9 @@ } } + // Set artificial debug location in order to preserve the scope + auto DL = ApplyDebugLocation::CreateArtificial(*this); + Address DeclPtr = Address::invalid(); bool DoStore = false; bool IsScalar = hasScalarEvaluationKind(Ty); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47097: [DebugInfo] Preserve scope in auto generated StoreInst
gramanas updated this revision to Diff 148200. gramanas marked an inline comment as done. gramanas added a comment. Remove redundant `this` Repository: rC Clang https://reviews.llvm.org/D47097 Files: lib/CodeGen/CGDecl.cpp lib/CodeGen/CGExpr.cpp test/CodeGen/debug-info-preserve-scope.c Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + + +// CHECK: [[B:%.*]] = alloca i32 {{.*}} !dbg ![[artificialDbgLoc:[0-9]+]] +// CHECK: store i32 {{.*}} !dbg ![[artificialDbgLoc]] + +// CHECK: ![[artificialDbgLoc]] = !DILocation(line: 0 Index: lib/CodeGen/CGExpr.cpp === --- lib/CodeGen/CGExpr.cpp +++ lib/CodeGen/CGExpr.cpp @@ -68,6 +68,8 @@ bool CastToDefaultAddrSpace) { auto Alloca = CreateTempAlloca(Ty, Name, ArraySize); Alloca->setAlignment(Align.getQuantity()); + // Set debug location in order to preserve the scope + Alloca->setDebugLoc(Builder.getCurrentDebugLocation()); if (AllocaAddr) *AllocaAddr = Address(Alloca, Align); llvm::Value *V = Alloca; Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1946,6 +1946,9 @@ } } + // Set artificial debug location in order to preserve the scope + auto DL = ApplyDebugLocation::CreateArtificial(*this); + Address DeclPtr = Address::invalid(); bool DoStore = false; bool IsScalar = hasScalarEvaluationKind(Ty); @@ -2071,7 +2074,7 @@ // Store the initial value into the alloca. if (DoStore) -EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); + EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); setAddrOfLocalVar(&D, DeclPtr); Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + + +// CHECK: [[B:%.*]] = alloca i32 {{.*}} !dbg ![[artificialDbgLoc:[0-9]+]] +// CHECK: store i32 {{.*}} !dbg ![[artificialDbgLoc]] + +// CHECK: ![[artificialDbgLoc]] = !DILocation(line: 0 Index: lib/CodeGen/CGExpr.cpp === --- lib/CodeGen/CGExpr.cpp +++ lib/CodeGen/CGExpr.cpp @@ -68,6 +68,8 @@ bool CastToDefaultAddrSpace) { auto Alloca = CreateTempAlloca(Ty, Name, ArraySize); Alloca->setAlignment(Align.getQuantity()); + // Set debug location in order to preserve the scope + Alloca->setDebugLoc(Builder.getCurrentDebugLocation()); if (AllocaAddr) *AllocaAddr = Address(Alloca, Align); llvm::Value *V = Alloca; Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1946,6 +1946,9 @@ } } + // Set artificial debug location in order to preserve the scope + auto DL = ApplyDebugLocation::CreateArtificial(*this); + Address DeclPtr = Address::invalid(); bool DoStore = false; bool IsScalar = hasScalarEvaluationKind(Ty); @@ -2071,7 +2074,7 @@ // Store the initial value into the alloca. if (DoStore) -EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); + EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); setAddrOfLocalVar(&D, DeclPtr); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47097: [DebugInfo] Preserve scope in auto generated StoreInst
gramanas updated this revision to Diff 148198. gramanas added a comment. Set debug location to the entry block alloca Repository: rC Clang https://reviews.llvm.org/D47097 Files: lib/CodeGen/CGDecl.cpp lib/CodeGen/CGExpr.cpp test/CodeGen/debug-info-preserve-scope.c Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + + +// CHECK: [[B:%.*]] = alloca i32 {{.*}} !dbg ![[artificialDbgLoc:[0-9]+]] +// CHECK: store i32 {{.*}} !dbg ![[artificialDbgLoc]] + +// CHECK: ![[artificialDbgLoc]] = !DILocation(line: 0 Index: lib/CodeGen/CGExpr.cpp === --- lib/CodeGen/CGExpr.cpp +++ lib/CodeGen/CGExpr.cpp @@ -68,6 +68,8 @@ bool CastToDefaultAddrSpace) { auto Alloca = CreateTempAlloca(Ty, Name, ArraySize); Alloca->setAlignment(Align.getQuantity()); + // Set debug location in order to preserve the scope + Alloca->setDebugLoc(this->Builder.getCurrentDebugLocation()); if (AllocaAddr) *AllocaAddr = Address(Alloca, Align); llvm::Value *V = Alloca; Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1946,6 +1946,9 @@ } } + // Set artificial debug location in order to preserve the scope + auto DL = ApplyDebugLocation::CreateArtificial(*this); + Address DeclPtr = Address::invalid(); bool DoStore = false; bool IsScalar = hasScalarEvaluationKind(Ty); @@ -2071,7 +2074,7 @@ // Store the initial value into the alloca. if (DoStore) -EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); + EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); setAddrOfLocalVar(&D, DeclPtr); Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + + +// CHECK: [[B:%.*]] = alloca i32 {{.*}} !dbg ![[artificialDbgLoc:[0-9]+]] +// CHECK: store i32 {{.*}} !dbg ![[artificialDbgLoc]] + +// CHECK: ![[artificialDbgLoc]] = !DILocation(line: 0 Index: lib/CodeGen/CGExpr.cpp === --- lib/CodeGen/CGExpr.cpp +++ lib/CodeGen/CGExpr.cpp @@ -68,6 +68,8 @@ bool CastToDefaultAddrSpace) { auto Alloca = CreateTempAlloca(Ty, Name, ArraySize); Alloca->setAlignment(Align.getQuantity()); + // Set debug location in order to preserve the scope + Alloca->setDebugLoc(this->Builder.getCurrentDebugLocation()); if (AllocaAddr) *AllocaAddr = Address(Alloca, Align); llvm::Value *V = Alloca; Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1946,6 +1946,9 @@ } } + // Set artificial debug location in order to preserve the scope + auto DL = ApplyDebugLocation::CreateArtificial(*this); + Address DeclPtr = Address::invalid(); bool DoStore = false; bool IsScalar = hasScalarEvaluationKind(Ty); @@ -2071,7 +2074,7 @@ // Store the initial value into the alloca. if (DoStore) -EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); + EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); setAddrOfLocalVar(&D, DeclPtr); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47161: update
gramanas added a comment. It was a mistake on my part with the arcanist tool. The documentation is fine, the only problems I encountered were due to my ignorance of how these systems work. Repository: rC Clang https://reviews.llvm.org/D47161 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47097: [DebugInfo] Preserve scope in auto generated StoreInst
gramanas updated this revision to Diff 148034. gramanas added a comment. Move ApplyDebugLocation before CreateMemTemp Repository: rC Clang https://reviews.llvm.org/D47097 Files: lib/CodeGen/CGDecl.cpp test/CodeGen/debug-info-preserve-scope.c Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: alloca i32 {{.*}} !dbg ![[dbgLocForStore:[0-9]+]] +// CHECK: store i32 {{.*}} !dbg ![[dbgLocForStore:[0-9]+]] + +// CHECK: ![[dbgLocForStore]] = !DILocation(line: 0 Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1946,6 +1946,9 @@ } } + // Set artificial debug location in order to preserve the scope + auto DL = ApplyDebugLocation::CreateArtificial(*this); + Address DeclPtr = Address::invalid(); bool DoStore = false; bool IsScalar = hasScalarEvaluationKind(Ty); @@ -2071,7 +2074,7 @@ // Store the initial value into the alloca. if (DoStore) -EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); + EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); setAddrOfLocalVar(&D, DeclPtr); Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: alloca i32 {{.*}} !dbg ![[dbgLocForStore:[0-9]+]] +// CHECK: store i32 {{.*}} !dbg ![[dbgLocForStore:[0-9]+]] + +// CHECK: ![[dbgLocForStore]] = !DILocation(line: 0 Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1946,6 +1946,9 @@ } } + // Set artificial debug location in order to preserve the scope + auto DL = ApplyDebugLocation::CreateArtificial(*this); + Address DeclPtr = Address::invalid(); bool DoStore = false; bool IsScalar = hasScalarEvaluationKind(Ty); @@ -2071,7 +2074,7 @@ // Store the initial value into the alloca. if (DoStore) -EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); + EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); setAddrOfLocalVar(&D, DeclPtr); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47161: update
gramanas abandoned this revision. gramanas added a comment. Duplicate of https://reviews.llvm.org/D47097 Repository: rC Clang https://reviews.llvm.org/D47161 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47097: [DebugInfo] Preserve scope in auto generated StoreInst
gramanas updated this revision to Diff 147876. gramanas added a comment. Update diff Repository: rC Clang https://reviews.llvm.org/D47097 Files: lib/CodeGen/CGDecl.cpp test/CodeGen/debug-info-preserve-scope.c Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: store i32 %b, i32* %b.addr, align 4, !dbg ![[dbgLocForStore:[0-9]+]] + +// CHECK: ![[dbgLocForStore]] = !DILocation(line: 0 Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -2070,8 +2070,10 @@ } // Store the initial value into the alloca. - if (DoStore) -EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); + if (DoStore) { + auto DL = ApplyDebugLocation::CreateArtificial(*this); + EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); + } setAddrOfLocalVar(&D, DeclPtr); Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: store i32 %b, i32* %b.addr, align 4, !dbg ![[dbgLocForStore:[0-9]+]] + +// CHECK: ![[dbgLocForStore]] = !DILocation(line: 0 Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -2070,8 +2070,10 @@ } // Store the initial value into the alloca. - if (DoStore) -EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); + if (DoStore) { + auto DL = ApplyDebugLocation::CreateArtificial(*this); + EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); + } setAddrOfLocalVar(&D, DeclPtr); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47161: update
gramanas created this revision. Herald added a subscriber: cfe-commits. Repository: rC Clang https://reviews.llvm.org/D47161 Files: lib/CodeGen/CGDecl.cpp test/CodeGen/debug-info-preserve-scope.c Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: store i32 %b, i32* %b.addr, align 4, !dbg ![[dbgLocForStore:[0-9]+]] + +// CHECK: ![[dbgLocForStore]] = !DILocation(line: 0 Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -2070,8 +2070,10 @@ } // Store the initial value into the alloca. - if (DoStore) -EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); + if (DoStore) { + auto DL = ApplyDebugLocation::CreateArtificial(*this); + EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); + } setAddrOfLocalVar(&D, DeclPtr); Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: store i32 %b, i32* %b.addr, align 4, !dbg ![[dbgLocForStore:[0-9]+]] + +// CHECK: ![[dbgLocForStore]] = !DILocation(line: 0 Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -2070,8 +2070,10 @@ } // Store the initial value into the alloca. - if (DoStore) -EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); + if (DoStore) { + auto DL = ApplyDebugLocation::CreateArtificial(*this); + EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); + } setAddrOfLocalVar(&D, DeclPtr); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47097: [WIP][DebugInfo] Preserve scope in auto generated StoreInst
gramanas updated this revision to Diff 147840. gramanas marked an inline comment as done. gramanas added a comment. Update according to the comments Repository: rC Clang https://reviews.llvm.org/D47097 Files: lib/CodeGen/CGDecl.cpp test/CodeGen/debug-info-preserve-scope.c Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: store i32 %b, i32* %b.addr, align 4, !dbg ![[dbgLocForStore:[0-9]+]] + +// CHECK: ![[dbgLocForStore]] = !DILocation(line: 0 Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -2057,8 +2057,10 @@ } // Store the initial value into the alloca. - if (DoStore) + if (DoStore) { EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); +ApplyDebugLocation::CreateArtificial(*this); + } setAddrOfLocalVar(&D, DeclPtr); Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: store i32 %b, i32* %b.addr, align 4, !dbg ![[dbgLocForStore:[0-9]+]] + +// CHECK: ![[dbgLocForStore]] = !DILocation(line: 0 Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -2057,8 +2057,10 @@ } // Store the initial value into the alloca. - if (DoStore) + if (DoStore) { EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); +ApplyDebugLocation::CreateArtificial(*this); + } setAddrOfLocalVar(&D, DeclPtr); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47097: [WIP][DebugInfo] Preserve scope in auto generated StoreInst
gramanas updated this revision to Diff 147838. gramanas added a comment. - Apply debug location Repository: rC Clang https://reviews.llvm.org/D47097 Files: lib/CodeGen/CGDecl.cpp test/CodeGen/debug-info-preserve-scope.c Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -O0 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: store i32 %b, i32* %b.addr, align 4, !dbg ![[dbgLocForStore:[0-9]+]] + Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -2057,8 +2057,10 @@ } // Store the initial value into the alloca. - if (DoStore) + if (DoStore) { EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); +ApplyDebugLocation::CreateArtificial(*this); + } setAddrOfLocalVar(&D, DeclPtr); Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -O0 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: store i32 %b, i32* %b.addr, align 4, !dbg ![[dbgLocForStore:[0-9]+]] + Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -2057,8 +2057,10 @@ } // Store the initial value into the alloca. - if (DoStore) + if (DoStore) { EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true); +ApplyDebugLocation::CreateArtificial(*this); + } setAddrOfLocalVar(&D, DeclPtr); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47097: [WIP][DebugInfo] Preserve scope in auto generated StoreInst
gramanas created this revision. gramanas added a reviewer: vsk. Herald added subscribers: JDevlieghere, aprantl. In this test there is a store instruction generated by clang for the function argument `int b` where the debug info is missing. The goal of this patch is to instruct clang to add an artificial location to auto generated store instructions using ApplyDebugLocation::CreateArtificial() so that we can preserve the scope information of the dbg metadata. Repository: rC Clang https://reviews.llvm.org/D47097 Files: test/CodeGen/debug-info-preserve-scope.c Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -O0 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: store i32 %b, i32* %b.addr, align 4, !dbg ![[dbgLocForStore:[0-9]+]] + Index: test/CodeGen/debug-info-preserve-scope.c === --- /dev/null +++ test/CodeGen/debug-info-preserve-scope.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -O0 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s + +static int a; + +// CHECK-LABEL: define void @f +void f(int b) { + a = b; +} + +// CHECK: store i32 %b, i32* %b.addr, align 4, !dbg ![[dbgLocForStore:[0-9]+]] + ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits