================
@@ -5086,6 +5088,67 @@ bool SROA::presplitLoadsAndStores(AllocaInst &AI,
AllocaSlices &AS) {
return true;
}
+/// Try to canonicalize a homogeneous struct partition to a vector type.
+///
+/// We can do this if all the elements of the struct are the same and tightly
----------------
bjope wrote:
Consider IR like this:
```
define void @d2(ptr %c) {
entry:
%e = alloca { i5, i5 }, align 1
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %e, ptr align 1 %c, i32 2, i1
true)
ret void
}
define void @d3(ptr %c) {
entry:
%e = alloca { i5, i5, i5 }, align 1
call void @llvm.memcpy.p0.p0.i32(ptr align 1 %e, ptr align 1 %c, i32 3, i1
true)
ret void
}
```
The first function wil be changed to use <2 x i5>, but the second if not
changed to use <3 x i5>.
Not sure if this is a problem really, but the code comment here talks about
restricting to cases when the elements of the struct are being tightly packed.
But that is not really what is happening when comparing the size of the struct
and the size of the vector.
Maybe there should be a check that DataLauout::typeSizeEqualsStoreSize is true
for the element type if we want to restrict this to structs without padding?
https://github.com/llvm/llvm-project/pull/165159
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits