As a result, we have identical alignment calculation of byval parameters for
- LowerCall() - getting alignment of an argument (.param)
- emitFunctionParamList() - getting alignment of a parameter (.param) in a function declaration
- getPrototype() - getting alignment of a parameter (.param) in a function prototypes that is used for indirect calls
This change is required to avoid ptxas error:
'Alignment of argument does not match formal parameter'. This
error happens even in cases where it logically shouldn't.
For instance:
.param .align 4 .b8 param0[4];
...
callprototype ()_ (.param .align 2 .b8 _[4]);
...
Here we allocate 'param0' with alignment of 4 and it should be
fine to pass it to a function that requires minimum alignment of 2.
At least ptxas v12.0 rejects this code.
Nit. This all could be folded into