aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-09-09[clang] WIP: Improved Context Declaration trackingusers/mizvekov/clang-fix-lambda-contextMatheus Izvekov80-989/+1600
This patch aims to improve how parenting relationships are represented in the AST. Currently regular declarations can only be children of special AST nodes which inherit from DeclContext, except for a few special cases which are required by itanium mangling. Having this parenting relationship well described helps in tracking which entities are dependent, and an improvement here would allow us to drop a lot of workarounds and to get some difficult cases right. This patch extends the ContextDecl tracking which currently is used for mangling, in order to cover almost needed cases. Template type aliases represent a specially difficult case which is addressed by this patch. They can be contexts for other declarations, but besides not being DeclContexts, they also lack a declaration which represents their specialization. This patch addresses the type alias context problem by storing the specialization arguments along with the ContextDecl for entities declared in their context. TODO: * Move away from using ExpressionEvaluationContexts, and use the same stack used for tracking the CurContext. Remove the separate ContextDecl field, and have that functionally built in to the base Decl class, so that we don't separatelly treack both a parent Decl and a parent DeclContext. * A function type has ParmVarDecls, and these can appear inside aliases and template type aliases in particular, so a ParmvarDecl needs a ContextDecl too.
2024-09-08[MC] Make MCRegisterInfo::getLLVMRegNum return std::optional<MCRegister>. ↵Craig Topper9-17/+17
NFC (#107776)
2024-09-08[RISCV] Fix crashes with Zfhmin+Zfa.Craig Topper2-5/+101
We were incorrectly making ISD::FMAXIMUM, ISD::FMINIMUM, and ISD::FNEARBYINT legal with Zfhmin+Zfa when we really need Zfh+Zfa.
2024-09-09[LLVM]Fix symbol visibility macros not being define for AIX (#107705)Thomas Fransham1-1/+1
This is to try and fix buildbot failure on [clang-ppc64-aix](https://lab.llvm.org/buildbot/#/builders/64/builds/881) from my changes in #96630. I don't really know much about AIX so it would be good to have someone more knowledgeable to say if visibility macros on extern templates is needed on AIX similar to ELF. @compnerd @tstellar
2024-09-09[C++20] [Modules] Treat constexpr/consteval member function as implicitly inlineChuanqi Xu2-0/+13
Close https://github.com/llvm/llvm-project/issues/107673
2024-09-09[gn build] Port fef84c56dcd9LLVM GN Syncbot1-0/+1
2024-09-09[RISCV] Support the large code model. (#70308)Jim Lin10-2/+1774
Implement large code model for GlobalAddressSDNode and ExternalSymbolSDNode. See discussion on https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/388. --------- Co-authored-by: Kuan-Lin Chen <rufus@andestech.com>
2024-09-09[mlir] 'dyn_cast' is deprecated: Use mlir::dyn_cast<U>() instead (NFC)Jie Fu1-1/+1
/llvm-project/mlir/lib/Dialect/Vector/IR/VectorOps.cpp:2923:29: error: 'dyn_cast' is deprecated: Use mlir::dyn_cast<U>() instead [-Werror,-Wdeprecated-declarations] 2923 | if (auto intAttr = attr.dyn_cast<IntegerAttr>()) { | ^ /llvm-project/mlir/include/mlir/IR/Attributes.h:184:14: note: 'dyn_cast' has been explicitly marked deprecated here 184 | U Attribute::dyn_cast() const { | ^
2024-09-08[libc] Add proxy header for the jmp_buf type (#107712)wldfngrs18-33/+57
Added proxy header for the jmp_buf type and changed all use instances from __jmp_buf * to the typedef alias jmp_buf , fixed the link to LLVM in stack_t.h description
2024-09-08Revert "[NFCI][LTO][lld] Optimize away symbol copies within LTO global ↵Mingming Liu5-52/+6
resolution in ELF" (#107788) Reverts llvm/llvm-project#106193 while investigating bot failures https://lab.llvm.org/buildbot/#/builders/169/builds/2989/steps/9/logs/stdio
2024-09-09[mlir] Fix crash in `InsertOpConstantFolder` when vector.insert operand is ↵Rajveer Singh Bharadwaj2-4/+35
from a llvm.mlir.constant op (#88314) In cases where llvm.mlir.constant has an attribute with a different type than the returned type, the folder use to create an incorrect DenseElementsAttr and crash. Resolves #74236
2024-09-08[NFCI][LTO][lld] Optimize away symbol copies within LTO global resolution in ↵Mingming Liu5-6/+52
ELF (#106193) `StringMap<T>` creates a [copy of the string](https://github.com/llvm/llvm-project/blob/d4c519e7b2ac21350ec08b23eda44bf4a2d3c974/llvm/include/llvm/ADT/StringMapEntry.h#L55-L58) for entry insertions and intentionally keep copies [since the implementation optimizes string memory usage](https://github.com/llvm/llvm-project/blob/d4c519e7b2ac21350ec08b23eda44bf4a2d3c974/llvm/include/llvm/ADT/StringMap.h#L124). On the other hand, linker keeps copies of symbol names [1] in `lld::elf::parseFiles` [2] before invoking `compileBitcodeFiles` [3]. This change proposes to optimize away string copies inside [LTO::GlobalResolutions](https://github.com/llvm/llvm-project/blob/24e791b4164986a1ca7776e3ae0292ef20d20c47/llvm/include/llvm/LTO/LTO.h#L409), which will make LTO indexing more memory efficient for ELF. There are similar opportunities for other (COFF, wasm, MachO) formats. The optimization takes place for lld (ELF) only. For the rest of use cases (gold plugin, `llvm-lto2`, etc), LTO owns a string saver to keep copies and use global resolution key for de-duplication. Together with @kazutakahirata's work to make `ComputeCrossModuleImport` more memory efficient, we see a ~20% peak memory usage reduction in a binary where peak memory usage needs to go down. Thanks to the optimization in https://github.com/llvm/llvm-project/commit/329ba523ccbbe68a12434926c92fd9a86494d958, the max (as opposed to the sum) of `ComputeCrossModuleImport` or `GlobalResolution` shows up in peak memory usage. * Regarding correctness, the set of [resolved](https://github.com/llvm/llvm-project/blob/80c47ad3aec9d7f22e1b1bdc88960a91b66f89f1/llvm/lib/LTO/LTO.cpp#L739) [per-module symbols](https://github.com/llvm/llvm-project/blob/80c47ad3aec9d7f22e1b1bdc88960a91b66f89f1/llvm/include/llvm/LTO/LTO.h#L188-L191) is a subset of [llvm::lto::InputFile::Symbols](https://github.com/llvm/llvm-project/blob/80c47ad3aec9d7f22e1b1bdc88960a91b66f89f1/llvm/include/llvm/LTO/LTO.h#L120). And bitcode symbol parsing saves symbol name when iterating `obj->symbols` in `BitcodeFile::parse` already. This change updates `BitcodeFile::parseLazy` to keep copies of per-module undefined symbols. * Presumably the undefined symbols in a LTO unit (copied in this patch in linker unique saver) is a small set compared with the set of symbols in global-resolution (copied before this patch), making this a worthwhile trade-off. Benchmarking this change alone shows measurable memory savings across various benchmarks. [1] ELF https://github.com/llvm/llvm-project/blob/1cea5c2138bef3d8fec75508df6dbb858e6e3560/lld/ELF/InputFiles.cpp#L1748 [2] https://github.com/llvm/llvm-project/blob/ef7b18a53c0d186dcda1e322be6035407fdedb55/lld/ELF/Driver.cpp#L2863 [3] https://github.com/llvm/llvm-project/blob/ef7b18a53c0d186dcda1e322be6035407fdedb55/lld/ELF/Driver.cpp#L2995
2024-09-08[SandboxIR][Bench] Fix missing includeJustin Bogner1-0/+1
In 362da640dd18 "[SandboxIR][Bench] Test RAUW (#107440)" we started using std::stringstream, but didn't include `<sstream>` for the definition. This is resulting in a build failure on windows.
2024-09-08[TableGen] Migrate CTags/DFA/Directive Emitters to const RecordKeeper (#107693)Rahul Joshi4-47/+47
Migrate CTags/DFA/Directive Emitters to const RecordKeeper.
2024-09-08[NFC][TableGen] Replace DefInit::get() with Record::getDefInit() (#107762)Rahul Joshi4-62/+52
Eliminate DefInit::get() as its a duplicate of Record::getDefInit(). Use early return in `VarDefInit::instantiate`.
2024-09-08[clang][bytecode] Fix a variable scope problem with continue/break jumps ↵Timm Baeder3-17/+37
(#107738) Cleaning up _all_ the scopes is a little too much. Only clean up until the point here we started the scope relevant for the break/continue statement.
2024-09-08[Hexagon] Avoid repeated hash lookups (NFC) (#107760)Kazu Hirata2-10/+2
2024-09-08[APINotes] Avoid repeated hash lookups (NFC) (#107758)Kazu Hirata1-8/+2
2024-09-08[Frontend] Use range-based for loops (NFC) (#107757)Kazu Hirata1-60/+48
2024-09-08[Pass] Avoid repeated hash lookups (NFC) (#107761)Kazu Hirata1-5/+3
2024-09-08[CodeGen] Avoid repeated hash lookups (NFC) (#107759)Kazu Hirata1-6/+1
2024-09-08[mlir][linalg] Update name of linalg ods-gen target in docs (NFC) (#107742)Felix Schneider1-2/+2
2024-09-08[FrontEnd] Use SetVector (NFC) (#107743)Kazu Hirata1-47/+31
We could also use range-based for loops at several places, but I'm leaving that to a subsequent patch.
2024-09-08Reapply "[Clang][CWG1815] Support lifetime extension of temporary created by ↵yronglin20-87/+251
aggregate initialization using a default member initializer" (#97308) The PR reapply https://github.com/llvm/llvm-project/pull/92527. Implemented CWG1815 and fixed the bugs mentioned in the comments of https://github.com/llvm/llvm-project/pull/92527 and https://github.com/llvm/llvm-project/pull/87933. The reason why the original PR was reverted was that errors might occur during the rebuild. --------- Signed-off-by: yronglin <yronglin777@gmail.com>
2024-09-08[LLD][COFF] Always locate the IAT at the beginning of the .rdata section and ↵Jacek Caban2-5/+39
align its size to 4KB on ARM64EC. (#107588) This mimics the behavior of MSVC's link.exe. My guess is that the reason for this approach is to facilitate tracking runtime IAT modifications. An auxiliary IAT allows bypassing the call checker for imported function calls. It's the OS's responsibility to ensure that, if runtime patching occurs, the auxiliary IAT is reverted to enable call checking. Modifying the IAT is a form of runtime patching, and ensuring that it doesn’t share pages with other data likely helps with tracking accuracy. Although alignment alone should ensure that the IAT occupies its own pages, placing it at the beginning of the .rdata section might be an optimization. This way, padding is only needed after the IAT, not before. The auxiliary IAT seems to follow a similar idea but is positioned at the end of the .rdata section.
2024-09-08[NFC][TableGen] Migrate LLVM RISCVTarget/VT Emitters to const RecordKeeper ↵Rahul Joshi2-18/+16
(#107697) Migrate LLVM RISCVTarget/VT Emitters to const RecordKeeper.
2024-09-08Fix GCC Wimplicit-fallthrough warnings. NFC.Simon Pilgrim1-0/+3
2024-09-08Fix GCC Wparentheses warning. NFC.Simon Pilgrim1-4/+4
2024-09-08[X86] LowerSELECTWithCmpZero - without CMOV, fold "SELECT (AND(X,1) == 0), ↵Simon Pilgrim4-139/+117
C1, C2 -> XOR(C1,AND(NEG(AND(X,1)),XOR(C1,C2))" Use xor-bitselect pattern to avoid branching when selecting between 2 constants
2024-09-08[X86] LowerSELECTWithCmpZero - move "select (X != 0), -1, Y --> 0 - X; or ↵Simon Pilgrim2-35/+34
(sbb), Y" fold Move fold into LowerSELECTWithCmpZero so it can be used with (AND X,1) ==/!= 0 select cases
2024-09-08[bazel] Update deps (#107339) for AMDGPU/InstCombineTableGenNAKAMURA Takumi1-4/+2
FIXME: Move this to the relevant block.
2024-09-08[libc++][NFC] Use std::isinf in non-constexpr functions (#107690)Nikolas Klauser1-28/+28
2024-09-08[X86] LowerSELECTWithCmpZero - fold "SELECT (AND(X,1) == 0), 0, -1 -> ↵Simon Pilgrim8-174/+153
NEG(AND(X,1))"
2024-09-08[X86] LowerSELECTWithCmpZero - move !canUseCMOV check inside fold and update ↵Simon Pilgrim1-8/+9
comment describing fold for clarity. NFC. Minor refactor step before extending fold to support more patterns.
2024-09-08[CodeGen] Avoid repeated hash lookups (NFC) (#107736)Kazu Hirata1-10/+4
2024-09-08[AMDGPU] Remove unnecessary untieRegOperand (#107695)Jay Foad1-1/+0
As far as I can tell, V_SET_INACTIVE has never had tied operands.
2024-09-08[Vectorize] Avoid repeated hash lookups (NFC) (#107729)Kazu Hirata1-2/+1
2024-09-08[Frontend] Avoid repeated hash lookups (NFC) (#107728)Kazu Hirata1-12/+4
2024-09-08[IROutliner] Avoid repeated hash lookups (NFC) (#107726)Kazu Hirata1-2/+1
2024-09-08[clang][bytecode] Implement logical operators for vector type (#107678)yronglin2-2/+110
Implement `&&`, `||` logical operators for vector type. --------- Signed-off-by: yronglin <yronglin777@gmail.com>
2024-09-08[Sanitizer] Create DiagnosticInfoInstrumentation for IR Instrumentation ↵Chaitanya3-13/+21
reporting. (#106356) This PR adds DK_Instrumentation enum to DiagnosticKind and DiagnosticInfoInstrumentation is extended from DiagnosticsInfo for IR instrumentation reporting.
2024-09-07[Transforms] Avoid repeated hash looksup (NFC) (#107727)Kazu Hirata1-3/+1
2024-09-07[ThinLTO] Use DenseMap for OidGuidMap (#107725)Kazu Hirata1-1/+1
We use OidGuidMap only to map an old GUID to a new one. We don't use std::set's strengths like iterators staying valid or the ability to traverse in a sorted order. As a data point, during the ThinLTO indexing step of a large application of ours, we create 440,000 mappings. Our memory profiler reports reduction of 127MB in the peak memory usage (out of 4.991GB), which is bigger than expected savings most likely due to some noise. The savings should be about 8MB at the max load factor of DenseMap.
2024-09-08[gn build] Port bb343468ffa8LLVM GN Syncbot1-1/+0
2024-09-07Revert "[LLDB] Reappply SBSaveCore AddMemoryList" (#107731)Jonas Devlieghere25-496/+67
Reverts llvm/llvm-project#107159 as this is still causing `TestSkinnyCorefile.py` to time out. https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/as-lldb-cmake/11099/ https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/lldb-cmake/5544/
2024-09-07[lldb] Update ScriptInterpreterLua for Status changes (NFC)Jonas Devlieghere1-10/+10
The Status constructor that takes an error has been removed in favor of Status::FromError.
2024-09-07[clang-format] Fix a bug in annotating CastRParen (#107675)Owen Pan2-12/+23
Fixes #107568.
2024-09-07[libc][TableGen] Migrate libc-hdrgen backend to use const RecordKeeper (#107542)Rahul Joshi12-73/+76
Migrate libc-hdrgen backend to use const RecordKeeper
2024-09-07[MLIR][TableGen] Migrate MLIR backends to use const RecordKeeper (#107505)Rahul Joshi18-152/+146
- Migrate MLIR backends to use a const RecordKeeper reference.
2024-09-07[TableGen] Eliminate static CodeGenIntrinsicMap in PatternParser (#107339)Rahul Joshi6-26/+23
Instead, move it to CodeGenTarget class, and use it in both PatternParser and SearchableTableEmitter.