[PATCH] D149454: Add a verifier check to make sure that DBG_VALUE and DBG_VALUE_LIST always refers to a DILocalVariable.
Shubham Sandeep Rastogi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 28 08:39:12 PDT 2023
rastogishubham created this revision.
rastogishubham added reviewers: aprantl, jmorse, MaskRay.
rastogishubham added a project: debug-info.
Herald added a subscriber: hiraditya.
Herald added a project: All.
rastogishubham requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The machine verifier never verifies that a DBG_VALUE or DBG_VALUE_LIST refers to a DILocalVariable. This may cause issues in optimization passes.
This patch adds a quick check to make sure a DBG_VALUE or DBG_VALUE_LIST always refers to a DILocalVariable
https://reviews.llvm.org/D149454
Files:
llvm/lib/CodeGen/MachineVerifier.cpp
Index: llvm/lib/CodeGen/MachineVerifier.cpp
===================================================================
--- llvm/lib/CodeGen/MachineVerifier.cpp
+++ llvm/lib/CodeGen/MachineVerifier.cpp
@@ -1796,12 +1796,21 @@
report("Unspillable Terminator expected to have at most one use!", MI);
}
- // A fully-formed DBG_VALUE must have a location. Ignore partially formed
- // DBG_VALUEs: these are convenient to use in tests, but should never get
- // generated.
- if (MI->isDebugValue() && MI->getNumOperands() == 4)
+ // Ignore partially formed DBG_VALUEs: these are convenient to use in tests,
+ // but should never get
+ // generated.
+ if (MI->isDebugValue() && MI->getNumOperands() == 4) {
+ // A fully-formed DBG_VALUE must have a location.
if (!MI->getDebugLoc())
report("Missing DebugLoc for debug instruction", MI);
+ // A fully-formed DBG_VALUE or DBG_VALUE_LIST must have a DILocalvariable
+ // associated with it.
+ if (!MI->getDebugVariable())
+ report("Missing DebugVariable for debug instruction", MI);
+ }
+
+ if (MI->isDebugValue() && MI->getNumOperands() == 4) {
+ }
// Meta instructions should never be the subject of debug value tracking,
// they don't create a value in the output program at all.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149454.517941.patch
Type: text/x-patch
Size: 1277 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230428/c235c6b5/attachment.bin>
More information about the llvm-commits
mailing list