[llvm] [RISCV] Add initial support of memcmp expansion (PR #107548)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 6 10:53:31 PDT 2024
================
@@ -2113,3 +2113,18 @@ bool RISCVTTIImpl::shouldConsiderAddressTypePromotion(
}
return Considerable;
}
+
+RISCVTTIImpl::TTI::MemCmpExpansionOptions
+RISCVTTIImpl::enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const {
+ TTI::MemCmpExpansionOptions Options;
+ // FIXME: Vector haven't been tested.
+ Options.AllowOverlappingLoads =
+ (ST->enableUnalignedScalarMem() || ST->enableUnalignedVectorMem());
----------------
preames wrote:
Unless I'm missing something, there is no check for sufficient alignment on *any* load generated by ExpandMemCmp, as a result, we can only legally provide a non-byte size if unaligned access is fully supported.
(This is really bug in ExpandMemCmp - it should be asking if the load is properly aligned.)
https://github.com/llvm/llvm-project/pull/107548
More information about the llvm-commits
mailing list