[llvm] Only guard loop metadata that has non-debug info in it (PR #118825)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 08:02:57 PST 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 da6099c9adadffb58e0edca253b1f29db77627f6 71e8f496ccd799d429489dbc0cb0750061932443 --extensions h,cpp -- llvm/include/llvm/IR/Instruction.h llvm/lib/IR/Instruction.cpp llvm/lib/Transforms/Utils/Local.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 6c19712481..8d02bfe6ea 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -466,16 +466,16 @@ bool Instruction::hasPoisonGeneratingMetadata() const {
 bool Instruction::hasLoopMetadataOtherThanDebugLoc() const {
   // If there is no loop metadata at all, we also don't have
   // non-debug loop metadata, obviously.
-  if  (!hasMetadata(LLVMContext::MD_loop))
+  if (!hasMetadata(LLVMContext::MD_loop))
     return false;
 
   // If we do have loop metadata, retrieve it.
-  MDNode * LoopMD = getMetadata(LLVMContext::MD_loop);
+  MDNode *LoopMD = getMetadata(LLVMContext::MD_loop);
 
   // Check if the existing operands are debug locations. This loop
   // should terminate after at most three iterations. Skip
   // the first item because it is a self-reference.
-  for (const MDOperand& Op : llvm::drop_begin(LoopMD->operands())) {
+  for (const MDOperand &Op : llvm::drop_begin(LoopMD->operands())) {
     // check for debug location type by attempting a cast.
     if (!dyn_cast<DILocation>(Op)) {
       return true;

``````````

</details>


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


More information about the llvm-commits mailing list