By using the the preferred alignment when possible, this can allow local stack slot allocation to avoid materializing a base register for stack slots.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | ||
---|---|---|
263 | I think the answer is no. You could have a separate pass up-align allocas, and in practice frontends emit them with the preferred alignment to begin with. For AMDGPU there is no benefit to aligning anything on the stack over 4, and anything more just wastes space. The ABI still requires the higher alignment though, so I would like to have a pass to under align allocas when the alignment isn't visible. I've also long wanted to allow the datalayout to specify a preferred alignment lower than the ABI, but this isn't allowed (D29810 partially addressed this but never went anywhere) |
llvm/include/llvm/CodeGen/TargetLowering.h | ||
---|---|---|
535 | I really don't like this hook. We have way too many super specific hacky hooks like this. Is this really a concern? Why isn't the frontend setting the preferred alignment to begin with? |
llvm/include/llvm/CodeGen/TargetLowering.h | ||
---|---|---|
535 |
I can't find where this is happening. I'm too familiar with clang but if I grep for 'getPrefTypeAlign' I only see a few places where it's called there, which look specific to some cases, not general allocas. |
clang-format: please reformat the code