summaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
AgeCommit message (Collapse)Author
2025-06-06Avoid Assertion Failure Using -fcs-profile-generate with distributed ↵Nuri Amari
thin-lto (#129736) When using `-fcs-generate-profile` with distributed thin-lto in the same fashion we do for local thin-lto, we hit the following assertion: https://github.com/llvm/llvm-project/blob/6041c745f32e8fd60ed24e29e7d919d8d1c87ca6/llvm/lib/Support/PGOOptions.cpp#L36 Using local thin-lto with LLD for MachO, we set the missing path automatically to a default value: https://reviews.llvm.org/D151589. In this fix we add the same behavior. --------- Co-authored-by: Nuri Amari <nuriamari@fb.com>
2024-05-05[test] %clang_cc1: remove redundant actionsFangrui Song
ParseFrontendArgs takes the last OPT_Action_Group option. The other actions are overridden.
2024-04-10[ThinLTO]Record import type in GlobalValueSummary::GVFlags (#87597)Mingming Liu
The motivating use case is to support import the function declaration across modules to construct call graph edges for indirect calls [1] when importing the function definition costs too much compile time (e.g., the function is too large has no `noinline` attribute). 1. Currently, when the compiled IR module doesn't have a function definition but its postlink combined summary contains the function summary or a global alias summary with this function as aliasee, the function definition will be imported from source module by IRMover. The implementation is in FunctionImporter::importFunctions [2] 2. In order for FunctionImporter to import a declaration of a function, both function summary and alias summary need to carry the def / decl state. Specifically, all existing summary fields doesn't differ across import modules, but the def / decl state of is decided by `<ImportModule, Function>`. This change encodes the def/decl state in `GlobalValueSummary::GVFlags`. In the subsequent changes 1. The indexing step `computeImportForModule` [3] will compute the set of definitions and the set of declarations for each module, and passing on the information to bitcode writer. 2. Bitcode writer will look up the def/decl state and sets the state when it writes out the flag value. This is demonstrated in https://github.com/llvm/llvm-project/pull/87600 3. Function importer will read the def/decl state when reading the combined summary to figure out two sets of global values, and IRMover will be updated to import the declaration (aka linkGlobalValuePrototype [4]) into the destination module. - The next change is https://github.com/llvm/llvm-project/pull/87600 [1] mentioned in rfc https://discourse.llvm.org/t/rfc-for-better-call-graph-sort-build-a-more-complete-call-graph-by-adding-more-indirect-call-edges/74029#support-cross-module-function-declaration-import-5 [2] https://github.com/llvm/llvm-project/blob/3b337242ee165554f0017b00671381ec5b1ba855/llvm/lib/Transforms/IPO/FunctionImport.cpp#L1608-L1764 [3] https://github.com/llvm/llvm-project/blob/3b337242ee165554f0017b00671381ec5b1ba855/llvm/lib/Transforms/IPO/FunctionImport.cpp#L856 [4] https://github.com/llvm/llvm-project/blob/3b337242ee165554f0017b00671381ec5b1ba855/llvm/lib/Linker/IRMover.cpp#L605
2022-11-07Explicitly initialize opaque pointer mode in CodeGenActionMatthias Braun
Explicitly call `LLVMContext::setOpaquePointers` in `CodeGenAction` before loading any IR files. With this we use the mode specified on the command-line rather than lazily initializing it based on the contents of the IR. This helps when using `-fthinlto-index` which may end up mixing files with typed and opaque pointer types which fails when the first file happened to use typed pointers since we cannot downgrade IR with opaque pointer types to typed pointer types. Differential Revision: https://reviews.llvm.org/D137475
2022-07-20[test] Remove unnecessary -verify-machineinstrs=0Arthur Eubanks
Issue #38784 seems to be fixed and removing these doesn't cause any issues.
2021-12-14[LTO] Ignore unreachable virtual functions in WPD in hybrid LTO.Mingming Liu
Differential Revision: https://reviews.llvm.org/D115492
2021-09-27[ThinLTO] Add noRecurse and noUnwind thinlink function attribute propagationmodimo
Thinlink provides an opportunity to propagate function attributes across modules, enabling additional propagation opportunities. This change propagates (currently default off, turn on with `disable-thinlto-funcattrs=1`) noRecurse and noUnwind based off of function summaries of the prevailing functions in bottom-up call-graph order. Testing on clang self-build: 1. There's a 35-40% increase in noUnwind functions due to the additional propagation opportunities. 2. Throughput is measured at 10-15% increase in thinlink time which itself is 1.5% of E2E link time. Implementation-wise this adds the following summary function attributes: 1. noUnwind: function is noUnwind 2. mayThrow: function contains a non-call instruction that `Instruction::mayThrow` returns true on (e.g. windows SEH instructions) 3. hasUnknownCall: function contains calls that don't make it into the summary call-graph thus should not be propagated from (e.g. indirect for now, could add no-opt functions as well) Testing: Clang self-build passes and 2nd stage build passes check-all ninja check-all with newly added tests passing Reviewed By: tejohnson Differential Revision: https://reviews.llvm.org/D36850
2021-01-27[test] Fix clang/test/CodeGen testsFangrui Song
2020-11-24[ThinLTO/WPD] Enable -wholeprogramdevirt-skip in ThinLTO backendsTeresa Johnson
Previously this option could be used to skip devirtualizations of the given functions in regular LTO and in the ThinLTO indexing step. This change allows them to be skipped in the backend as well, which is useful when debugging WPD in a distributed ThinLTO backend. Differential Revision: https://reviews.llvm.org/D91812
2020-07-04[clang] Fix two tests that are affected by llvm opt changeRoman Lebedev
2020-01-27Restore "[LTO/WPD] Enable aggressive WPD under LTO option"Teresa Johnson
This restores 59733525d37cf9ad88b5021b33ecdbaf2e18911c (D71913), along with bot fix 19c76989bb505c3117730c47df85fd3800ea2767. The bot failure should be fixed by D73418, committed as af954e441a5170a75687699d91d85e0692929d43. I also added a fix for non-x86 bot failures by requiring x86 in new test lld/test/ELF/lto/devirt_vcall_vis_public.ll.
2020-01-23Revert "[LTO/WPD] Enable aggressive WPD under LTO option"Teresa Johnson
This reverts commit 59733525d37cf9ad88b5021b33ecdbaf2e18911c. There is a windows sanitizer bot failure in one of the cfi tests that I will need some time to figure out: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/57155/steps/stage%201%20check/logs/stdio
2020-01-23[LTO/WPD] Enable aggressive WPD under LTO optionTeresa Johnson
Summary: Third part in series to support Safe Whole Program Devirtualization Enablement, see RFC here: http://lists.llvm.org/pipermail/llvm-dev/2019-December/137543.html This patch adds type test metadata under -fwhole-program-vtables, even for classes without hidden visibility. It then changes WPD to skip devirtualization for a virtual function call when any of the compatible vtables has public vcall visibility. Additionally, internal LLVM options as well as lld and gold-plugin options are added which enable upgrading all public vcall visibility to linkage unit (hidden) visibility during LTO. This enables the more aggressive WPD to kick in based on LTO time knowledge of the visibility guarantees. Support was added to all flavors of LTO WPD (regular, hybrid and index-only), and to both the new and old LTO APIs. Unfortunately it was not simple to split the first and second parts of this part of the change (the unconditional emission of type tests and the upgrading of the vcall visiblity) as I needed a way to upgrade the public visibility on legacy WPD llvm assembly tests that don't include linkage unit vcall visibility specifiers, to avoid a lot of test churn. I also added a mechanism to LowerTypeTests that allows dropping type test assume sequences we now aggressively insert when we invoke distributed ThinLTO backends with null indexes, which is used in testing mode, and which doesn't invoke the normal ThinLTO backend pipeline. Depends on D71907 and D71911. Reviewers: pcc, evgeny777, steven_wu, espindola Subscribers: emaste, Prazek, inglorion, arichardson, hiraditya, MaskRay, dexonsmith, dang, davidxl, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D71913
2019-09-10Reland "Change the X86 datalayout to add three address spacesAmy Huang
for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568
2019-08-28Revert "Change the X86 datalayout to add three address spaces for 32 bit ↵Vlad Tsyrklevich
signed," This reverts commit r370083 because it caused check-lld failures on sanitizer-x86_64-linux-fast. llvm-svn: 370142
2019-08-27Change the X86 datalayout to add three address spaces for 32 bit signed,Amy Huang
32 bit unsigned, and 64 bit pointers. llvm-svn: 370083
2019-05-10[ThinLTO] Clang test changes for new CanAutoHide flagTeresa Johnson
llvm-svn: 360468
2019-04-23[ThinLTO] Pass down opt level to LTO backend and handle -O0 LTO in new PMTeresa Johnson
Summary: The opt level was not being passed down to the ThinLTO backend when invoked via clang (for distributed ThinLTO). This exposed an issue where the new PM was asserting if the Thin or regular LTO backend pipelines were invoked with -O0 (not a new issue, could be provoked by invoking in-process *LTO backends via linker using new PM and -O0). Fix this similar to the old PM where -O0 only does the necessary lowering of type metadata (WPD and LowerTypeTest passes) and then quits, rather than asserting. Reviewers: xur Subscribers: mehdi_amini, inglorion, eraman, hiraditya, steven_wu, dexonsmith, cfe-commits, llvm-commits, pcc Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D61022 llvm-svn: 359025
2019-01-11[LTO] Add option to enable LTOUnit splitting, and disable unless neededTeresa Johnson
Summary: Adds a new -f[no]split-lto-unit flag that is disabled by default to control module splitting during ThinLTO. It is automatically enabled for -fsanitize=cfi and -fwhole-program-vtables. The new EnableSplitLTOUnit codegen flag is passed down to llvm via a new module flag of the same name. Depends on D53890. Reviewers: pcc Subscribers: ormris, mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D53891 llvm-svn: 350949
2018-10-30[CodeGen] Disable the machine verifier on a ThinLTO testFrancis Visoiu Mistrih
This allows us to turn the machine verifier on by default on X86. llvm-svn: 345591
2018-06-26[ThinLTO] Add testing of summary index parsing to a couple CFI testsTeresa Johnson
Summary: Changes to some clang side tests to go with the summary parsing patch. Depends on D47905. Reviewers: pcc, dexonsmith, mehdi_amini Subscribers: inglorion, eraman, cfe-commits, steven_wu Differential Revision: https://reviews.llvm.org/D47906 llvm-svn: 335618
2018-06-04[ThinLTO] Add testing of new summary index format to a couple CFI testsTeresa Johnson
Summary: Adds testing of combined index summary entries in disassembly format to CFI tests that were already testing the bitcode format. Depends on D46699. Reviewers: pcc Subscribers: mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D46700 llvm-svn: 333966
2018-03-09Fix Clang test case.Peter Collingbourne
llvm-svn: 327166
2018-02-14Moved CHECK in test closer to source codeVitaly Buka
llvm-svn: 325184
2018-02-14[ThinLTO/CFI] Include TYPE_ID summaries into GLOBALVAL_SUMMARY_BLOCKVitaly Buka
Summary: TypeID summaries are used by CFI and need to be serialized by ThinLTO indexing for later use by LTO Backend. Reviewers: tejohnson, pcc Subscribers: mehdi_amini, inglorion, eraman, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D42611 llvm-svn: 325182