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

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


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

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

>From 736f1d28bb2eaeecf896910e9ef9ec90cd36eb9c Mon Sep 17 00:00:00 2001
From: Philip Reames <preames at rivosinc.com>
Date: Thu, 2 Jan 2025 09:06:26 -0800
Subject: [PATCH] [RISCV][TTI] Simplify compound check for readability [nfc]

I misread this check earlier today on a review, so restructure it to
be easier to quickly scan.
---
 llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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;



More information about the llvm-commits mailing list