[PATCH] D42549: [CodeGen] Use the zero initializer instead of storing an all zero representation.
Matt Davis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 25 10:51:34 PST 2018
mattd created this revision.
mattd added a reviewer: majnemer.
This change avoids the overhead of storing, and later crawling,
an initializer list of all zeros for arrays. When LLVM
visits this (llvm/IR/Constants.cpp) ConstantArray::getImpl()
it will scan the list looking for an array of all zero.
We can avoid the store, and short-cut the scan, by detecting
all zeros when clang builds-up the initialization representation.
This was brought to my attention when investigating PR36030
https://reviews.llvm.org/D42549
Files:
lib/CodeGen/CGExprConstant.cpp
test/CodeGen/array-init.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42549.131480.patch
Type: text/x-patch
Size: 4661 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180125/ee20386e/attachment.bin>
More information about the cfe-commits
mailing list