Go to file
Craig Topper 490889c405 [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
2017-03-23 06:15:56 +00:00
clang Fix issues in clang-format's AlignConsecutive modes. 2017-03-23 02:51:25 +00:00
clang-tools-extra [clang-tidy] Tests should not rely on STL headers being available. 2017-03-22 12:50:10 +00:00
compiler-rt Use lld-link /nopdb to suppress PDB generation when DWARF is required 2017-03-22 19:49:29 +00:00
debuginfo-tests New round of fixes for "Always compile debuginfo-tests for the host triple" 2014-10-18 23:47:59 +00:00
libclc math: Implement sinh function 2017-02-25 02:46:53 +00:00
libcxx Implement P0599: 'noexcept for hash functions'. Fix a couple of hash functions (optional<T> and unique_ptr<T>) which were mistakenly marked as 'noexcept'. Reviewed as https://reviews.llvm.org/D31234 2017-03-23 02:40:28 +00:00
libcxxabi Fully Reformat fallback_malloc.cpp 2017-03-04 03:23:15 +00:00
libunwind DarwinParser: include limits 2017-03-14 15:17:55 +00:00
lld [ELF] Allow references to reserved symbols in linker scripts 2017-03-23 03:52:34 +00:00
lldb Delete some more dead includes. 2017-03-22 23:33:16 +00:00
llgo [llgo] Remove support for LLVM attributes 2016-12-06 19:22:04 +00:00
llvm [IR] Use a binary search in DataLayout::getAlignmentInfo 2017-03-23 06:15:56 +00:00
openmp [OpenMP] CUDA plugin: More descriptive error messages 2017-03-22 17:36:22 +00:00
parallel-libs [Axccel] Remove -Wno-missing-braces in build 2016-12-19 21:34:07 +00:00
polly [DeLICM] Add const qualifiers. NFC. 2017-03-22 20:09:58 +00:00