[PATCH] D15784: Enable 2 warnings on MSVC, turn on StringPooling & intrinsic functions

Alexander Riccio via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 29 16:56:49 PST 2015


ariccio added a comment.

1/2 stats posted...


================
Comment at: cmake/modules/HandleLLVMOptions.cmake:369
@@ +368,3 @@
+  # Eliminate Duplicate Strings
+  append("/GF" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+
----------------
aaron.ballman wrote:
> ariccio wrote:
> > aaron.ballman wrote:
> > > >> I think this one is reasonable, but I worry about it requiring use of /bigobj.
> > > > MSVC didn't complain about it in the debug build, so my guess is that this isn't a problem, but I'll compile a release build - optimizations might somehow pack more strings into a single image? - and see if it causes problems there. Can you think of any situation that might actually include more than 65,536 strings?
> > > 
> > > From MSDN:
> > > 
> > > > The /GF compiler option creates an addressable section for each unique string. And by default, an object file can contain up to 65,536 addressable sections. If your program contains more than 65,536 strings, use the /bigobj compiler option to create more sections.
> > > 
> > > The compiler has a lot of unique strings, which means that this option will create a lot of addressable sections. My gut feeling (not based on any research) is that our duplicate string literals are generally going to be short strings, and not repeated overly often. I would guess that our unique string literals dwarf the duplicates, and this is unlikely to have a huge size savings, but may push us over the bigobj limit.
> > > 
> > > >> What are the size differences for our executables with this option disabled vs enabled?
> > > > Ok, I'm embarrassed to say it, but I don't have any data for this. LLVM just takes too long to compile for me to check the executable size for such a small patch. Is that reasonable, or should I actually compare them?
> > > 
> > > You should actually compare them. When changing the compiler switches like this, you want to make sure that (1) the projects all still compile (perhaps there are code changes required to enable these flags), and (2) that check-all still runs cleanly (code could have been unintentionally relying on a particular optimization strategy, there are optimizer bugs, etc). This also lets you get the size statistics as well.
> > Before anything: (1), and (2) still pass - on my machine, two check-all tests fail before and after, because Python.exe is in a path that contains spaces.
> > 
> > > This also lets you get the size statistics as well.
> > 
> > Any tips on how to get the size stats? Surely, there's a better way to do it than manually?
> > 
> > 
> While an automated tool may exist, I am unaware of one. I would just do it manually, but I'm on Windows where the libraries are static instead of dynamic, so I would only have to look at the resulting .exe files. On other platforms, a quick and dirty script might be easiest.
Here's the first batch of stats. It's mostly for my own reference at the moment:


```
`Release build with patch:

 Directory of C:\LLVM\build\Release\bin

12/27/2015  10:24 PM    <DIR>          ..
12/27/2015  10:24 PM    <DIR>          .
12/27/2015  10:24 PM        23,004,160 LTO.dll
12/27/2015  10:21 PM        27,575,296 libclang.dll
12/27/2015  10:23 PM            11,776 c-arcmt-test.exe
12/27/2015  10:23 PM            74,240 c-index-test.exe
12/27/2015  10:24 PM        34,473,984 clang++.exe
12/27/2015  10:22 PM        28,597,248 clang-check.exe
12/27/2015  10:24 PM        34,473,984 clang-cl.exe
12/27/2015  10:23 PM         1,206,272 clang-format.exe
12/27/2015  09:26 PM           636,416 clang-tblgen.exe
12/27/2015  10:24 PM        34,473,984 clang.exe
12/27/2015  09:49 PM            10,752 count.exe
12/27/2015  10:21 PM         2,692,096 diagtool.exe
12/27/2015  09:49 PM           199,168 FileCheck.exe
12/27/2015  09:49 PM           144,384 KillTheDoctor.exe
12/27/2015  10:23 PM         5,304,832 bugpoint.exe
12/27/2015  10:21 PM        19,832,320 llc.exe
12/27/2015  09:49 PM            25,088 lli-child-target.exe
12/27/2015  10:21 PM         9,769,472 lli.exe
12/27/2015  10:21 PM        10,468,864 llvm-ar.exe
12/27/2015  10:21 PM         1,691,648 llvm-as.exe
12/27/2015  10:21 PM           165,888 llvm-bcanalyzer.exe
12/27/2015  10:21 PM        18,173,952 llvm-c-test.exe
12/27/2015  09:49 PM           103,936 llvm-config.exe
12/27/2015  10:21 PM         1,687,040 llvm-cov.exe
12/27/2015  10:23 PM         8,776,704 arcmt-test.exe
12/27/2015  10:21 PM         1,570,304 llvm-diff.exe
12/27/2015  10:22 PM         1,326,080 llvm-dis.exe
12/27/2015  10:22 PM        16,863,232 llvm-dsymutil.exe
12/27/2015  10:22 PM         1,675,264 llvm-dwarfdump.exe
12/27/2015  10:22 PM        16,630,784 llvm-dwp.exe
12/27/2015  10:22 PM         2,025,472 llvm-extract.exe
12/27/2015  10:22 PM        10,468,864 llvm-lib.exe
12/27/2015  10:22 PM         1,961,472 llvm-link.exe
12/27/2015  09:49 PM           173,568 yaml-bench.exe
12/27/2015  10:22 PM        21,027,840 llvm-lto.exe
12/27/2015  10:22 PM        11,923,968 llvm-mc.exe
12/27/2015  09:49 PM           144,384 llvm-mcmarkup.exe
12/27/2015  10:22 PM        10,464,256 llvm-nm.exe
12/27/2015  10:22 PM         9,658,880 llvm-objdump.exe
12/27/2015  10:22 PM           215,040 llvm-pdbdump.exe
12/27/2015  09:49 PM            18,432 llvm-PerfectShuffle.exe
12/27/2015  10:22 PM           325,632 llvm-profdata.exe
12/27/2015  10:22 PM        10,468,864 llvm-ranlib.exe
12/27/2015  10:22 PM         1,805,824 llvm-readobj.exe
12/27/2015  10:23 PM         8,293,888 llvm-rtdyld.exe
12/27/2015  10:23 PM         1,575,936 llvm-size.exe
12/27/2015  10:23 PM         1,929,728 llvm-split.exe
12/27/2015  10:23 PM         1,341,440 llvm-stress.exe
12/27/2015  10:23 PM         1,714,176 llvm-symbolizer.exe
12/27/2015  09:26 PM         1,300,992 llvm-tblgen.exe
12/27/2015  10:21 PM         1,580,544 llvm-cxxdump.exe
12/27/2015  09:49 PM            52,224 not.exe
12/27/2015  10:23 PM         1,660,928 obj2yaml.exe
12/27/2015  10:23 PM        19,069,952 opt.exe
12/27/2015  10:23 PM         9,402,368 sancov.exe
12/27/2015  10:23 PM         1,809,920 verify-uselistorder.exe
12/27/2015  10:23 PM           352,256 yaml2obj.exe
              58 File(s)    432,407,697 bytes
               2 Dir(s)  37,355,769,856 bytes free






Debug build with patch:

 Directory of C:\LLVM\build\Debug\bin

12/28/2015  06:56 PM    <DIR>          ..
12/28/2015  06:56 PM    <DIR>          .
12/27/2015  04:08 AM        87,031,808 libclang.dll
12/27/2015  04:17 AM        57,349,120 LTO.dll
12/27/2015  04:14 AM         1,549,824 yaml2obj.exe
12/27/2015  04:14 AM         1,019,392 yaml-bench.exe
12/27/2015  04:04 AM        23,538,688 bugpoint.exe
12/27/2015  04:11 AM         7,152,128 verify-uselistorder.exe
12/27/2015  04:10 AM        19,379,712 sancov.exe
12/27/2015  04:10 AM            39,424 c-arcmt-test.exe
12/27/2015  04:11 AM        52,358,144 opt.exe
12/27/2015  04:10 AM         7,360,512 obj2yaml.exe
12/27/2015  04:10 AM           159,232 c-index-test.exe
12/27/2015  04:10 AM           783,360 not.exe
12/27/2015  04:16 AM        35,772,416 arcmt-test.exe
12/27/2015  04:15 AM       102,623,232 clang++.exe
12/27/2015  04:14 AM        82,458,624 clang-check.exe
12/27/2015  02:39 AM         6,316,032 llvm-tblgen.exe
12/27/2015  04:10 AM         7,760,384 llvm-symbolizer.exe
12/27/2015  04:15 AM       102,623,232 clang-cl.exe
12/27/2015  04:14 AM         4,243,456 clang-format.exe
12/28/2015  01:15 AM            77,312 a.exe
12/27/2015  04:10 AM         9,785,344 llvm-split.exe
12/27/2015  02:39 AM         2,542,080 clang-tblgen.exe
12/27/2015  04:09 AM         6,902,272 llvm-size.exe
12/27/2015  04:09 AM        19,422,208 llvm-rtdyld.exe
12/27/2015  04:14 AM       102,623,232 clang.exe
12/27/2015  04:09 AM         7,448,064 llvm-readobj.exe
12/27/2015  04:09 AM        25,309,184 llvm-ranlib.exe
12/27/2015  04:17 AM            37,888 count.exe
12/27/2015  04:09 AM         5,266,432 llvm-profdata.exe
12/24/2015  04:17 PM            86,016 llvm-PerfectShuffle.exe
12/27/2015  04:18 AM        28,745,728 diagtool.exe
12/27/2015  04:07 AM         1,226,752 llvm-pdbdump.exe
12/27/2015  04:25 AM        19,498,496 llvm-objdump.exe
12/27/2015  04:09 AM         1,027,584 FileCheck.exe
12/27/2015  04:24 AM        25,182,720 llvm-nm.exe
12/27/2015  04:24 AM           848,384 llvm-mcmarkup.exe
12/24/2015  05:42 PM           837,120 KillTheDoctor.exe
12/27/2015  04:23 AM        28,077,056 llvm-mc.exe
12/27/2015  04:24 AM        54,491,136 llvm-lto.exe
12/24/2015  05:41 PM         5,568,512 llvm-stress.exe
12/27/2015  04:23 AM         8,723,456 llvm-link.exe
12/27/2015  04:22 AM        25,309,184 llvm-lib.exe
12/27/2015  04:19 AM        50,145,792 llc.exe
12/27/2015  04:23 AM         9,079,808 llvm-extract.exe
12/27/2015  04:22 AM        44,934,144 llvm-dwp.exe
12/27/2015  04:19 AM           796,160 lli-child-target.exe
12/27/2015  04:21 AM         7,410,688 llvm-dwarfdump.exe
12/27/2015  04:22 AM        45,424,128 llvm-dsymutil.exe
12/27/2015  04:19 AM        30,037,504 lli.exe
12/27/2015  04:21 AM         5,511,168 llvm-dis.exe
12/27/2015  04:21 AM         6,457,344 llvm-diff.exe
12/27/2015  04:06 AM        25,309,184 llvm-ar.exe
12/27/2015  04:20 AM         7,239,680 llvm-cxxdump.exe
12/27/2015  04:20 AM         7,549,440 llvm-cov.exe
12/27/2015  04:19 AM         6,613,504 llvm-as.exe
12/27/2015  04:20 AM           906,752 llvm-config.exe
12/27/2015  04:20 AM        45,832,704 llvm-c-test.exe
12/27/2015  04:19 AM           954,880 llvm-bcanalyzer.exe
             165 File(s)  9,042,836,639 bytes
               2 Dir(s)  37,355,757,568 bytes free





MinSizeRel build with patch:

 Directory of C:\LLVM\build\MinSizeRel\bin

12/29/2015  06:13 PM    <DIR>          ..
12/29/2015  06:13 PM    <DIR>          .
12/29/2015  06:13 PM        20,252,672 LTO.dll
12/29/2015  06:09 PM        23,375,872 libclang.dll
12/29/2015  06:13 PM            11,776 c-arcmt-test.exe
12/29/2015  06:13 PM            66,048 c-index-test.exe
12/29/2015  06:13 PM        28,572,160 clang++.exe
12/29/2015  06:12 PM        24,158,720 clang-check.exe
12/29/2015  06:13 PM        28,572,160 clang-cl.exe
12/29/2015  06:13 PM         1,018,880 clang-format.exe
12/29/2015  05:49 PM           407,552 clang-tblgen.exe
12/29/2015  06:13 PM        28,572,160 clang.exe
12/29/2015  06:11 PM            10,752 count.exe
12/29/2015  06:11 PM         2,249,216 diagtool.exe
12/29/2015  06:11 PM           156,672 FileCheck.exe
12/29/2015  06:13 PM           116,736 KillTheDoctor.exe
12/29/2015  06:13 PM         4,231,680 bugpoint.exe
12/29/2015  06:11 PM        17,424,384 llc.exe
12/29/2015  06:11 PM            24,064 lli-child-target.exe
12/29/2015  06:11 PM         8,465,920 lli.exe
12/29/2015  06:10 PM        10,067,968 llvm-ar.exe
12/29/2015  06:11 PM         1,654,272 llvm-as.exe
12/29/2015  06:11 PM           133,120 llvm-bcanalyzer.exe
12/29/2015  06:11 PM        16,116,736 llvm-c-test.exe
12/29/2015  06:11 PM            88,576 llvm-config.exe
12/29/2015  06:11 PM         1,691,648 llvm-cov.exe
12/29/2015  06:13 PM         6,784,512 arcmt-test.exe
12/29/2015  06:11 PM         1,574,400 llvm-diff.exe
12/29/2015  06:12 PM         1,410,560 llvm-dis.exe
12/29/2015  06:12 PM        14,686,208 llvm-dsymutil.exe
12/29/2015  06:12 PM         1,689,088 llvm-dwarfdump.exe
12/29/2015  06:12 PM        14,516,224 llvm-dwp.exe
12/29/2015  06:12 PM         1,918,976 llvm-extract.exe
12/29/2015  06:12 PM        10,067,968 llvm-lib.exe
12/29/2015  06:12 PM         1,867,264 llvm-link.exe
12/29/2015  06:13 PM           131,584 yaml-bench.exe
12/29/2015  06:12 PM        18,317,312 llvm-lto.exe
12/29/2015  06:12 PM        11,548,160 llvm-mc.exe
12/29/2015  06:12 PM           113,664 llvm-mcmarkup.exe
12/29/2015  06:12 PM        10,068,992 llvm-nm.exe
12/29/2015  06:12 PM         9,342,976 llvm-objdump.exe
12/29/2015  06:12 PM           173,568 llvm-pdbdump.exe
12/29/2015  06:11 PM            17,408 llvm-PerfectShuffle.exe
12/29/2015  06:12 PM           258,048 llvm-profdata.exe
12/29/2015  06:12 PM        10,067,968 llvm-ranlib.exe
12/29/2015  06:12 PM         1,780,736 llvm-readobj.exe
12/29/2015  06:12 PM         7,938,048 llvm-rtdyld.exe
12/29/2015  06:12 PM         1,612,288 llvm-size.exe
12/29/2015  06:13 PM         1,857,024 llvm-split.exe
12/29/2015  06:13 PM         1,407,488 llvm-stress.exe
12/29/2015  06:13 PM         1,716,736 llvm-symbolizer.exe
12/29/2015  05:49 PM           880,128 llvm-tblgen.exe
12/29/2015  06:11 PM         1,616,896 llvm-cxxdump.exe
12/29/2015  06:13 PM            45,568 not.exe
12/29/2015  06:13 PM         1,669,120 obj2yaml.exe
12/29/2015  06:13 PM        16,232,960 opt.exe
12/29/2015  06:13 PM         9,174,016 sancov.exe
12/29/2015  06:13 PM         1,743,360 verify-uselistorder.exe
12/29/2015  06:13 PM           267,264 yaml2obj.exe
              58 File(s)    379,937,940 bytes
               2 Dir(s)  57,060,495,360 bytes free




RelWithDebInfo build:

 Directory of C:\LLVM\build\RelWithDebInfo\bin

12/29/2015  07:11 PM    <DIR>          ..
12/29/2015  07:11 PM    <DIR>          .
12/29/2015  07:01 PM        42,237,952 libclang.dll
12/29/2015  07:11 PM        31,601,664 LTO.dll
12/29/2015  07:05 PM            46,592 llvm-PerfectShuffle.exe
12/29/2015  07:09 PM         9,820,672 bugpoint.exe
12/29/2015  07:07 PM        15,648,768 llvm-nm.exe
12/29/2015  07:11 PM           669,184 yaml2obj.exe
12/29/2015  07:09 PM            26,624 c-arcmt-test.exe
12/29/2015  07:07 PM           385,024 llvm-mcmarkup.exe
12/29/2015  07:08 PM         3,061,760 llvm-profdata.exe
12/29/2015  07:09 PM           101,888 c-index-test.exe
12/29/2015  07:07 PM        18,080,768 llvm-mc.exe
12/29/2015  07:10 PM           457,216 yaml-bench.exe
12/29/2015  07:11 PM        48,616,960 clang++.exe
12/29/2015  07:06 PM        41,145,856 clang-check.exe
12/29/2015  07:07 PM        29,203,456 llvm-lto.exe
12/29/2015  07:08 PM        15,673,856 llvm-ranlib.exe
12/29/2015  07:11 PM        48,616,960 clang-cl.exe
12/29/2015  07:10 PM         1,971,200 clang-format.exe
12/29/2015  07:08 PM         3,998,720 llvm-readobj.exe
12/29/2015  07:10 PM         3,820,544 verify-uselistorder.exe
12/29/2015  06:28 PM         1,062,912 clang-tblgen.exe
12/29/2015  07:07 PM         4,417,024 llvm-link.exe
12/29/2015  07:07 PM        15,673,856 llvm-lib.exe
12/29/2015  07:10 PM        48,616,960 clang.exe
12/29/2015  07:08 PM        13,509,632 llvm-objdump.exe
12/29/2015  07:10 PM        13,246,976 sancov.exe
12/29/2015  07:03 PM            25,088 count.exe
12/29/2015  07:08 PM        13,311,488 llvm-rtdyld.exe
12/29/2015  07:07 PM        23,793,664 llvm-dwp.exe
12/29/2015  07:03 PM        12,695,552 diagtool.exe
12/29/2015  07:06 PM         3,796,480 llvm-dwarfdump.exe
12/29/2015  07:09 PM        26,816,000 opt.exe
12/29/2015  07:06 PM           455,168 FileCheck.exe
12/29/2015  07:08 PM         3,678,208 llvm-size.exe
12/29/2015  07:06 PM        23,938,560 llvm-dsymutil.exe
12/29/2015  07:08 PM           381,952 KillTheDoctor.exe
12/29/2015  07:06 PM         3,122,176 llvm-dis.exe
12/29/2015  07:09 PM         3,852,288 obj2yaml.exe
12/29/2015  07:09 PM        14,534,144 arcmt-test.exe
12/29/2015  07:08 PM         4,709,376 llvm-split.exe
12/29/2015  07:05 PM         3,510,272 llvm-diff.exe
12/29/2015  07:04 PM        27,583,488 llc.exe
12/29/2015  07:05 PM         3,719,168 llvm-cxxdump.exe
12/29/2015  07:08 PM           230,912 not.exe
12/29/2015  07:05 PM           235,520 lli-child-target.exe
12/29/2015  07:08 PM         3,215,872 llvm-stress.exe
12/29/2015  07:05 PM         3,860,480 llvm-cov.exe
12/29/2015  07:04 PM        14,628,352 lli.exe
12/29/2015  07:05 PM           340,480 llvm-config.exe
12/29/2015  07:07 PM         4,435,456 llvm-extract.exe
12/29/2015  07:02 PM        15,673,856 llvm-ar.exe
12/29/2015  07:08 PM         3,876,864 llvm-symbolizer.exe
12/29/2015  07:05 PM        25,534,464 llvm-c-test.exe
12/29/2015  07:05 PM         3,653,632 llvm-as.exe
12/29/2015  07:08 PM           500,736 llvm-pdbdump.exe
12/29/2015  06:28 PM         2,048,512 llvm-tblgen.exe
12/29/2015  07:05 PM           412,672 llvm-bcanalyzer.exe
             164 File(s)  4,263,025,004 bytes
               2 Dir(s)  50,662,363,136 bytes free
`````


http://reviews.llvm.org/D15784





More information about the llvm-commits mailing list