summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2018-12-11 20:29:16 +0000
committerNikita Popov <nikita.ppv@gmail.com>2018-12-11 20:29:16 +0000
commit79c994d9767212c97f87846c7cd76e678f889052 (patch)
treec02cc77be5e3f6c3efeeb152a18253e426cd2666 /llvm/lib/CodeGen
parentfb3e58920dcc84edb169d122dd064cfcf1eb1349 (diff)
downloadbcm5719-llvm-79c994d9767212c97f87846c7cd76e678f889052.tar.gz
bcm5719-llvm-79c994d9767212c97f87846c7cd76e678f889052.zip
[ConstantFolding] Handle leading zero-size elements in load folding
Struct types may have leading zero-size elements like [0 x i32], in which case the "real" element at offset 0 will not necessarily coincide with the 0th element of the aggregate. ConstantFoldLoadThroughBitcast() wants to drill down the element at offset 0, but currently always picks the 0th aggregate element to do so. This patch changes the code to find the first non-zero-size element instead, for the struct case. The motivation behind this change is https://github.com/rust-lang/rust/issues/48627. Rust is fond of emitting [0 x iN] separators between struct elements to enforce alignment, which prevents constant folding in this particular case. The additional tests with [4294967295 x [0 x i32]] check that we don't end up unnecessarily looping over a large number of zero-size elements of a zero-size array. Differential Revision: https://reviews.llvm.org/D55169 llvm-svn: 348895
Diffstat (limited to 'llvm/lib/CodeGen')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud