[llvm] [RISCV][TTI] Fix potential crash of using dyn_cast() in getIntrinsicInstrCost() NFC. (PR #109379)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 23:15:50 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 4d18ce1dd2640829c3ad9cbb31e6ff92e2e29438 5e5d244b738d9f5f51649b4eae8d301dcc756e4c --extensions cpp -- llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index d1cf7fc299..d83da93706 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -1040,7 +1040,7 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
     Intrinsic::ID IID = ICA.getID();
     std::optional<unsigned> FOp = VPIntrinsic::getFunctionalOpcodeForVP(IID);
     // We can only handle vp_cmp intrinsics with underlying instructions.
-    if(!ICA.getInst())
+    if (!ICA.getInst())
       break;
 
     assert(FOp);

``````````

</details>


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


More information about the llvm-commits mailing list