[llvm] [DebugInfo] Handle DW_OP_LLVM_extract_bits in SROA (PR #94638)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 09:28:19 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 85ea1aaf15b3721aaea35280ffdedad36128bf6b eaea27c9a2ff0238b138cad42a94d4b5f87cc86d -- llvm/include/llvm/BinaryFormat/Dwarf.h llvm/include/llvm/IR/DebugInfoMetadata.h llvm/lib/BinaryFormat/Dwarf.cpp llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp llvm/lib/IR/DebugInfoMetadata.cpp llvm/lib/IR/DebugProgramInstruction.cpp llvm/lib/IR/IntrinsicInst.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index dce2e30377..0e8dd76833 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -1682,8 +1682,10 @@ DIExpression::getFragmentInfo(expr_op_iterator Start, expr_op_iterator End) {
 std::optional<uint64_t> DIExpression::getActiveBits(DIVariable *Var) {
   std::optional<uint64_t> BitWidth = Var->getSizeInBits();
   for (auto Op : expr_ops()) {
-    if ((Op.getOp() == dwarf::DW_OP_LLVM_extract_bits_zext && Var->getSignedness() != DIBasicType::Signedness::Unsigned) ||
-        (Op.getOp() == dwarf::DW_OP_LLVM_extract_bits_sext && Var->getSignedness() != DIBasicType::Signedness::Signed)) {
+    if ((Op.getOp() == dwarf::DW_OP_LLVM_extract_bits_zext &&
+         Var->getSignedness() != DIBasicType::Signedness::Unsigned) ||
+        (Op.getOp() == dwarf::DW_OP_LLVM_extract_bits_sext &&
+         Var->getSignedness() != DIBasicType::Signedness::Signed)) {
       BitWidth = Var->getSizeInBits();
       continue;
     }
@@ -2010,7 +2012,8 @@ std::optional<DIExpression *> DIExpression::createFragmentExpression(
         uint64_t ExtractOffsetInBits = Op.getArg(0);
         uint64_t ExtractSizeInBits = Op.getArg(1);
         if (ExtractOffsetInBits >= OffsetInBits &&
-            ExtractOffsetInBits + ExtractSizeInBits <= OffsetInBits + SizeInBits) {
+            ExtractOffsetInBits + ExtractSizeInBits <=
+                OffsetInBits + SizeInBits) {
           Ops.push_back(Op.getOp());
           Ops.push_back(ExtractOffsetInBits - OffsetInBits);
           Ops.push_back(ExtractSizeInBits);

``````````

</details>


https://github.com/llvm/llvm-project/pull/94638


More information about the llvm-commits mailing list