irgen: don't emit debug metadata for locals

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
This commit is contained in:
Andrew Wilkins 2015-01-29 00:34:30 +00:00
parent 905f12d96d
commit 72b5e5f5b4
2 changed files with 1 additions and 12 deletions

View 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

View 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