[llvm] [RISCV][TTI] Simplify compound check for readability [nfc] (PR #121504)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 2 09:08:56 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-risc-v

Author: Philip Reames (preames)

<details>
<summary>Changes</summary>

I misread this check earlier today on a review, so restructure it to be easier to quickly scan.

---
Full diff: https://github.com/llvm/llvm-project/pull/121504.diff


1 Files Affected:

- (modified) llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp (+4-2) 


``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 0abb270edcabc8..13500381305168 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -2558,8 +2558,10 @@ RISCVTTIImpl::enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const {
   TTI::MemCmpExpansionOptions Options;
   // TODO: Enable expansion when unaligned access is not supported after we fix
   // issues in ExpandMemcmp.
-  if (!(ST->enableUnalignedScalarMem() &&
-        (ST->hasStdExtZbb() || ST->hasStdExtZbkb() || IsZeroCmp)))
+  if (!ST->enableUnalignedScalarMem())
+    return Options;
+
+  if (!(ST->hasStdExtZbb() || ST->hasStdExtZbkb() || IsZeroCmp))
     return Options;
 
   Options.AllowOverlappingLoads = true;

``````````

</details>


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


More information about the llvm-commits mailing list