aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-03-23 06:15:56 +0000
committerCraig Topper <craig.topper@gmail.com>2017-03-23 06:15:56 +0000
commit490889c405b5c6ba59a43f43d4cf89f5176e2109 (patch)
tree20d2a7012a841c97b09291e7bebbdcdf54cad28f /clang/lib/CodeGen/CodeGenModule.cpp
parent9549734e4d0cb7920dbda214552138b2a4fc27fb (diff)
downloadllvm-490889c405b5c6ba59a43f43d4cf89f5176e2109.zip
llvm-490889c405b5c6ba59a43f43d4cf89f5176e2109.tar.gz
llvm-490889c405b5c6ba59a43f43d4cf89f5176e2109.tar.bz2
[IR] Use a binary search in DataLayout::getAlignmentInfo
Summary: We currently do a linear scan through all of the Alignments array entries anytime getAlignmentInfo is called. I noticed while profiling compile time on a -O2 opt run that this function can be called quite frequently and was showing about as about 1% of the time in callgrind. This patch puts the Alignments array into a sorted order by type and then by bitwidth. We can then do a binary search. And use the sorted nature to handle the special cases for INTEGER_ALIGN. Some of this is modeled after the sorting/searching we do for pointers already. This reduced the time spent in this routine by about 2/3 in the one compilation I was looking at. We could maybe improve this more by using a DenseMap to cache the results, but just sorting was easy and didn't require extra data structure. And I think it made the integer handling simpler. Reviewers: sanjoy, davide, majnemer, resistor, arsenm, mehdi_amini Reviewed By: arsenm Subscribers: arsenm, llvm-commits Differential Revision: https://reviews.llvm.org/D31232 llvm-svn: 298579
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions