[InstCombine] Atomic elementwise with different element counts merged
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
https://llvm.godbolt.org/z/G5xW6f31s
```llvm
define void @f(ptr %p, i1 %c, <4 x i32> %a, <2 x i64> %b) {
entry:
br i1 %c, label %then, label %else
then:
store atomic elementwise <2 x i64> %b, ptr %p unordered, align 16
br label %end
else:
store atomic elementwise <4 x i32> %a, ptr %p unordered, align 16
br label %end
end:
ret void
}
```
```llvm
define void @f(ptr %p, i1 %c, <4 x i32> %a, <2 x i64> %b) {
entry:
br i1 %c, label %then, label %else
then:
%0 = bitcast <2 x i64> %b to <4 x i32>
br label %end
else:
br label %end
end:
%storemerge = phi <4 x i32> [ %a, %else ], [ %0, %then ]
store atomic elementwise <4 x i32> %storemerge, ptr %p unordered, align 16
ret void
}
```
On the then branch, the original store was 8 byte elementwise atomic. The new store is only 4 byte elementwise atomic.
AI generated test case.
Contributor guide
Assessment
This issue has not been assessed yet.