Previously, EnterStructPointerForCoercedAccess used Alloc size when determining how to convert. This was problematic, because there were situations were the alloc size was larger than the store size. For example, if the first element of a structure were i24 and the destination type were i32, the old code would generate a GEP and a load i24. The code should compare store sizes to ensure the whole object is loaded. I have attached a test case.
This patch modifies the output of arm64-be-bitfield.c test case, but the new IR seems to be equivalent, and after -O3, the compiler generates identical ARM assembly. (asr x0, x0, #54) All tests pass with r216480. Thanks!
This comment is confusing. "Use the store size and not the alloca size here to ensure we will actually load the whole object" - But the alloca size is always greater than or equal to the store size. So the comment seems wrong - if we use the alloca size, we are also guaranteed to load the whole object.
Also please terminate sentences with a full-stop (.).