irgen: don't emit debug metadata for locals
authorAndrew Wilkins <axwalk@gmail.com>
Thu, 29 Jan 2015 00:34:30 +0000 (00:34 +0000)
committerAndrew Wilkins <axwalk@gmail.com>
Thu, 29 Jan 2015 00:34:30 +0000 (00:34 +0000)
Summary:
The debug metadata we generate is wrong, and is
now causing build failures. This revision disables
the only llvm.dbg.declare calls we make.

(There is also a drive-by fix to CMakeLists.txt,
adding in a missing .go dependency.)

Fixes http://llvm.org/bugs/show_bug.cgi?id=22330

Reviewers: pcc

Reviewed By: pcc

Subscribers: dblaikie, llvm-commits

Differential Revision: http://reviews.llvm.org/D7222

llvm-svn: 227403

llgo/CMakeLists.txt
llgo/irgen/ssa.go

index 9a93a4b..e9b6bc5 100644 (file)
@@ -30,6 +30,7 @@ llvm_add_go_executable(llgo llvm.org/llgo/cmd/gllgo ALL DEPENDS
   irgen/slice.go
   irgen/ssa.go
   irgen/strings.go
+  irgen/switches.go
   irgen/targets.go
   irgen/typemap.go
   irgen/types.go
index e2be874..90e0a44 100644 (file)
@@ -357,12 +357,7 @@ func (u *unit) defineFunction(f *ssa.Function) {
        prologueBlock := llvm.InsertBasicBlock(fr.blocks[0], "prologue")
        fr.builder.SetInsertPointAtEnd(prologueBlock)
 
-       // Map parameter positions to indices. We use this
-       // when processing locals to map back to parameters
-       // when generating debug metadata.
-       paramPos := make(map[token.Pos]int)
        for i, param := range f.Params {
-               paramPos[param.Pos()] = i
                llparam := fti.argInfos[i].decode(llvm.GlobalContext(), fr.builder, fr.builder)
                if isMethod && i == 0 {
                        if _, ok := param.Type().Underlying().(*types.Pointer); !ok {
@@ -401,13 +396,6 @@ func (u *unit) defineFunction(f *ssa.Function) {
                bcalloca := fr.builder.CreateBitCast(alloca, llvm.PointerType(llvm.Int8Type(), 0), "")
                value := newValue(bcalloca, local.Type())
                fr.env[local] = value
-               if fr.GenerateDebug {
-                       paramIndex, ok := paramPos[local.Pos()]
-                       if !ok {
-                               paramIndex = -1
-                       }
-                       fr.debug.Declare(fr.builder, local, alloca, paramIndex)
-               }
        }
 
        // If the function contains any defers, we must first create