This patch makes sure that getOrigAlign() cannot return 0.
It now stores the OrigAlign value as a Log2 instead of Log2 + 1 (see Alignment.h encode and decodeMaybeAlign).
This change is not NFC but all the tests passes.
While reviewing the references to TargetCallingConv::getOrigAlign I stumbled upon this call which seems dubious:
- https://github.com/llvm/llvm-project/blob/2bf01dcbaa6723c9c41f8d6005a1f69818ddbd23/llvm/lib/Target/ARM/ARMCallingConv.cpp#L188
- https://github.com/llvm/llvm-project/blob/2bf01dcbaa6723c9c41f8d6005a1f69818ddbd23/llvm/include/llvm/CodeGen/CallingConvLower.h#L128
- https://github.com/llvm/llvm-project/blob/2bf01dcbaa6723c9c41f8d6005a1f69818ddbd23/llvm/include/llvm/CodeGen/CallingConvLower.h#L84
It looks like getOrigAlign (which is an alignment) is stored in CCValAssign::Loc (which is an offset or a Reg).
I traced it back to e95c5b3236cf @t.p.northover do you mind having a look?
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790