[llvm] [SLP] Make getSameOpcode support different instructions if they have same semantics. (PR #112181)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 21:07:31 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 39aae575744de7ae77e755142e0746a5b473b3ed b9a4f717143e084e296c0457b31ad1bfded7b533 --extensions cpp -- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 15dfd2dca1..947ec416fe 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -1179,15 +1179,14 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
   }
 
   if (IsBinOp) {
-    auto FindOp =
-        [&](ArrayRef<InterchangeableInstruction> &CandidateOp) {
-          for (Value *V : VL)
-            for (const InterchangeableInstruction &I : CandidateOp)
-              if (cast<Instruction>(V)->getOpcode() == I.Opcode)
-                return cast<Instruction>(V);
-          llvm_unreachable(
-              "Cannot find the candidate instruction for InstructionsState.");
-        };
+    auto FindOp = [&](ArrayRef<InterchangeableInstruction> &CandidateOp) {
+      for (Value *V : VL)
+        for (const InterchangeableInstruction &I : CandidateOp)
+          if (cast<Instruction>(V)->getOpcode() == I.Opcode)
+            return cast<Instruction>(V);
+      llvm_unreachable(
+          "Cannot find the candidate instruction for InstructionsState.");
+    };
     Instruction *MainOp = FindOp(InterchangeableOpcode);
     Instruction *AltOp = AlternateInterchangeableOpcode.empty()
                              ? MainOp

``````````

</details>


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


More information about the llvm-commits mailing list