[llvm] Fix/aarch64 memset dup optimization (PR #166030)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 9 11:13:22 PST 2025
================
@@ -8961,6 +8958,12 @@ static SDValue getMemsetStores(SelectionDAG &DAG, const SDLoc &dl,
for (unsigned i = 0; i < NumMemOps; i++) {
EVT VT = MemOps[i];
unsigned VTSize = VT.getSizeInBits() / 8;
+ // Skip stores when Size is already 0. This can happen when an oversized
----------------
efriedma-quic wrote:
I'm not sure I understand how you end up in this situation.
The target specifies the type of every store. That means the total size of all the types specified in MemOps should be the total size of the memset plus an adjustment for overlapping stores. If the target is specifying too many types in the list, that seems like a bug in the target code.
If I'm following correctly, we should add an assertion that `Size != 0` here, add an assertion that `Size == 0` after the loop, and treat any violation as a bug in the target's findOptimalMemOpLowering. (With some adjustment for overlapping stores.)
https://github.com/llvm/llvm-project/pull/166030
More information about the llvm-commits
mailing list