aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/BackendUtil.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-07-01Changed Opts.EABIVersion type string to llvm::EABI enum classYuka Takahashi1-5/+1
Summary: Changed EABIVersion type from string to llvm::EABI. It seems it was just a typo and this is intended implementation. Differential Revision: https://reviews.llvm.org/D34595 llvm-svn: 306953
2017-06-30Remove Clang support for '-fvectorize-slp-aggressive' which used LLVM'sChandler Carruth1-1/+0
basic block vectorizer. This vectorizer has had no known users for many, many years and is completely surpassed by the normal '-fvectorize-slp'-controlled SLP vectorizer in LLVM. Hal proposed this back in 2014 to no objections: http://lists.llvm.org/pipermail/llvm-dev/2014-November/079091.html While this patch completely removes the flag, Joerg is working on a patch that will add it back in a way that warns users and ignores the flag in a clear and well factored way (so that we can keep doing this going forward). Differential Revision: https://reviews.llvm.org/D34846 llvm-svn: 306786
2017-06-29[PM] Add support for sample PGO in the new pass manager (clang-side)Dehao Chen1-1/+5
Summary: This implements the clang bits of https://reviews.llvm.org/D34720, and add corresponding test to verify if it worked. Reviewers: chandlerc, davidxl, davide, tejohnson Reviewed By: chandlerc, tejohnson Subscribers: tejohnson, sanjoy, mehdi_amini, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D34721 llvm-svn: 306764
2017-06-29[NewPM] Add Clang cc1 flag -fdebug-pass-manager for printing debug information.Tim Shen1-4/+7
Differential Revision: https://reviews.llvm.org/D34790 llvm-svn: 306757
2017-06-29[ThinkLTO] Invoke build(Thin)?LTOPreLinkDefaultPipeline.Tim Shen1-4/+16
Previously it doesn't actually invoke the designated new PM builder functions. This patch moves NameAnonGlobalPass out from PassBuilder, as Chandler points out that PassBuilder is used for non-O0 builds, and for optimizations only. Differential Revision: https://reviews.llvm.org/D34728 llvm-svn: 306756
2017-06-15Apply summary-based dead stripping to regular LTO modules with summaries.Peter Collingbourne1-4/+4
If a regular LTO module has a summary index, then instead of linking it into the combined regular LTO module right away, add it to the combined summary index and associate it with a special module that represents the combined regular LTO module. Any such modules are linked during LTO::run(), at which time we use the results of summary-based dead stripping to control whether to link prevailing symbols. Differential Revision: https://reviews.llvm.org/D33922 llvm-svn: 305482
2017-06-09Represent debug information compression type fullySaleem Abdulrasool1-1/+1
This is tied with the LLVM side of the change to expose the debug information compression types to clang. We now track the compression type as an enumeration rather than a boolean. We still use the same value (GNU) that we did previously. This is in preparation to support passing down the compression type and switch it based on the command line. llvm-svn: 305039
2017-06-08[sanitizer-coverage] one more flavor of coverage: ↵Kostya Serebryany1-0/+1
-fsanitize-coverage=inline-8bit-counters. Experimental so far, not documenting yet. Reapplying revisions 304630, 304631, 304632, 304673, see PR33308 llvm-svn: 305026
2017-06-05Revert "[sanitizer-coverage] one more flavor of coverage: ↵Renato Golin1-1/+0
-fsanitize-coverage=inline-8bit-counters. Experimental so far, not documenting yet. (clang part)" This reverts commit r304631, as it broke ARM/AArch64 bots for 2 days. llvm-svn: 304697
2017-06-03[sanitizer-coverage] one more flavor of coverage: ↵Kostya Serebryany1-0/+1
-fsanitize-coverage=inline-8bit-counters. Experimental so far, not documenting yet. (clang part) llvm-svn: 304631
2017-06-01[ThinLTO] Wire up ThinLTO and new PMTim Shen1-3/+21
Summary: This patch teaches clang to use and propagate new PM in ThinLTO. Reviewers: davide, chandlerc, tejohnson Subscribers: mehdi_amini, Prazek, inglorion, cfe-commits Differential Revision: https://reviews.llvm.org/D33692 llvm-svn: 304496
2017-05-12Remove ignore-empty-index-file optionTeresa Johnson1-1/+2
Summary: Clang changes to remove this option and replace with a parameter always set in the context of a ThinLTO distributed backend. Depends on D33133. Reviewers: pcc Subscribers: mehdi_amini, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D33134 llvm-svn: 302940
2017-05-09[asan] A clang flag to enable ELF globals-gc.Evgeniy Stepanov1-0/+2
This feature is subtly broken when the linker is gold 2.26 or earlier. See the following bug for details: https://sourceware.org/bugzilla/show_bug.cgi?id=19002 Since the decision needs to be made at compilation time, we can not test the linker version. The flag is off by default on ELF targets, and on otherwise. llvm-svn: 302591
2017-05-05[sanitizer-coverage] implement -fsanitize-coverage=no-prune,... instead of a ↵Kostya Serebryany1-0/+1
hidden -mllvm flag. clang part. llvm-svn: 302320
2017-05-04Re-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in ↵Peter Collingbourne1-2/+6
the module summary. NFCI." with a fix for the clang backend. llvm-svn: 302176
2017-05-04Revert "IR: Use pointers instead of GUIDs to represent edges in the module ↵Eric Liu1-2/+2
summary. NFCI." This reverts commit r302108. llvm-svn: 302141
2017-05-04IR: Use pointers instead of GUIDs to represent edges in the module summary. ↵Peter Collingbourne1-2/+2
NFCI. When profiling a no-op incremental link of Chromium I found that the functions computeImportForFunction and computeDeadSymbols were consuming roughly 10% of the profile. The goal of this change is to improve the performance of those functions by changing the map lookups that they were previously doing into pointer dereferences. This is achieved by changing the ValueInfo data structure to be a pointer to an element of the global value map owned by ModuleSummaryIndex, and changing reference lists in the GlobalValueSummary to hold ValueInfos instead of GUIDs. This means that a ValueInfo will take a client directly to the summary list for a given GUID. Differential Revision: https://reviews.llvm.org/D32471 llvm-svn: 302108
2017-05-01Object: Remove ModuleSummaryIndexObjectFile class.Peter Collingbourne1-1/+0
Differential Revision: https://reviews.llvm.org/D32195 llvm-svn: 301832
2017-04-26[asan] Unconditionally enable GC of globals on COFF.Evgeniy Stepanov1-2/+1
This change restores pre-r301225 behavior, where linker GC compatible global instrumentation was used on COFF targets disregarding -f(no-)data-sections and/or /Gw flags. This instrumentation puts each global in a COMDAT with an ASan descriptor for that global. It effectively enables -fdata-sections, but limits it to ASan-instrumented globals. llvm-svn: 301374
2017-04-24[asan] Disable ASan global-GC depending on the target and compiler flags.Evgeniy Stepanov1-6/+30
llvm-svn: 301225
2017-04-21Move Split DWARF handling to an MC option/command line argument rather than ↵David Blaikie1-0/+2
using metadata Since Split DWARF needs to name the actual .dwo file that is generated, it can't be known at the time the llvm::Module is produced as it may be merged with other Modules before the object is generated and that object may be generated with any name. By passing the Split DWARF file name when LLVM is producing object code the .dwo file name in the object file can match correctly. The support for Split DWARF for implicit modules remains the same - using metadata to store the dwo name and dwo id so that potentially multiple skeleton CUs referring to different dwo files can be generated from one llvm::Module. llvm-svn: 301063
2017-04-20Don't pass FPOpFusion::Strict to the backendAdam Nemet1-1/+3
This restores the behavior prior to D31167 where the code-gen default was FPC_On which mapped to FPOpFusion::Standard. After merging the FE state (on/off) and the code-gen state (on/fast/off), the default became off to match the front-end. In other words, the front-end controls when to fuse along the language standards and the backend shouldn't override this by splitting fused intrinsics as FPOpFusion::Strict would imply. Differential Revision: https://reviews.llvm.org/D32301 llvm-svn: 300858
2017-04-19Parse backend options during thinlto backend compile actionsDavid Blaikie1-6/+5
llvm-svn: 300741
2017-04-01[Driver] Don't crash on invalid values of -mrelocation-model=.Davide Italiano1-1/+2
This is handled in a similar way we handle invalid -mcode-model. PR: 31840 llvm-svn: 299315
2017-03-31[ThinLTO] Handle -emit-llvm* in ThinLTO backendsTeresa Johnson1-1/+22
Summary: Use PreCodeGenModuleHook to invoke the correct writer when emitting LLVM IR, returning false to skip codegen from within thinBackend. Reviewers: pcc, mehdi_amini Subscribers: Prazek, cfe-commits Differential Revision: https://reviews.llvm.org/D31534 llvm-svn: 299274
2017-03-31[ThinLTO] Set up lto::Config properly for codegen in ThinLTO backendsTeresa Johnson1-125/+153
Summary: This involved refactoring out pieces of EmitAssemblyHelper::CreateTargetMachine for use in runThinLTOBackend. Subsumes D31114. Reviewers: mehdi_amini, pcc Subscribers: Prazek, cfe-commits Differential Revision: https://reviews.llvm.org/D31508 llvm-svn: 299152
2017-03-29Use FPContractModeKind universallyAdam Nemet1-4/+4
FPContractModeKind is the codegen option flag which is already ternary (off, on, fast). This makes it universally the type for the contractable info across the front-end: * In FPOptions (i.e. in the Sema + in the expression nodes). * In LangOpts::DefaultFPContractMode which is the option that initializes FPOptions in the Sema. Another way to look at this change is that before fp-contractable on/off were the only states handled to the front-end: * For "on", FMA folding was performed by the front-end * For "fast", we simply forwarded the flag to TargetOptions to handle it in LLVM Now off/on/fast are all exposed because for fast we will generate fast-math-flags during CodeGen. This is toward moving fp-contraction=fast from an LLVM TargetOption to a FastMathFlag in order to fix PR25721. --- This is a recommit of r299027 with an adjustment to the test CodeGenCUDA/fp-contract.cu. The test assumed that even though -ffp-contract=on is passed FE-based folding of FMA won't happen. This is obviously wrong since the user is asking for this explicitly with the option. CUDA is different that -ffp-contract=fast is on by default. The test used to "work" because contract=fast and contract=on were maintained separately and we didn't fold in the FE because contract=fast was on due to the target-default. This patch consolidates the contract=on/fast/off state into a ternary state hence the change in behavior. --- Differential Revision: https://reviews.llvm.org/D31167 llvm-svn: 299033
2017-03-29Revert "Use FPContractModeKind universally"Adam Nemet1-4/+4
This reverts commit r299027. It's causing a test failure in clang's CodeGenCUDE/fp-contract.cu llvm-svn: 299029
2017-03-29Use FPContractModeKind universallyAdam Nemet1-4/+4
FPContractModeKind is the codegen option flag which is already ternary (off, on, fast). This makes it universally the type for the contractable info across the front-end: * In FPOptions (i.e. in the Sema + in the expression nodes). * In LangOpts::DefaultFPContractMode which is the option that initializes FPOptions in the Sema. Another way to look at this change is that before fp-contractable on/off were the only states handled to the front-end: * For "on", FMA folding was performed by the front-end * For "fast", we simply forwarded the flag to TargetOptions to handle it in LLVM Now off/on/fast are all exposed because for fast we will generate fast-math-flags during CodeGen. This is toward moving fp-contraction=fast from an LLVM TargetOption to a FastMathFlag in order to fix PR25721. Differential Revision: https://reviews.llvm.org/D31167 llvm-svn: 299027
2017-03-23[ThinLTO] Clang support for emitting minimized bitcode for thin linkTeresa Johnson1-2/+17
Summary: Clang companion patch to LLVM patch D31027, which adds support for emitting minimized bitcode file for use in the thin link step. Add a cc1 option -fthin-link-bitcode=<file> to trigger this behavior. Depends on D31027. Reviewers: mehdi_amini, pcc Subscribers: cfe-commits, Prazek Differential Revision: https://reviews.llvm.org/D31050 llvm-svn: 298639
2017-03-21Apply clang-tidy's performance-unnecessary-value-param to parts of clang.Benjamin Kramer1-1/+1
No functionality change intended. llvm-svn: 298443
2017-03-21Clang change: Do not inline hot callsites for samplepgo in thinlto compile ↵Dehao Chen1-1/+6
phase. Summary: Because SamplePGO passes will be invoked twice in ThinLTO build: once at compile phase, the other at backend. We want to make sure the IR at the 2nd phase matches the hot part in pro file, thus we do not want to inline hot callsites in the first phase. Reviewers: tejohnson, eraman Reviewed By: tejohnson Subscribers: mehdi_amini, cfe-commits, Prazek Differential Revision: https://reviews.llvm.org/D31202 llvm-svn: 298429
2017-03-17Remove setting LessPreciseFPMADOption on the TargetOption as it'sEric Christopher1-1/+0
unused anywhere in llvm. llvm-svn: 298022
2017-02-21Only enable AddDiscriminator pass when -fdebug-info-for-profiling is trueDehao Chen1-2/+4
Summary: AddDiscriminator pass is only useful for sample pgo. This patch restricts AddDiscriminator to -fdebug-info-for-profiling so that it does not introduce unecessary debug size increases for non-sample-pgo builds. Reviewers: dblaikie, aprantl Reviewed By: dblaikie Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30220 llvm-svn: 295764
2017-02-13[PM] Add support for instrumented PGO in the new pass manager (clang-side)Davide Italiano1-2/+22
Differential Revision: https://reviews.llvm.org/D29309 llvm-svn: 294961
2017-02-09[CodeGen] Remove unneeded `private`. NFCI.Davide Italiano1-1/+0
llvm-svn: 294623
2017-02-01Change debug-info-for-profiling from a TargetOption to a function attribute.Dehao Chen1-1/+0
Summary: cfe change for https://reviews.llvm.org/D29203 Reviewers: echristo, dblaikie Reviewed By: dblaikie Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D29205 llvm-svn: 293834
2017-01-26Re-apply r292662, "IRGen: Start using the WriteThinLTOBitcode pass."Peter Collingbourne1-3/+5
The internal build issue has been resolved. llvm-svn: 293231
2017-01-26Use TargetMachine adjustPassManager hookStanislav Mekhanoshin1-6/+1
Differential Revision: https://reviews.llvm.org/D28340 llvm-svn: 293190
2017-01-24IRGen: Factor out function clang::FindThinLTOModule. NFCI.Peter Collingbourne1-21/+21
llvm-svn: 292970
2017-01-23Add LF_ prefix to LibFunc enums in TargetLibraryInfo.David L. Jones1-1/+1
Summary: The LibFunc::Func enum holds enumerators named for libc functions. Unfortunately, there are real situations, including libc implementations, where function names are actually macros (musl uses "#define fopen64 fopen", for example; any other transitively visible macro would have similar effects). Strictly speaking, a conforming C++ Standard Library should provide any such macros as functions instead (via <cstdio>). However, there are some "library" functions which are not part of the standard, and thus not subject to this rule (fopen64, for example). So, in order to be both portable and consistent, the enum should not use the bare function names. The old enum naming used a namespace LibFunc and an enum Func, with bare enumerators. This patch changes LibFunc to be an enum with enumerators prefixed with "LF_". (Unfortunately, a scoped enum is not sufficient to override macros.) These changes are for clang. See https://reviews.llvm.org/D28476 for LLVM. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28477 llvm-svn: 292849
2017-01-23Revert "IRGen: Start using the WriteThinLTOBitcode pass."Martin Bohme1-5/+3
Summary: This reverts commit r292662. This change broke internal builds. Will provide a reproducer internally. Subscribers: pcc, mehdi_amini, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D29025 llvm-svn: 292791
2017-01-20IRGen: Start using the WriteThinLTOBitcode pass.Peter Collingbourne1-3/+5
This is the final change necessary to support CFI with ThinLTO. Differential Revision: https://reviews.llvm.org/D28843 llvm-svn: 292662
2017-01-19Add -fdebug-info-for-profiling to emit more debug info for sample pgo ↵Dehao Chen1-0/+1
profile collection Summary: SamplePGO uses profile with debug info to collect profile. Unlike the traditional debugging purpose, sample pgo needs more accurate debug info to represent the profile. We add -femit-accurate-debug-info for this purpose. It can be combined with all debugging modes (-g, -gmlt, etc). It makes sure that the following pieces of info is always emitted: * start line of all subprograms * linkage name of all subprograms * standalone subprograms (functions that has neither inlined nor been inlined) The impact on speccpu2006 binary size (size increase comparing with -g0 binary, also includes data for -g binary, which does not change with this patch): -gmlt(orig) -gmlt(patched) -g 433.milc 4.68% 5.40% 19.73% 444.namd 8.45% 8.93% 45.99% 447.dealII 97.43% 115.21% 374.89% 450.soplex 27.75% 31.88% 126.04% 453.povray 21.81% 26.16% 92.03% 470.lbm 0.60% 0.67% 1.96% 482.sphinx3 5.77% 6.47% 26.17% 400.perlbench 17.81% 19.43% 73.08% 401.bzip2 3.73% 3.92% 12.18% 403.gcc 31.75% 34.48% 122.75% 429.mcf 0.78% 0.88% 3.89% 445.gobmk 6.08% 7.92% 42.27% 456.hmmer 10.36% 11.25% 35.23% 458.sjeng 5.08% 5.42% 14.36% 462.libquantum 1.71% 1.96% 6.36% 464.h264ref 15.61% 16.56% 43.92% 471.omnetpp 11.93% 15.84% 60.09% 473.astar 3.11% 3.69% 14.18% 483.xalancbmk 56.29% 81.63% 353.22% geomean 15.60% 18.30% 57.81% Debug info size change for -gmlt binary with this patch: 433.milc 13.46% 444.namd 5.35% 447.dealII 18.21% 450.soplex 14.68% 453.povray 19.65% 470.lbm 6.03% 482.sphinx3 11.21% 400.perlbench 8.91% 401.bzip2 4.41% 403.gcc 8.56% 429.mcf 8.24% 445.gobmk 29.47% 456.hmmer 8.19% 458.sjeng 6.05% 462.libquantum 11.23% 464.h264ref 5.93% 471.omnetpp 31.89% 473.astar 16.20% 483.xalancbmk 44.62% geomean 16.83% Reviewers: davidxl, andreadb, rob.lougher, dblaikie, echristo Reviewed By: dblaikie, echristo Subscribers: hfinkel, rob.lougher, andreadb, gbedwell, cfe-commits, probinson, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D25435 llvm-svn: 292458
2017-01-17[WebAssembly] Add minimal support for the new wasm object format triple.Dan Gohman1-0/+2
llvm-svn: 292269
2017-01-13Pass -fprofile-sample-use to lto backends.Dehao Chen1-2/+5
Summary: LTO backend will not invoke SampleProfileLoader pass even if -fprofile-sample-use is specified. This patch passes the flag down so that pass manager can add the SampleProfileLoader pass correctly. Reviewers: mehdi_amini, tejohnson Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28588 llvm-svn: 291870
2017-01-12Revert r291774 which caused buildbot failure.Dehao Chen1-5/+2
llvm-svn: 291775
2017-01-12Pass -fprofile-sample-use to lto backends.Dehao Chen1-2/+5
Summary: LTO backend will not invoke SampleProfileLoader pass even if -fprofile-sample-use is specified. This patch passes the flag down so that pass manager can add the SampleProfileLoader pass correctly. Reviewers: mehdi_amini, tejohnson Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28588 llvm-svn: 291774
2017-01-06[ThinLTO] Optionally ignore empty index fileTeresa Johnson1-16/+21
Summary: In order to simplify distributed build system integration, where actions may be scheduled before the Thin Link which determines the list of objects selected by the linker. The gold plugin currently will emit 0-sized index files for objects not selected by the link, to enable checking for expected output files by the build system. If the build system then schedules a backend action for these bitcode files, we want to be able to fall back to normal compilation instead of failing. Fallback is enabled under an option in LLVM (D28410), in which case a nullptr is returned from llvm::getModuleSummaryIndexForFile. Clang can just proceed with non-ThinLTO compilation in that case. I am investigating whether this can be addressed in our build system, but that is a longer term fix and so this enables a workaround in the meantime. Reviewers: mehdi_amini Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28362 llvm-svn: 291303
2017-01-06Add a cc1 option to force disabling lifetime-markers emission from clangMehdi Amini1-1/+2
Summary: This intended as a debugging/development flag only. Differential Revision: https://reviews.llvm.org/D28385 llvm-svn: 291300