Issue 115282
Summary [GlobalOpt] Reduction of global aggregate with alignment constraint unnecessarily propagates alignment to some elements
Labels new issue
Assignees
Reporter brunodf-snps
    When GlobalOpt performs SRA on a global aggregate with an alignment constraint, it seems to propagate the alignment to _some_ of the elements haphazardly. For example:

```
alignas(32) static int params[8];
```

On a plain 32 bit architecture, the array elements respectively have alignment: 32, 4, 8, 4, 16, 4, 8, 4
GlobalOpt SRA creates individual global variables for the elements with respective alignments: 32, 32, 8, 32, 16, 32, 8, 32

I don't see any benefit to increase the alignments elements 1, 3, 5, 7 from 4 to 32. This is wasteful because the new elements cannot be mapped consecutively in memory anymore.

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

Reply via email to