[PATCH] Use Store Size not Alloc Size when Coercing

Thomas Jablin tjablin at gmail.com
Wed Aug 27 18:38:43 PDT 2014


Hi jmolloy,

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!

http://reviews.llvm.org/D5092

Files:
  lib/CodeGen/CGCall.cpp
  test/CodeGen/24-bit.c
  test/CodeGen/arm64-be-bitfield.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5092.13016.patch
Type: text/x-patch
Size: 2546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140828/e00a13da/attachment.bin>


More information about the cfe-commits mailing list