[PATCH] D158743: [Verifier] Sanity check alloca size against DILocalVariable fragment size

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 07:58:45 PDT 2023


nikic created this revision.
nikic added a reviewer: debug-info.
Herald added subscribers: StephenFan, pengfei, JDevlieghere, hiraditya, kristof.beyls.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Add a check that the DILocalVariable fragment size in dbg.declare does not exceed the size of the alloca.

This would have caught the invalid debuginfo regenerated by rustc in https://github.com/llvm/llvm-project/issues/64149.

This patch causes three remaining test failures:

- https://github.com/llvm/llvm-project/blob/main/llvm/test/DebugInfo/X86/fi-piece.ll has exactly the kind of invalid debuginfo we want to detect -- I'm not sure how to adjust the test while preserving intent.
- https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/ARM/stack-frame-layout-remarks.ll and https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/X86/stack-frame-layout-remarks.ll have 64-bit IR with corresponding sizes, but are also run against 32-bit triples, where `ptr` has a different size.


https://reviews.llvm.org/D158743

Files:
  llvm/lib/IR/Verifier.cpp
  llvm/test/CodeGen/BPF/warn-stack.ll
  llvm/test/DebugInfo/invalid-sizes.ll
  llvm/test/Transforms/InstCombine/dbg-scalable-store-fixed-frag.ll
  llvm/test/Transforms/InstCombine/dbg-simplify-alloca-size.ll
  llvm/test/Transforms/Util/dbg-user-of-aext.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158743.553134.patch
Type: text/x-patch
Size: 11268 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230824/8af0d8c8/attachment.bin>


More information about the llvm-commits mailing list