| Issue |
173402
|
| Summary |
[InferAlignmentPass, SystemZ] Over-aligned vectors
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
JonPsson1
|
Clang outputs an alignment of 8 for a global:
```
@global_float_32 = dso_local global <8 x float> zeroinitializer, align 8
define dso_local <8 x float> @fun0() {
entry:
%0 = load <8 x float>, ptr @global_float_32, align 8
ret <8 x float> %0
}
```
=> `opt -mcpu=z13 -S -passes=infer-alignment`
```
@global_float_32 = dso_local global <8 x float> zeroinitializer, align 32
define dso_local <8 x float> @fun0() {
entry:
%0 = load <8 x float>, ptr @global_float_32, align 32
ret <8 x float> %0
}
```
@uweigand IIUC, there should never be any alignment greater than 16 bytes? Should global vectors >= 16 bytes be aligned to 8 or 16 bytes?
It seems that this increase in alignment happens when a global is involved - if the load is done like:
```
define dso_local <8 x float> @fun1(ptr %Src) {
entry:
%0 = load <8 x float>, ptr %Src, align 8
ret <8 x float> %0
}
```
, the alignment isn't increased.
I follow this to DataLayout::getAlignment(), where the comment says "// By default, use natural alignment for vector types. This is consistent with what clang and llvm-gcc do.". IIUC, this is not the case on SystemZ, where the alignment was given as 8. Not sure though how this should be fixed - either in DataLayout.cpp or possibly in InferAlignment.cpp.
@nikic @egorshamshura @jhuber6 @dakersnar @dc03
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs