Before this change, coalesce instructions are difficult to clean up, and prevent the tail call generation (see test case test_struct_of_two_int in llvm/test/Transforms/SROA/alloca-struct.ll)
Change SROA pass so a structure type won't be scalarized to smaller allocations (i.e., remain unchanged) in the following conditions
- If it doesn't have scalar access
or
- If the scalar stores will essentially make the struct a constant (i.e., all individual fields are constant values).
This change adds additional analysis information about usages, and mark all slices of an alloca as unsplittable if all conditions are true:
- The alloca doesn't have a) scalar load b) non constant scalar store c) uncovered access type (e.g., memcpy, memset, etc)
- In each basic block, the constant stores cover all bytes (i.e., the allocated type could be regarded as a constant in that basic block)
The change preserves original slice-split logic if there are scalar access, or if analysis information isn't sufficient to prevent scalarization.
Please use update_test_checks.py.