Issue 115510
Summary LLVM doesn't properly optimize swap of larger structs
Labels llvm:optimizations, missed-optimization
Assignees
Reporter philnik777
    This code gets properly optimized to load the values into registers and then stores them back. When changing the buffer size to e.g. 16 bytes the data is moved to the stack instead, even though it could be swapped in the same way with XMM registers, which are used anyways.

```c++
struct S {
 char buffer[8];
};

auto test(S& lhs, S& rhs) {
  S tmp(lhs);
 lhs = rhs;
  rhs = tmp;
}
```
(https://godbolt.org/z/o5vYY7Ea5)

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to