[PATCH] D39069: CodeGen: Fix missing debug loc due to alloca
This revision was automatically updated to reflect the committed changes. Closed by commit rL316484: CodeGen: Fix missing debug loc due to alloca (authored by yaxunl). Changed prior to commit: https://reviews.llvm.org/D39069?vs=120076&id=120115#toc Repository: rL LLVM https://reviews.llvm.org/D39069 Files: cfe/trunk/lib/CodeGen/CGExpr.cpp cfe/trunk/test/CodeGenOpenCL/func-call-dbg-loc.cl Index: cfe/trunk/lib/CodeGen/CGExpr.cpp === --- cfe/trunk/lib/CodeGen/CGExpr.cpp +++ cfe/trunk/lib/CodeGen/CGExpr.cpp @@ -74,12 +74,11 @@ // cast alloca to the default address space when necessary. if (CastToDefaultAddrSpace && getASTAllocaAddressSpace() != LangAS::Default) { auto DestAddrSpace = getContext().getTargetAddressSpace(LangAS::Default); -auto CurIP = Builder.saveIP(); +llvm::IRBuilderBase::InsertPointGuard IPG(Builder); Builder.SetInsertPoint(AllocaInsertPt); V = getTargetHooks().performAddrSpaceCast( *this, V, getASTAllocaAddressSpace(), LangAS::Default, Ty->getPointerTo(DestAddrSpace), /*non-null*/ true); -Builder.restoreIP(CurIP); } return Address(V, Align); Index: cfe/trunk/test/CodeGenOpenCL/func-call-dbg-loc.cl === --- cfe/trunk/test/CodeGenOpenCL/func-call-dbg-loc.cl +++ cfe/trunk/test/CodeGenOpenCL/func-call-dbg-loc.cl @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple amdgcn---amdgizcl -debug-info-kind=limited -O0 -emit-llvm -o - %s | FileCheck %s + +typedef struct +{ +int a; +} Struct; + +Struct func1(); + +void func2(Struct S); + +void func3() +{ +// CHECK: call i32 @func1() #{{[0-9]+}}, !dbg ![[LOC:[0-9]+]] +// CHECK: call void @func2(i32 %{{[0-9]+}}) #{{[0-9]+}}, !dbg ![[LOC]] +func2(func1()); +} + Index: cfe/trunk/lib/CodeGen/CGExpr.cpp === --- cfe/trunk/lib/CodeGen/CGExpr.cpp +++ cfe/trunk/lib/CodeGen/CGExpr.cpp @@ -74,12 +74,11 @@ // cast alloca to the default address space when necessary. if (CastToDefaultAddrSpace && getASTAllocaAddressSpace() != LangAS::Default) { auto DestAddrSpace = getContext().getTargetAddressSpace(LangAS::Default); -auto CurIP = Builder.saveIP(); +llvm::IRBuilderBase::InsertPointGuard IPG(Builder); Builder.SetInsertPoint(AllocaInsertPt); V = getTargetHooks().performAddrSpaceCast( *this, V, getASTAllocaAddressSpace(), LangAS::Default, Ty->getPointerTo(DestAddrSpace), /*non-null*/ true); -Builder.restoreIP(CurIP); } return Address(V, Align); Index: cfe/trunk/test/CodeGenOpenCL/func-call-dbg-loc.cl === --- cfe/trunk/test/CodeGenOpenCL/func-call-dbg-loc.cl +++ cfe/trunk/test/CodeGenOpenCL/func-call-dbg-loc.cl @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple amdgcn---amdgizcl -debug-info-kind=limited -O0 -emit-llvm -o - %s | FileCheck %s + +typedef struct +{ +int a; +} Struct; + +Struct func1(); + +void func2(Struct S); + +void func3() +{ +// CHECK: call i32 @func1() #{{[0-9]+}}, !dbg ![[LOC:[0-9]+]] +// CHECK: call void @func2(i32 %{{[0-9]+}}) #{{[0-9]+}}, !dbg ![[LOC]] +func2(func1()); +} + ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39069: CodeGen: Fix missing debug loc due to alloca
rjmccall accepted this revision. rjmccall added a comment. This revision is now accepted and ready to land. Okay, LGTM. https://reviews.llvm.org/D39069 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39069: CodeGen: Fix missing debug loc due to alloca
yaxunl updated this revision to Diff 120076. yaxunl added a comment. Revised the test by Paul's comments. https://reviews.llvm.org/D39069 Files: lib/CodeGen/CGExpr.cpp test/CodeGenOpenCL/func-call-dbg-loc.cl Index: test/CodeGenOpenCL/func-call-dbg-loc.cl === --- /dev/null +++ test/CodeGenOpenCL/func-call-dbg-loc.cl @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple amdgcn---amdgizcl -debug-info-kind=limited -O0 -emit-llvm -o - %s | FileCheck %s + +typedef struct +{ +int a; +} Struct; + +Struct func1(); + +void func2(Struct S); + +void func3() +{ +// CHECK: call i32 @func1() #{{[0-9]+}}, !dbg ![[LOC:[0-9]+]] +// CHECK: call void @func2(i32 %{{[0-9]+}}) #{{[0-9]+}}, !dbg ![[LOC]] +func2(func1()); +} + Index: lib/CodeGen/CGExpr.cpp === --- lib/CodeGen/CGExpr.cpp +++ lib/CodeGen/CGExpr.cpp @@ -74,12 +74,11 @@ // cast alloca to the default address space when necessary. if (CastToDefaultAddrSpace && getASTAllocaAddressSpace() != LangAS::Default) { auto DestAddrSpace = getContext().getTargetAddressSpace(LangAS::Default); -auto CurIP = Builder.saveIP(); +llvm::IRBuilderBase::InsertPointGuard IPG(Builder); Builder.SetInsertPoint(AllocaInsertPt); V = getTargetHooks().performAddrSpaceCast( *this, V, getASTAllocaAddressSpace(), LangAS::Default, Ty->getPointerTo(DestAddrSpace), /*non-null*/ true); -Builder.restoreIP(CurIP); } return Address(V, Align); Index: test/CodeGenOpenCL/func-call-dbg-loc.cl === --- /dev/null +++ test/CodeGenOpenCL/func-call-dbg-loc.cl @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple amdgcn---amdgizcl -debug-info-kind=limited -O0 -emit-llvm -o - %s | FileCheck %s + +typedef struct +{ +int a; +} Struct; + +Struct func1(); + +void func2(Struct S); + +void func3() +{ +// CHECK: call i32 @func1() #{{[0-9]+}}, !dbg ![[LOC:[0-9]+]] +// CHECK: call void @func2(i32 %{{[0-9]+}}) #{{[0-9]+}}, !dbg ![[LOC]] +func2(func1()); +} + Index: lib/CodeGen/CGExpr.cpp === --- lib/CodeGen/CGExpr.cpp +++ lib/CodeGen/CGExpr.cpp @@ -74,12 +74,11 @@ // cast alloca to the default address space when necessary. if (CastToDefaultAddrSpace && getASTAllocaAddressSpace() != LangAS::Default) { auto DestAddrSpace = getContext().getTargetAddressSpace(LangAS::Default); -auto CurIP = Builder.saveIP(); +llvm::IRBuilderBase::InsertPointGuard IPG(Builder); Builder.SetInsertPoint(AllocaInsertPt); V = getTargetHooks().performAddrSpaceCast( *this, V, getASTAllocaAddressSpace(), LangAS::Default, Ty->getPointerTo(DestAddrSpace), /*non-null*/ true); -Builder.restoreIP(CurIP); } return Address(V, Align); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39069: CodeGen: Fix missing debug loc due to alloca
rjmccall added a comment. In https://reviews.llvm.org/D39069#904507, @probinson wrote: > Anytime the code between saveIP() and restoreIP() could set the current debug > location, it needs to be saved/restored along with the insertion point. I > have to say the problem is not obvious to me here, so maybe saveIP/restoreIP > should be changed (or eliminated in favor of always using InsertPointGuard). > I'm not seeing a lot of places where saveIP/restoreIP are used. Yeah, not too many. I'm not seeing any real reason not to just switch Clang over to always use InsertPointGuard. (Yaxun, you don't need to do this; I'm just making a note to myself.) John. https://reviews.llvm.org/D39069 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39069: CodeGen: Fix missing debug loc due to alloca
probinson added a comment. Anytime the code between saveIP() and restoreIP() could set the current debug location, it needs to be saved/restored along with the insertion point. I have to say the problem is not obvious to me here, so maybe saveIP/restoreIP should be changed (or eliminated in favor of always using InsertPointGuard). I'm not seeing a lot of places where saveIP/restoreIP are used. The test looks like all it's doing is verifying both calls have a debug location at all. It could verify that both calls have the _same_ debug location, which I would find much more robust and convincing. https://reviews.llvm.org/D39069 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39069: CodeGen: Fix missing debug loc due to alloca
rjmccall added a comment. The code looks fine to me. The test seems very vague to me, but I'd like Dave to weigh in on that, because I'm not sure it's reasonable to test the exact pattern here. Also, Dave, I don't know what the IR invariants around debug info are. Is this something we should be updating all of our uses of saveIP() to do if there's a possibility of emitting arbitrary code while the IP is saved? https://reviews.llvm.org/D39069 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39069: CodeGen: Fix missing debug loc due to alloca
yaxunl updated this revision to Diff 119918. yaxunl added a comment. Use InsertPointGuard and simplify test. https://reviews.llvm.org/D39069 Files: lib/CodeGen/CGExpr.cpp test/CodeGenOpenCL/func-call-dbg-loc.cl Index: test/CodeGenOpenCL/func-call-dbg-loc.cl === --- /dev/null +++ test/CodeGenOpenCL/func-call-dbg-loc.cl @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple amdgcn---amdgizcl -debug-info-kind=limited -O0 -emit-llvm -o - %s | FileCheck %s + +typedef struct +{ +int a; +} Struct; + +Struct func1(); + +void func2(Struct S); + +void func3() +{ +// CHECK: call i32 @func1() #{{[0-9]+}}, !dbg !{{[0-9]+}} +// CHECK: call void @func2(i32 %{{[0-9]+}}) #{{[0-9]+}}, !dbg !{{[0-9]+}} +func2(func1()); +} + Index: lib/CodeGen/CGExpr.cpp === --- lib/CodeGen/CGExpr.cpp +++ lib/CodeGen/CGExpr.cpp @@ -74,12 +74,11 @@ // cast alloca to the default address space when necessary. if (CastToDefaultAddrSpace && getASTAllocaAddressSpace() != LangAS::Default) { auto DestAddrSpace = getContext().getTargetAddressSpace(LangAS::Default); -auto CurIP = Builder.saveIP(); +llvm::IRBuilderBase::InsertPointGuard IPG(Builder); Builder.SetInsertPoint(AllocaInsertPt); V = getTargetHooks().performAddrSpaceCast( *this, V, getASTAllocaAddressSpace(), LangAS::Default, Ty->getPointerTo(DestAddrSpace), /*non-null*/ true); -Builder.restoreIP(CurIP); } return Address(V, Align); Index: test/CodeGenOpenCL/func-call-dbg-loc.cl === --- /dev/null +++ test/CodeGenOpenCL/func-call-dbg-loc.cl @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple amdgcn---amdgizcl -debug-info-kind=limited -O0 -emit-llvm -o - %s | FileCheck %s + +typedef struct +{ +int a; +} Struct; + +Struct func1(); + +void func2(Struct S); + +void func3() +{ +// CHECK: call i32 @func1() #{{[0-9]+}}, !dbg !{{[0-9]+}} +// CHECK: call void @func2(i32 %{{[0-9]+}}) #{{[0-9]+}}, !dbg !{{[0-9]+}} +func2(func1()); +} + Index: lib/CodeGen/CGExpr.cpp === --- lib/CodeGen/CGExpr.cpp +++ lib/CodeGen/CGExpr.cpp @@ -74,12 +74,11 @@ // cast alloca to the default address space when necessary. if (CastToDefaultAddrSpace && getASTAllocaAddressSpace() != LangAS::Default) { auto DestAddrSpace = getContext().getTargetAddressSpace(LangAS::Default); -auto CurIP = Builder.saveIP(); +llvm::IRBuilderBase::InsertPointGuard IPG(Builder); Builder.SetInsertPoint(AllocaInsertPt); V = getTargetHooks().performAddrSpaceCast( *this, V, getASTAllocaAddressSpace(), LangAS::Default, Ty->getPointerTo(DestAddrSpace), /*non-null*/ true); -Builder.restoreIP(CurIP); } return Address(V, Align); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39069: CodeGen: Fix missing debug loc due to alloca
yaxunl added a comment. In https://reviews.llvm.org/D39069#903344, @rjmccall wrote: > If this is something we generally need to be doing in all the places we > temporarily save and restore the insertion point, we should fix the basic > behavior of saveIP instead of adding explicit code to a bunch of separate > places. Can we just override saveIP() on CGBuilder to return a struct that > also includes the current debug location? IRBuilderBase::InsertPointGuard does that. Will use it instead. https://reviews.llvm.org/D39069 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
RE: [PATCH] D39069: CodeGen: Fix missing debug loc due to alloca
I will simplify the test. Thanks. Sam From: David Blaikie [mailto:dblai...@gmail.com] Sent: Monday, October 23, 2017 2:08 PM To: reviews+d39069+public+8da79e110d303...@reviews.llvm.org; Yaxun Liu via Phabricator ; Liu, Yaxun (Sam) ; rjmcc...@gmail.com Cc: cfe-commits@lists.llvm.org Subject: Re: [PATCH] D39069: CodeGen: Fix missing debug loc due to alloca What John said, but also a narrower test would be good - checking that the appropriate call instruction gets a debug location, rather than checking that a bunch of inlining doesn't cause the assertion/verifier failure, would be good. (Clang tests should, as much as possible, not rely on or run the LLVM optimization passes - but check the IR coming directly from Clang before any of that) On Wed, Oct 18, 2017 at 2:15 PM Yaxun Liu via Phabricator via cfe-commits mailto:cfe-commits@lists.llvm.org>> wrote: yaxunl created this revision. Builder save/restores insertion pointer when emitting addr space cast for alloca, but does not save/restore debug loc, which causes verifier failure for certain call instructions. This patch fixes that. https://reviews.llvm.org/D39069 Files: lib/CodeGen/CGExpr.cpp test/CodeGenOpenCL/func-call-dbg-loc.cl<http://func-call-dbg-loc.cl> Index: test/CodeGenOpenCL/func-call-dbg-loc.cl<http://func-call-dbg-loc.cl> === --- /dev/null +++ test/CodeGenOpenCL/func-call-dbg-loc.cl<http://func-call-dbg-loc.cl> @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -triple amdgcn---amdgizcl -debug-info-kind=limited -dwarf-version=2 -debugger-tuning=gdb -O0 -emit-llvm -o - %s | FileCheck %s +// Checks the file compiles without verifier error: inlinable function call in a function with debug info must have a !dbg location. + +typedef struct +{ +float m_max; +} Struct; + +typedef struct +{ +Struct m_volume; +} Node; + + +Struct buzz(Node node) +{ +return node.m_volume; +} + +__attribute__((always_inline)) +float bar(Struct aabb) +{ +return 0.0f; +} + +__attribute__((used)) +void foo() +{ +Node node; +// CHECK: store float 0.00e+00, float addrspace(5)* %f, align 4, !dbg !{{[0-9]+}} +float f = bar(buzz(node)); +} + + Index: lib/CodeGen/CGExpr.cpp === --- lib/CodeGen/CGExpr.cpp +++ lib/CodeGen/CGExpr.cpp @@ -75,11 +75,13 @@ if (CastToDefaultAddrSpace && getASTAllocaAddressSpace() != LangAS::Default) { auto DestAddrSpace = getContext().getTargetAddressSpace(LangAS::Default); auto CurIP = Builder.saveIP(); +auto DbgLoc = Builder.getCurrentDebugLocation(); Builder.SetInsertPoint(AllocaInsertPt); V = getTargetHooks().performAddrSpaceCast( *this, V, getASTAllocaAddressSpace(), LangAS::Default, Ty->getPointerTo(DestAddrSpace), /*non-null*/ true); Builder.restoreIP(CurIP); +Builder.SetCurrentDebugLocation(DbgLoc); } return Address(V, Align); ___ cfe-commits mailing list cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D39069: CodeGen: Fix missing debug loc due to alloca
What John said, but also a narrower test would be good - checking that the appropriate call instruction gets a debug location, rather than checking that a bunch of inlining doesn't cause the assertion/verifier failure, would be good. (Clang tests should, as much as possible, not rely on or run the LLVM optimization passes - but check the IR coming directly from Clang before any of that) On Wed, Oct 18, 2017 at 2:15 PM Yaxun Liu via Phabricator via cfe-commits < cfe-commits@lists.llvm.org> wrote: > yaxunl created this revision. > > Builder save/restores insertion pointer when emitting addr space cast > for alloca, but does not save/restore debug loc, which causes verifier > failure for certain call instructions. > > This patch fixes that. > > > https://reviews.llvm.org/D39069 > > Files: > lib/CodeGen/CGExpr.cpp > test/CodeGenOpenCL/func-call-dbg-loc.cl > > > Index: test/CodeGenOpenCL/func-call-dbg-loc.cl > === > --- /dev/null > +++ test/CodeGenOpenCL/func-call-dbg-loc.cl > @@ -0,0 +1,34 @@ > +// RUN: %clang_cc1 -triple amdgcn---amdgizcl -debug-info-kind=limited > -dwarf-version=2 -debugger-tuning=gdb -O0 -emit-llvm -o - %s | FileCheck %s > +// Checks the file compiles without verifier error: inlinable function > call in a function with debug info must have a !dbg location. > + > +typedef struct > +{ > +float m_max; > +} Struct; > + > +typedef struct > +{ > +Struct m_volume; > +} Node; > + > + > +Struct buzz(Node node) > +{ > +return node.m_volume; > +} > + > +__attribute__((always_inline)) > +float bar(Struct aabb) > +{ > +return 0.0f; > +} > + > +__attribute__((used)) > +void foo() > +{ > +Node node; > +// CHECK: store float 0.00e+00, float addrspace(5)* %f, align 4, > !dbg !{{[0-9]+}} > +float f = bar(buzz(node)); > +} > + > + > Index: lib/CodeGen/CGExpr.cpp > === > --- lib/CodeGen/CGExpr.cpp > +++ lib/CodeGen/CGExpr.cpp > @@ -75,11 +75,13 @@ >if (CastToDefaultAddrSpace && getASTAllocaAddressSpace() != > LangAS::Default) { > auto DestAddrSpace = > getContext().getTargetAddressSpace(LangAS::Default); > auto CurIP = Builder.saveIP(); > +auto DbgLoc = Builder.getCurrentDebugLocation(); > Builder.SetInsertPoint(AllocaInsertPt); > V = getTargetHooks().performAddrSpaceCast( > *this, V, getASTAllocaAddressSpace(), LangAS::Default, > Ty->getPointerTo(DestAddrSpace), /*non-null*/ true); > Builder.restoreIP(CurIP); > +Builder.SetCurrentDebugLocation(DbgLoc); >} > >return Address(V, Align); > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39069: CodeGen: Fix missing debug loc due to alloca
rjmccall added a comment. If this is something we generally need to be doing in all the places we temporarily save and restore the insertion point, we should fix the basic behavior of saveIP instead of adding explicit code to a bunch of separate places. Can we just override saveIP() on CGBuilder to return a struct that also includes the current debug location? https://reviews.llvm.org/D39069 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39069: CodeGen: Fix missing debug loc due to alloca
yaxunl created this revision. Builder save/restores insertion pointer when emitting addr space cast for alloca, but does not save/restore debug loc, which causes verifier failure for certain call instructions. This patch fixes that. https://reviews.llvm.org/D39069 Files: lib/CodeGen/CGExpr.cpp test/CodeGenOpenCL/func-call-dbg-loc.cl Index: test/CodeGenOpenCL/func-call-dbg-loc.cl === --- /dev/null +++ test/CodeGenOpenCL/func-call-dbg-loc.cl @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -triple amdgcn---amdgizcl -debug-info-kind=limited -dwarf-version=2 -debugger-tuning=gdb -O0 -emit-llvm -o - %s | FileCheck %s +// Checks the file compiles without verifier error: inlinable function call in a function with debug info must have a !dbg location. + +typedef struct +{ +float m_max; +} Struct; + +typedef struct +{ +Struct m_volume; +} Node; + + +Struct buzz(Node node) +{ +return node.m_volume; +} + +__attribute__((always_inline)) +float bar(Struct aabb) +{ +return 0.0f; +} + +__attribute__((used)) +void foo() +{ +Node node; +// CHECK: store float 0.00e+00, float addrspace(5)* %f, align 4, !dbg !{{[0-9]+}} +float f = bar(buzz(node)); +} + + Index: lib/CodeGen/CGExpr.cpp === --- lib/CodeGen/CGExpr.cpp +++ lib/CodeGen/CGExpr.cpp @@ -75,11 +75,13 @@ if (CastToDefaultAddrSpace && getASTAllocaAddressSpace() != LangAS::Default) { auto DestAddrSpace = getContext().getTargetAddressSpace(LangAS::Default); auto CurIP = Builder.saveIP(); +auto DbgLoc = Builder.getCurrentDebugLocation(); Builder.SetInsertPoint(AllocaInsertPt); V = getTargetHooks().performAddrSpaceCast( *this, V, getASTAllocaAddressSpace(), LangAS::Default, Ty->getPointerTo(DestAddrSpace), /*non-null*/ true); Builder.restoreIP(CurIP); +Builder.SetCurrentDebugLocation(DbgLoc); } return Address(V, Align); Index: test/CodeGenOpenCL/func-call-dbg-loc.cl === --- /dev/null +++ test/CodeGenOpenCL/func-call-dbg-loc.cl @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -triple amdgcn---amdgizcl -debug-info-kind=limited -dwarf-version=2 -debugger-tuning=gdb -O0 -emit-llvm -o - %s | FileCheck %s +// Checks the file compiles without verifier error: inlinable function call in a function with debug info must have a !dbg location. + +typedef struct +{ +float m_max; +} Struct; + +typedef struct +{ +Struct m_volume; +} Node; + + +Struct buzz(Node node) +{ +return node.m_volume; +} + +__attribute__((always_inline)) +float bar(Struct aabb) +{ +return 0.0f; +} + +__attribute__((used)) +void foo() +{ +Node node; +// CHECK: store float 0.00e+00, float addrspace(5)* %f, align 4, !dbg !{{[0-9]+}} +float f = bar(buzz(node)); +} + + Index: lib/CodeGen/CGExpr.cpp === --- lib/CodeGen/CGExpr.cpp +++ lib/CodeGen/CGExpr.cpp @@ -75,11 +75,13 @@ if (CastToDefaultAddrSpace && getASTAllocaAddressSpace() != LangAS::Default) { auto DestAddrSpace = getContext().getTargetAddressSpace(LangAS::Default); auto CurIP = Builder.saveIP(); +auto DbgLoc = Builder.getCurrentDebugLocation(); Builder.SetInsertPoint(AllocaInsertPt); V = getTargetHooks().performAddrSpaceCast( *this, V, getASTAllocaAddressSpace(), LangAS::Default, Ty->getPointerTo(DestAddrSpace), /*non-null*/ true); Builder.restoreIP(CurIP); +Builder.SetCurrentDebugLocation(DbgLoc); } return Address(V, Align); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits