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