Issue 180991
Summary dead stack stores after expand-memcmp
Labels llvm:codegen, missed-optimization
Assignees
Reporter nickdesaulniers
    https://codingmarginalia.blogspot.com/2026/02/both-gcc-and-clang-generate.html mentions that
```c++
#include <array>

static constexpr int arraySize = 1;

bool isAllZeros (const std::array<int, arraySize> &array) {
 std::array<int, arraySize> allZeros {};

    return array == allZeros;
}
```
produces a dead store to the stack for optimized builds:
```asm
isAllZeros:                             # @isAllZeros
 movq    $0, -8(%rsp)
        cmpq    $0, (%rdi)
        sete    %al
 retq
```
I wonder if `expand-memcmp` should be doing a round of load-store forwarding?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to