[PATCH] Add a new pass to compute DWARF path discriminators.

Diego Novillo dnovillo at google.com
Mon Feb 10 11:06:39 PST 2014


  This avoids calling replaceOperandWith. When building the vector
  of Values for the new MDNode, it uses the operands from the original
  DILocation, except operand 2.

  I'm running into an odd failure with the DILexicalBlock created by
  DIBuilder::createLexicalBlock. It sometimes returns a lexical block that
  causes an ICE when I insert it in the new DILocation I'm creating in
  DILocation::copyWithNewScope.

  It happens when building some of the ASAN runtime
  (projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_list_test.c). The
  failure is in:

  554       LLVMContextImpl *pImpl = VP.getPointer()->getContext().pImpl;

  VP is the Value for the newly created DILexicalBlock. The problem is that
  the call to getContext() returns NULL.

  I'm not sure why this is returning NULL. When I build the DILexicalBlock,
  the Scope I'm using in AddDiscriminators::runOnFunction() is:

  (gdb) call Scope->dump()
  !{i32 786443, metadata <badref>, metadata <badref>, i32 65, i32 0, i32 0} ; [ DW_TAG_lexical_block ] [/ssd/dnovillo/llvm/bld/projects/compiler-rt/lib/sanitizer_common/tests//ssd/dnovillo/llvm/llvm/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_list_test.cc]

  I am calling DIBuilder::createLexicalBlock with:

  DILexicalBlock NewScope = Builder.createLexicalBlock(Scope, File,
              FirstDIL.getLineNumber(), FirstDIL.getColumnNumber());

  - The Scope I show above.
  - The File argument I create with:
    Builder.createFile(FirstDIL.getFilename(), Scope.getDirectory())
    FirstDIL is the DILocation for the instruction I want to modify.

  Trying to dump the DILexicalBlock I get returned also ICEs the compiler,
  so I suppose that createLexicalBlock is doing something bad or I'm calling
  it with bad arguments.

  Any hints?

  Thanks.

Hi echristo,

http://llvm-reviews.chandlerc.com/D2691

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D2691?vs=6948&id=6967#toc

Files:
  include/llvm/DebugInfo.h
  include/llvm/InitializePasses.h
  include/llvm/Transforms/Scalar.h
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  lib/IR/DebugInfo.cpp
  lib/IR/LLVMContextImpl.h
  lib/MC/MCObjectStreamer.cpp
  lib/Transforms/Scalar/SampleProfile.cpp
  lib/Transforms/Utils/AddDiscriminators.cpp
  lib/Transforms/Utils/CMakeLists.txt
  lib/Transforms/Utils/Utils.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2691.3.patch
Type: text/x-patch
Size: 13690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140210/16bf6c54/attachment.bin>


More information about the llvm-commits mailing list