Skip to content

Conversation

@preames
Copy link
Collaborator

@preames preames commented Jan 2, 2025

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

I misread this check earlier today on a review, so restructure it to
be easier to quickly scan.
@llvmbot
Copy link
Member

llvmbot commented Jan 2, 2025

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

Author: Philip Reames (preames)

Changes

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 --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;

if (!ST->enableUnalignedScalarMem())
return Options;

if (!(ST->hasStdExtZbb() || ST->hasStdExtZbkb() || IsZeroCmp))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deMorgan this?

Copy link
Contributor

@wangpc-pp wangpc-pp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@preames preames merged commit dd30aa8 into llvm:main Jan 2, 2025
5 of 8 checks passed
@preames preames deleted the pr-riscv-tti-simplify-compound-memcmp-check branch January 2, 2025 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants