[PATCH] D88230: [DebugInfo] Support multiple location operands via DIArgList in DbgVariableIntrinsics

Stephen Tozer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 07:23:21 PDT 2020


StephenTozer created this revision.
StephenTozer added reviewers: aprantl, probinson, djtodoro, vsk, dblaikie.
StephenTozer added a project: debug-info.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
StephenTozer requested review of this revision.

Following from the previous patch in this series which adds the DIArgList metadata, allowing us to reference multiple Value pointers, this patch updates DbgVariableIntrinsics to make use of this functionality, resulting in a significant change to its interface.

This patch is not intended to update all IR passes to handle dbg.values with multiple location operands; that is being left to the next patch in the stack. This patch simply updates DbgVariableIntrinsic to handle DIArgLists, and updates code elsewhere to use the new interface. In some cases these changes are immediately valid, but in many they are not. All code outside of the intrinsics themselves assumes that an intrinsic will always have exactly one location operand; they will still support DIArgLists, but only if they contain exactly one Value.

Among other changes, the `setOperand` and `setArgOperand` functions in DbgVariableIntrinsic have been made private. This is to prevent code from setting the operands of these intrinsics directly, which could easily result in incorrect/invalid operands being set. Obviously this does not prevent these functions from being called on a debug intrinsic at all, as they can still be called on any CallInst pointer. My assumption however is that any code that is looking at a generic pointer without examining the type is going to be conservative about setting the operands to arbitrary values, and in any case where we could safely do so for any CallInst, we can safely do so for a DbgVariableIntrinsic. The intention for making these functions private is to prevent DIArgLists from being overwritten by code that's naively trying to replace one of the Values it points to, and also to fail fast if a DbgVariableIntrinsic is updated to use a DIArgList without a valid corresponding DIExpression.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88230

Files:
  llvm/include/llvm/IR/IntrinsicInst.h
  llvm/lib/Bitcode/Reader/MetadataLoader.cpp
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/IR/Constants.cpp
  llvm/lib/IR/IntrinsicInst.cpp
  llvm/lib/IR/Verifier.cpp
  llvm/lib/Target/AArch64/AArch64StackTagging.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
  llvm/lib/Transforms/Scalar/ADCE.cpp
  llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
  llvm/lib/Transforms/Utils/CodeExtractor.cpp
  llvm/lib/Transforms/Utils/LCSSA.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
  llvm/unittests/Transforms/Utils/LocalTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88230.294046.patch
Type: text/x-patch
Size: 26156 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200924/b15e6aa3/attachment.bin>


More information about the llvm-commits mailing list