- Feb 02, 2022
-
-
Jeremy Morse authored
In certain circumstances with things like autogenerated code and asan, you can end up with thousands of Values live at the same time, causing a large working set and a lot of information spilled to the stack. Unfortunately InstrRefBasedLDV doesn't cope well with this and consumes a lot of memory when there are many many stack slots. See the reproducer in D116821. It seems very unlikely that a developer would be able to reason about hundreds of live named local variables at the same time, so a huge working set and many stack slots is an indicator that we're likely analysing autogenerated or instrumented code. In those cases: gracefully degrade by setting an upper bound on the amount of stack slots to track. This limits peak memory consumption, at the cost of dropping some variable locations, but in a rare scenario where it's unlikely someone is actually going to use them. In terms of the patch, this adds a cl::opt for max number of stack slots to track, and has the stack-slot-numbering code optionally return None. That then filters through a number of code paths, which can then chose to not track a spill / restore if it touches an untracked spill slot. The added test checks that we drop variable locations that are on the stack, if we set the limit to zero. Differential Revision: https://reviews.llvm.org/D118601
-
Matt Morehouse authored
Fixes a compile error when the `clang::musttail` attribute is used. Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D118712
-
Chris Bieneman authored
These test cases all rely on a default target being specified. Adding the requirement gets the tests properly skipped when LLVM_DEFAULT_TARGET_TRIPLE is unset.
-
Shubham Sandeep Rastogi authored
Change namespace llvm::swift to namespace llvm::binaryformat because of clashes with the apple/llvm-project repository The namespace llvm::swift is causing errors to pop up in the apple/llvm-project build when cherry-picking 4ce1f3d4 into apple/llvm-project Differential Review: https://reviews.llvm.org/D118716
-
Chris Bieneman authored
llvm-as does everything this test requires, but doesn't depend on a target being registered. This gets the test passing when LLVM_DEFAUL_TARGET_TRIPLE is unset.
-
Anna Thomas authored
We have an instCombine rule to remove identical consecutive fences. We can extend this to remove weaker fences when we have consecutive stronger fence. As stated in the LangRef, a fence with a stronger ordering also implies ordering weaker than itself: "A fence which has seq_cst ordering, in addition to having both acquire and release semantics specified above, participates in the global program order of other seq_cst operations and/or fences." Reviewed-By: reames Differential Revision: https://reviews.llvm.org/D118607
-
Jeremy Morse authored
When finding locations for variable values at the start of a block, we build a large map of every value to every location, and then pick out the locations for values that are desired. This takes up quite a lot of time, because, unsurprisingly, there are usually more values in registers and stack slots than there are variables. This patch instead creates a map of desired values to their locations, which are initially illegal locations. Then, as we examine every available value, we can select locations for values we care about, and ignore those that we don't. This substantially reduces the amount of work done (i.e., building a map up of values to locations that nothing wants or needs). Geomean performance improvement of 1% on CTMark, woo. Differential Revision: https://reviews.llvm.org/D118597
-
Joseph Huber authored
This patch adds a function attribute to the kernel function generated in OpenMP offloading. We already create a `nvvm.annotations` metadata node indicating the kernels present in the program. However, this created some indirection when trying to identify if a specific function was an entry. We add a single function attribute for each function now to simplify this. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D118708
-
Jez Ng authored
Added some comments (particularly around finalize() and finalizeContents()) as well as doing some rephrasing / grammar fixes for existing comments. Also did some minor style fixups, such as by putting methods together in a class definition and having fields of similar types next to each other. Reviewed By: #lld-macho, oontvoo Differential Revision: https://reviews.llvm.org/D118714
-
Tanya Lattner authored
-
Fangrui Song authored
Generalize D99629 for ELF. A default visibility non-local symbol is preemptible in a -shared link. `isInterposable` is an insufficient condition. Moreover, a non-preemptible alias may be referenced in a sub constant expression which intends to lower to a PC-relative relocation. Replacing the alias with a preemptible aliasee may introduce a linker error. Respect dso_preemptable and suppress optimization to fix the abose issues. With the change, `alias = 345` will not be rewritten to use aliasee in a `-fpic` compile. ``` int aliasee; extern int alias __attribute__((alias("aliasee"), visibility("hidden"))); void foo() { alias = 345; } // intended to access the local copy ``` While here, refine the condition for the alias as well. For some binary formats like COFF, `isInterposable` is a sufficient condition. But I think canonicalization for the changed case has little advantage, so I don't bother to add the `Triple(M.getTargetTriple()).isOSBinFormatELF()` or `getPICLevel/getPIELevel` complexity. For instrumentations, it's recommended not to create aliases that refer to globals that have a weak linkage or is preemptible. However, the following is supported and the IR needs to handle such cases. ``` int aliasee __attribute__((weak)); extern int alias __attribute__((alias("aliasee"))); ``` There are other places where GlobalAlias isInterposable usage may need to be fixed. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D107249 -
Mahesh Ravishankar authored
Reviewed By: gysit Differential Revision: https://reviews.llvm.org/D118576
-
Chris Bieneman authored
If you don't include a target that directly references CFGuard it doesn't get built into opt or the llvm library build, which causes some test cases to fail. Including this in opt explicitly resolve those issues.
-
Fangrui Song authored
-
Fangrui Song authored
See the updated insert-before.test for the effects: many synthetic sections are SHF_ALLOC|SHF_WRITE. If they are discarded, we don't want to propagate their flags to subsequent output section descriptions. `getFirstInputSection(sec) == nullptr` can technically be merged into `isDiscardable` but I'd like to postpone that as not sharing code may give more refactoring opportunity. Depends on D118529. Reviewed By: peter.smith, bluca Differential Revision: https://reviews.llvm.org/D118530
-
Fangrui Song authored
adjustSectionsBeforeSorting updates some output section attributes (alignment/flags) and removes discardable empty sections. When it is called, INSERT commands have not been processed. Therefore the flags propagation rule may not affect output sections defined in an INSERT command properly. Fix this by moving processInsertCommands before adjustSectionsBeforeSorting. adjustSectionsBeforeSorting is somewhat misnamed. The order between it and sortInputSections does not matter. With the pass shuffle, the name of adjustSectionsBeforeSorting becomes wrong. Therefore rename it. The new name is not set into stone. The function mixes several tasks and the code may be refactored in a way that we may give them more meaningful names. With this patch, I think the behavior of attribute propagation becomes more reasonable. In particular, in the absence of non-INSERT SECTIONS, inserting a section after a SHF_ALLOC one will give us a SHF_ALLOC section, not a non-SHF_ALLOC one (see linkerscript/insert-after.test). Reviewed By: peter.smith, bluca Differential Revision: https://reviews.llvm.org/D118529
-
David Green authored
-
Fangrui Song authored
The deduplication requires a DenseMap of the same size of the local part of .strtab . I optimized it in e2054454 but it is still quite slow. For Release build of clang, deduplication makes .strtab 1.1% smaller and makes the link 3% slower. For chrome, deduplication makes .strtab 0.1% smaller and makes the link 6% slower. I suggest that we only perform the optimization with -O2 (default is -O1). Not deduplicating local symbol names will simplify parallel symbol table write. Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D118577
-
Fangrui Song authored
In binutils, ar -s and randlib don't convert a thin archive to a regular one. This behavior makes sense and this patch ports the behavior. Reviewed By: gbreynoo Differential Revision: https://reviews.llvm.org/D117443
-
Fangrui Song authored
In GNU ar (since 2008), the modifier 'T' means creating a thin archive. In many other ar implementations (FreeBSD, macOS, elfutils, etc), -T means "allow filename truncation of extracted files", as specified by X/Open System Interface. For portability, 'T' with thin archive semantics should be avoided. See https://sourceware.org/bugzilla/show_bug.cgi?id=28759 binutils 2.38 will deprecate 'T' (without diagnostic) and add --thin. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D116979
-
Alexey Bataev authored
Added support for alternate ops vectorization of the cmp instructions. It allows to vectorize either cmp instructions with same/swapped predicate but different (swapped) operands kinds or cmp instructions with different predicates and compatible operands kinds. Differential Revision: https://reviews.llvm.org/D115955
-
Fangrui Song authored
-
Krzysztof Parzyszek authored
This fixes https://github.com/llvm/llvm-project/issues/52636.
-
Josh Mottley authored
This patch adds partial lowering of the "EXIT" intrinsic to the backend runtime hook implemented in patch D110741. It also adds a helper function to the `RuntimeCallTestBase.h` for testing for an intrinsic function call in a `mlir::Block`. Differential Revision: https://reviews.llvm.org/D118141
-
Fangrui Song authored
Replace `f<ELFT>(x)` with `InvokeELFT(f, x)`. The size reduction comes from turning `link` from 4 specializations into 1. My x86-64 lld executable is 26KiB smaller. Reviewed By: ikudrin Differential Revision: https://reviews.llvm.org/D118551
-
Jonas Paulsson authored
Make the check for a complete SchedModel work as expected: report any supported instruction not having scheduler info. For unclear reasons there was a variable 'HadCompleteModel' that caused e.g. new instructions for a new subtarget not to be reported. This variable is now simply removed as all in-tree targets seem to build fine without it. Review: Simon Pilgrim Differential Revision: https://reviews.llvm.org/D118628
-
Alexey Bataev authored
with same/swapped predicate.
-
Alexander Belyaev authored
This reverts commit 25bf6a2a.
-
Nikolas Klauser authored
With this patch there should be no more namespaces without closing comment Reviewed By: ldionne, Quuxplusone, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D118668
-
Peter Steinfeld authored
As per Steve Scalpone's suggestion, I've renamed the runtime routine to better evoke its purpose. I implemented a routine called "Crash" and added a test. Differential Revision: https://reviews.llvm.org/D118703
-
Steven Wan authored
These tests emit unexpected diagnostics on AIX because the byval alignment warning is emitted too aggressively. https://reviews.llvm.org/D118350 is supposed to provide a proper fix to the problem, but for the time being disable the tests to unblock. Differential Revision: https://reviews.llvm.org/D118670
-
Alex Zinenko authored
When attempting to cast a pybind11 handle to an MLIR C API object through capsules, the binding code would attempt to directly access the "_CAPIPtr" attribute on the object, leading to a rather obscure AttributeError when the attribute was missing, e.g., on non-MLIR types. Check for its presence and throw a TypeError instead. Depends On D117646 Reviewed By: stellaraccident Differential Revision: https://reviews.llvm.org/D117658
-
Jake Egan authored
DWARF64 was implemented at version 3, so if a DWARF version less than 3 is specified, DWARF64 does not get selected. Since XCOFF64 requires DWARF64, the modified tests fail on 64-bit AIX. This patch bumps these tests to dwarf version 3 to maintain test coverage on 64-bit AIX. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D114110
-
Olle Fredriksson authored
We tracked down some non-determinism in compilation output to the DFAJumpThreading pass. These changes fixed our issue: * Make the DefMap type a MapVector to make its iteration order depend on insertion order. * Sort the values to be inserted into NewDefs by instruction order to make the insertion order deterministic. Since these values come from iterating over a ValueMap, which doesn't have deterministic iteration order, I couldn't fix this at its source. Reviewed By: alexey.zhikhar Differential Revision: https://reviews.llvm.org/D118590
-
- Feb 01, 2022
-
-
Mircea Trofin authored
This is leftover from the advisor refactoring. Straight-forward copy and paste.
-
Craig Topper authored
-
Craig Topper authored
The first phase of the analysis can avoid a vsetvli if an earlier instruction in the block used an SEW and LMUL that when combined with the EEW of the load/store would produce the desired EMUL. If we avoided a vsetvli this will affect the global analysis we do in the second phase. The third phase where we really insert the vsetvlis needs to agree with the first phase. If it doesn't we can insert vsetvlis that invalidate the global analysis. In the test case there is a VSETVLI in the preheader that sets SEW=64 and LMUL=1. Inside the loop there is a VADD with SEW=64 and LMUL=1. This VADD is followed by a store that wants wants SEW=32 LMUL=1/2. Because it has EEW=32 as part of the opcode the SEW=64 LMUL=1 from the VADD can be become EMUL=1 for the store. So the first phase determines no vsetvli is needed. The third phase manages CurInfo differently than BBInfo.Change from the first phase. CurInfo is only updated when we see a vsetvli or insert a vsetvli. This was done to allow predecessor block information from the global analysis to be applied to multiple instructions. Since the loop body has no vsetvli we won't update CurInfo for either the VADD or the VSE. This prevented us from checking the store vsetvli elision for the VSE resulting in a vsetvli SEW=32 LMUL=1/2 being emitted which invalidated the global analysis. To mitigate this, I've added a BBLocalInfo variable that more closely matches the first phase propagation. This gets updated based on the VADD and prevents emitting a vsetvli for the store like we did in the first phase. I wonder if we should do an earlier phase to handle the load/store case by adding more pseudo opcodes and changing the SEW/LMUL for those instructions before the insertion analysis. That might be more robust than trying to guarantee two phases make the same decision. Fixes the test from D118629. Reviewed By: frasercrmck Differential Revision: https://reviews.llvm.org/D118667
-
Stanislav Gatev authored
Make specializations of `DataflowAnalysis` extendable with domain-specific logic for comparing distinct values when comparing environments. This includes a breaking change to the `runDataflowAnalysis` interface as the return type is now `llvm::Expected<...>`. This is part of the implementation of the dataflow analysis framework. See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev. Reviewed-by: ymandel, xazax.hun Differential Revision: https://reviews.llvm.org/D118596
-
Craig Topper authored
This should not be an error. V is a valid implementation of Zve. Spec clarified here https://github.com/riscv/riscv-v-spec/commit/9a877e8553362ff03a9b22b98e321b59aff50398 Differential Revision: https://reviews.llvm.org/D118679
-
Sam McCall authored
-