[llvm] [SROA] Allow rewriting memcpy depending on tbaa.struct (PR #77597)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 10 05:38:09 PST 2024
nikic wrote:
I'm somewhat skeptical about making SROA use TBAA metadata.
I think there may be an alternative fix here: Require that the new alloca type is always "correct" for all uses. This means reverting my change, and instead changing how the SliceTy is determined in: https://github.com/llvm/llvm-project/blob/db74d290b229efb64698996e8647e1cca264d84f/llvm/lib/Transforms/Scalar/SROA.cpp#L4695C1-L4695C1
In particular, we would drop the "If not, can we find an appropriate subtype in the original allocated type?" part of the logic and adjust findCommonType() to work with non-byte-sized integers. I think that would both address the original issue while still producing the desired code in your case?
Though at a high-level, we should really just not ever emit loads and stored with non-byte-sized types in the first place. Clang's use of these for `_BitInt` violates the SysV ABI, so needs to be changed anyway. We probably can't outright forbid these in LLVM, but frontends really shouldn't be generating them.
https://github.com/llvm/llvm-project/pull/77597
More information about the llvm-commits
mailing list