[llvm-branch-commits] [llvm] [BPF][GlobalISel] select non-PreISelGenericOpcode (PR #75034)
https://github.com/inclyc created https://github.com/llvm/llvm-project/pull/75034 This selects non-PreISelGenericOpcode as-is. >From 7684e98041fee0fbc5c6add0505ab414d4ff705a Mon Sep 17 00:00:00 2001 From: Yingchi Long Date: Mon, 11 Dec 2023 17:33:40 +0800 Subject: [PATCH] [BPF][GlobalISel] select non-PreISelGenericOpcode This selects non-PreISelGenericOpcode as-is. Co-authored-by: Origami404 --- llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp | 2 ++ llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll | 5 + 2 files changed, 7 insertions(+) diff --git a/llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp b/llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp index 1effeb7a57b13..c7db93a260c47 100644 --- a/llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp +++ b/llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp @@ -76,6 +76,8 @@ BPFInstructionSelector::BPFInstructionSelector(const BPFTargetMachine &TM, } bool BPFInstructionSelector::select(MachineInstr &I) { + if (!isPreISelGenericOpcode(I.getOpcode())) +return true; if (selectImpl(I, *CoverageInfo)) return true; return false; diff --git a/llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll b/llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll index 7a014f7841fc8..031e82dcb67bd 100644 --- a/llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll +++ b/llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll @@ -1,7 +1,12 @@ ; RUN: llc -mtriple=bpfel -global-isel -verify-machineinstrs -stop-after=irtranslator < %s | FileCheck %s +; RUN: llc -mtriple=bpfel -global-isel -verify-machineinstrs < %s | FileCheck --check-prefix=ISEL %s ; CHECK: name: f ; CHECK: RET define void @f() { +; ISEL-LABEL: f: +; ISEL: # %bb.0: +; ISEL-NEXT: exit +; ISEL-NEXT: .Lfunc_end0: ret void } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [BPF][GlobalISel] select non-PreISelGenericOpcode (PR #75034)
llvmbot wrote: @llvm/pr-subscribers-llvm-globalisel Author: Yingchi Long (inclyc) Changes This selects non-PreISelGenericOpcode as-is. --- Full diff: https://github.com/llvm/llvm-project/pull/75034.diff 2 Files Affected: - (modified) llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp (+2) - (modified) llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll (+5) ``diff diff --git a/llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp b/llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp index 1effeb7a57b13..c7db93a260c47 100644 --- a/llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp +++ b/llvm/lib/Target/BPF/GISel/BPFInstructionSelector.cpp @@ -76,6 +76,8 @@ BPFInstructionSelector::BPFInstructionSelector(const BPFTargetMachine &TM, } bool BPFInstructionSelector::select(MachineInstr &I) { + if (!isPreISelGenericOpcode(I.getOpcode())) +return true; if (selectImpl(I, *CoverageInfo)) return true; return false; diff --git a/llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll b/llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll index 7a014f7841fc8..031e82dcb67bd 100644 --- a/llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll +++ b/llvm/test/CodeGen/BPF/GlobalISel/ir-translator-ret.ll @@ -1,7 +1,12 @@ ; RUN: llc -mtriple=bpfel -global-isel -verify-machineinstrs -stop-after=irtranslator < %s | FileCheck %s +; RUN: llc -mtriple=bpfel -global-isel -verify-machineinstrs < %s | FileCheck --check-prefix=ISEL %s ; CHECK: name: f ; CHECK: RET define void @f() { +; ISEL-LABEL: f: +; ISEL: # %bb.0: +; ISEL-NEXT: exit +; ISEL-NEXT: .Lfunc_end0: ret void } `` https://github.com/llvm/llvm-project/pull/75034 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [BPF][GlobalISel] select non-PreISelGenericOpcode (PR #75034)
https://github.com/inclyc edited https://github.com/llvm/llvm-project/pull/75034 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [libc] [compiler-rt] [clang] [clang-tools-extra] [llvm] [flang] [OptTable] Make new lines in help text respect indentation (PR #74880)
https://github.com/jh7370 commented: Is the main functionality of this test actually tested in the current patch? It doesn't seem to be to me. https://github.com/llvm/llvm-project/pull/74880 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [TextAPI] Add support to convert RecordSlices -> InterfaceFile (PR #75007)
https://github.com/cyndyishida updated https://github.com/llvm/llvm-project/pull/75007 >From d5e97577651b558b56de64f9ed74cd7893cea7ec Mon Sep 17 00:00:00 2001 From: Cyndy Ishida Date: Thu, 7 Dec 2023 13:57:17 -0800 Subject: [PATCH 1/2] [TextAPI] Add support to convert RecordSlices -> InterfaceFile Introduce RecordVisitor. This is used for different clients that want to extract information out of RecordSlice types. The first and immediate usecase is for serializing symbol information into TBD files. --- llvm/include/llvm/TextAPI/DylibReader.h | 5 + llvm/include/llvm/TextAPI/Record.h| 9 +- llvm/include/llvm/TextAPI/RecordVisitor.h | 54 ++ llvm/include/llvm/TextAPI/RecordsSlice.h | 6 +- llvm/lib/TextAPI/CMakeLists.txt | 1 + llvm/lib/TextAPI/DylibReader.cpp | 10 ++ llvm/lib/TextAPI/RecordVisitor.cpp| 67 llvm/lib/TextAPI/RecordsSlice.cpp | 124 +- 8 files changed, 272 insertions(+), 4 deletions(-) create mode 100644 llvm/include/llvm/TextAPI/RecordVisitor.h create mode 100644 llvm/lib/TextAPI/RecordVisitor.cpp diff --git a/llvm/include/llvm/TextAPI/DylibReader.h b/llvm/include/llvm/TextAPI/DylibReader.h index aa98df99c99fa6..3d4ddb9745ddd4 100644 --- a/llvm/include/llvm/TextAPI/DylibReader.h +++ b/llvm/include/llvm/TextAPI/DylibReader.h @@ -42,6 +42,11 @@ struct ParseOption { /// \return List of record slices. Expected readFile(MemoryBufferRef Buffer, const ParseOption &Opt); +/// Get TAPI file representation of binary dylib. +/// +/// \param Buffer Data that points to dylib. +Expected> get(MemoryBufferRef Buffer); + } // namespace DylibReader } // end namespace MachO. diff --git a/llvm/include/llvm/TextAPI/Record.h b/llvm/include/llvm/TextAPI/Record.h index 5317982cbfa2bf..ec93098b320ce1 100644 --- a/llvm/include/llvm/TextAPI/Record.h +++ b/llvm/include/llvm/TextAPI/Record.h @@ -14,6 +14,7 @@ #ifndef LLVM_TEXTAPI_RECORD_H #define LLVM_TEXTAPI_RECORD_H +#include "llvm/ADT/MapVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Casting.h" #include "llvm/TextAPI/Symbol.h" @@ -50,7 +51,7 @@ class Record { public: Record() = default; Record(StringRef Name, RecordLinkage Linkage, SymbolFlags Flags) - : Name(Name), Linkage(Linkage), Flags(Flags) {} + : Name(Name), Linkage(Linkage), Flags(mergeFlags(Flags, Linkage)) {} bool isWeakDefined() const { return (Flags & SymbolFlags::WeakDefined) == SymbolFlags::WeakDefined; @@ -79,6 +80,10 @@ class Record { bool isRexported() const { return Linkage == RecordLinkage::Rexported; } StringRef getName() const { return Name; } + SymbolFlags getFlags() const { return Flags; } + +private: + SymbolFlags mergeFlags(SymbolFlags Flags, RecordLinkage Linkage); protected: StringRef Name; @@ -137,6 +142,7 @@ class ObjCContainerRecord : public Record { ObjCIVarRecord *addObjCIVar(StringRef IVar, RecordLinkage Linkage); ObjCIVarRecord *findObjCIVar(StringRef IVar) const; + std::vector getObjCIVars() const; private: RecordMap IVars; @@ -163,6 +169,7 @@ class ObjCInterfaceRecord : public ObjCContainerRecord { bool hasExceptionAttribute() const { return HasEHType; } bool addObjCCategory(ObjCCategoryRecord *Record); + std::vector getObjCCategories() const; private: bool HasEHType; diff --git a/llvm/include/llvm/TextAPI/RecordVisitor.h b/llvm/include/llvm/TextAPI/RecordVisitor.h new file mode 100644 index 00..34e43f5b0027f8 --- /dev/null +++ b/llvm/include/llvm/TextAPI/RecordVisitor.h @@ -0,0 +1,54 @@ +//===- llvm/TextAPI/RecordSlice.h - TAPI RecordSlice *- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +/// +/// Defines the TAPI Record Visitor. +/// +//===--===// + +#ifndef LLVM_TEXTAPI_RECORDVISITOR_H +#define LLVM_TEXTAPI_RECORDVISITOR_H + +#include "llvm/TextAPI/Record.h" +#include "llvm/TextAPI/SymbolSet.h" + +namespace llvm { +namespace MachO { + +/// Base class for any usage of traversing over collected Records. +class RecordVisitor { +public: + virtual ~RecordVisitor(); + + virtual void visitGlobal(const GlobalRecord &) = 0; + virtual void visitObjCInterface(const ObjCInterfaceRecord &); + virtual void visitObjCCategory(const ObjCCategoryRecord &); +}; + +/// Specialized RecordVisitor for collecting exported symbols +/// and undefined symbols if RecordSlice being visited represents a +/// flat-namespaced library. +class SymbolConverter : public RecordVisitor { +public: + SymbolConverter(SymbolSet *Symbols, const Target &T, + const bool RecordUndefs = false) + : Symbols(Symbols), Targ(T), RecordUndefs(
[llvm-branch-commits] [compiler-rt] [flang] [clang-tools-extra] [llvm] [clang] [libc] [OptTable] Make new lines in help text respect indentation (PR #74880)
avillega wrote: > Is the main functionality of this test actually tested in the current patch? > It doesn't seem to be to me. I don't fully understand your comment, I am working on getting some of the test to be whitespace strict to specifically test the functionality. https://github.com/llvm/llvm-project/pull/74880 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] [clang-tools-extra] [flang] [libc] [compiler-rt] [clang] [OptTable] Make new lines in help text respect indentation (PR #74880)
https://github.com/avillega updated https://github.com/llvm/llvm-project/pull/74880 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang-tools-extra] [flang] [clang] [llvm] [compiler-rt] [libc] [OptTable] Make new lines in help text respect indentation (PR #74880)
https://github.com/avillega updated https://github.com/llvm/llvm-project/pull/74880 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [libc] [compiler-rt] [llvm] [clang-tools-extra] [clang] [OptTable] Make new lines in help text respect indentation (PR #74880)
https://github.com/avillega updated https://github.com/llvm/llvm-project/pull/74880 >From 61fd524086abe13b6ed0a792a0e5ed29ba8fc692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Villegas?= Date: Tue, 12 Dec 2023 00:10:48 + Subject: [PATCH] Fix flang help tests. Created using spr 1.3.4 --- flang/test/Driver/driver-help-hidden.f90 | 226 ++-- flang/test/Driver/driver-help.f90| 434 +++ 2 files changed, 330 insertions(+), 330 deletions(-) diff --git a/flang/test/Driver/driver-help-hidden.f90 b/flang/test/Driver/driver-help-hidden.f90 index 9a11a7a571ffc..ca114320d13d7 100644 --- a/flang/test/Driver/driver-help-hidden.f90 +++ b/flang/test/Driver/driver-help-hidden.f90 @@ -14,143 +14,143 @@ ! CHECK:USAGE: flang-new ! CHECK-EMPTY: ! CHECK-NEXT: DRIVER OPTIONS: -! CHECK-NEXT: --driver-mode= Set the driver mode to either 'gcc', 'g++', 'cpp', 'cl' or 'flang' +! CHECK-NEXT: --driver-mode= - Set the driver mode to either 'gcc', 'g++', 'cpp', 'cl' or 'flang' ! CHECK-EMPTY: ! CHECK-NEXT:OPTIONS: -! CHECK-NEXT: -###Print (but do not run) the commands to run for this compilation -! CHECK-NEXT: -ccc-print-phases Dump list of actions to perform -! CHECK-NEXT: -cppEnable predefined and command line preprocessor macros -! CHECK-NEXT: -c Only run preprocess, compile, and assemble steps -! CHECK-NEXT: -dumpmachineDisplay the compiler's target processor -! CHECK-NEXT: -dumpversionDisplay the version of the compiler -! CHECK-NEXT: -D = Define to (or 1 if omitted) -! CHECK-NEXT: -emit-llvm Use the LLVM representation for assembler and object files -! CHECK-NEXT: -E Only run the preprocessor +! CHECK-NEXT: -###- Print (but do not run) the commands to run for this compilation +! CHECK-NEXT: -ccc-print-phases - Dump list of actions to perform +! CHECK-NEXT: -cpp- Enable predefined and command line preprocessor macros +! CHECK-NEXT: -c - Only run preprocess, compile, and assemble steps +! CHECK-NEXT: -dumpmachine- Display the compiler's target processor +! CHECK-NEXT: -dumpversion- Display the version of the compiler +! CHECK-NEXT: -D = - Define to (or 1 if omitted) +! CHECK-NEXT: -emit-llvm - Use the LLVM representation for assembler and object files +! CHECK-NEXT: -E - Only run the preprocessor ! CHECK-NEXT: -falternative-parameter-statement -! CHECK-NEXT: Enable the old style PARAMETER statement -! CHECK-NEXT: -fapprox-func Allow certain math function calls to be replaced with an approximately equivalent calculation -! CHECK-NEXT: -fbackslash Specify that backslash in string introduces an escape character -! CHECK-NEXT: -fcolor-diagnostics Enable colors in diagnostics -! CHECK-NEXT: -fconvert= Set endian conversion of data for unformatted files -! CHECK-NEXT: -fdefault-double-8 Set the default double precision kind to an 8 byte wide type -! CHECK-NEXT: -fdefault-integer-8 Set the default integer and logical kind to an 8 byte wide type -! CHECK-NEXT: -fdefault-real-8Set the default real kind to an 8 byte wide type -! CHECK-NEXT: -ffast-math Allow aggressive, lossy floating-point optimizations -! CHECK-NEXT: -ffixed-formProcess source files in fixed form +! CHECK-NEXT: - Enable the old style PARAMETER statement +! CHECK-NEXT: -fapprox-func - Allow certain math function calls to be replaced with an approximately equivalent calculation +! CHECK-NEXT: -fbackslash - Specify that backslash in string introduces an escape character +! CHECK-NEXT: -fcolor-diagnostics - Enable colors in diagnostics +! CHECK-NEXT: -fconvert= - Set endian conversion of data for unformatted files +! CHECK-NEXT: -fdefault-double-8 - Set the default double precision kind to an 8 byte wide type +! CHECK-NEXT: -fdefault-integer-8 - Set the default integer and logical kind to an 8 byte wide type +! CHECK-NEXT: -fdefault-real-8- Set the default real kind to an 8 byte wide type +! CHECK-NEXT: -ffast-math - Allow aggressive, lossy floating-point optimizations +! CHECK-NEXT: -ffixed-form- Process source files in fixed form ! CHECK-NEXT: -ffixed-line-length= -! CHECK-NEXT: Use as character line width in fixed mode -! CHECK-NEXT: -ffp-contract= Form fused FP ops (e.g. FMAs) -! CHECK-NEXT: -ffree-form Process source files in free form -! CHECK-NEXT: -fhonor-infinities Specify that floating-point optimizations are not allowed that assume arguments and results are not +-inf. -! CHECK-NEXT: -fhonor-nansSpecify that floating-point optimizations are not allowed that assume argum
[llvm-branch-commits] [clang-tools-extra] [clangd] check for synthesized symbols when tracking include locations (PR #75128)
https://github.com/mizvekov created https://github.com/llvm/llvm-project/pull/75128 This fixes https://github.com/llvm/llvm-project/issues/75115 In C mode with MSVC compatibility, when the `assert` macro is defined, as a workaround, `static_assert` is implicitly defined as well, if not already so, in order to work around a broken `assert.h` implementation. This workaround was implemented in https://github.com/llvm/llvm-project/commit/8da090381d567d0ec555840f6b2a651d2997e4b3 A synthesized symbol does not occur in source code, and therefore should not have valid source location, but this was not checked when inserting this into a `symbol -> include file` map. The invalid FileID value is used for empty key representation in the include file hash table, so it's not valid to insert it. >From 51de797d836f75a76b14e08eb2c1dfff1d1586ec Mon Sep 17 00:00:00 2001 From: Matheus Izvekov Date: Mon, 11 Dec 2023 17:45:12 -0300 Subject: [PATCH] [clangd] check for synthesized symbols when tracking include locations This fixes https://github.com/llvm/llvm-project/issues/75115 In C mode with MSVC compatibility, when the `assert` macro is defined, as a workaround, `static_assert` is implicitly defined as well, if not already so, in order to work around a broken `assert.h` implementation. This workaround was implemented in https://github.com/llvm/llvm-project/commit/8da090381d567d0ec555840f6b2a651d2997e4b3 A synthesized symbol does not occur in source code, and therefore should not have valid source location, but this was not checked when inserting this into a `symbol -> include file` map. The invalid FileID value is used for empty key representation in the include file hash table, so it's not valid to insert it. --- clang-tools-extra/clangd/index/SymbolCollector.cpp | 6 +- clang-tools-extra/clangd/test/GH75115.test | 11 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp index aac6676a995fed..e9e76abb90a2d6 100644 --- a/clang-tools-extra/clangd/index/SymbolCollector.cpp +++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp @@ -821,7 +821,11 @@ void SymbolCollector::setIncludeLocation(const Symbol &S, SourceLocation DefLoc, // Use the expansion location to get the #include header since this is // where the symbol is exposed. - IncludeFiles[S.ID] = SM.getDecomposedExpansionLoc(DefLoc).first; + FileID FID = SM.getDecomposedExpansionLoc(DefLoc).first; + if (FID.isInvalid()) +return; + + IncludeFiles[S.ID] = FID; // We update providers for a symbol with each occurence, as SymbolCollector // might run while parsing, rather than at the end of a translation unit. diff --git a/clang-tools-extra/clangd/test/GH75115.test b/clang-tools-extra/clangd/test/GH75115.test index 030392f1d69b30..dc86f5b9a6cee0 100644 --- a/clang-tools-extra/clangd/test/GH75115.test +++ b/clang-tools-extra/clangd/test/GH75115.test @@ -1,12 +1,15 @@ // RUN: rm -rf %t.dir && mkdir -p %t.dir // RUN: echo '[{"directory": "%/t.dir", "command": "clang --target=x86_64-pc-windows-msvc -x c GH75115.test", "file": "GH75115.test"}]' > %t.dir/compile_commands.json -// RUN: not --crash clangd -enable-config=0 --compile-commands-dir=%t.dir -check=%s 2>&1 | FileCheck -strict-whitespace %s - -// FIXME: Crashes +// RUN: clangd -enable-config=0 --compile-commands-dir=%t.dir -check=%s 2>&1 | FileCheck -strict-whitespace %s // CHECK: Building preamble... // CHECK-NEXT: Built preamble // CHECK-NEXT: Indexing headers... -// CHECK-NEXT: !KeyInfoT::isEqual(Val, EmptyKey) && !KeyInfoT::isEqual(Val, TombstoneKey) && "Empty/Tombstone value shouldn't be inserted into map!" +// CHECK-NEXT: Building AST... +// CHECK-NEXT: Indexing AST... +// CHECK-NEXT: Building inlay hints +// CHECK-NEXT: semantic highlighting +// CHECK-NEXT: Testing features at each token +// CHECK-NEXT: All checks completed, 0 errors #define assert ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang-tools-extra] [clangd] check for synthesized symbols when tracking include locations (PR #75128)
llvmbot wrote: @llvm/pr-subscribers-clangd Author: Matheus Izvekov (mizvekov) Changes This fixes https://github.com/llvm/llvm-project/issues/75115 In C mode with MSVC compatibility, when the `assert` macro is defined, as a workaround, `static_assert` is implicitly defined as well, if not already so, in order to work around a broken `assert.h` implementation. This workaround was implemented in https://github.com/llvm/llvm-project/commit/8da090381d567d0ec555840f6b2a651d2997e4b3 A synthesized symbol does not occur in source code, and therefore should not have valid source location, but this was not checked when inserting this into a `symbol -> include file` map. The invalid FileID value is used for empty key representation in the include file hash table, so it's not valid to insert it. --- Full diff: https://github.com/llvm/llvm-project/pull/75128.diff 2 Files Affected: - (modified) clang-tools-extra/clangd/index/SymbolCollector.cpp (+5-1) - (modified) clang-tools-extra/clangd/test/GH75115.test (+7-4) ``diff diff --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp index aac6676a995fe..e9e76abb90a2d 100644 --- a/clang-tools-extra/clangd/index/SymbolCollector.cpp +++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp @@ -821,7 +821,11 @@ void SymbolCollector::setIncludeLocation(const Symbol &S, SourceLocation DefLoc, // Use the expansion location to get the #include header since this is // where the symbol is exposed. - IncludeFiles[S.ID] = SM.getDecomposedExpansionLoc(DefLoc).first; + FileID FID = SM.getDecomposedExpansionLoc(DefLoc).first; + if (FID.isInvalid()) +return; + + IncludeFiles[S.ID] = FID; // We update providers for a symbol with each occurence, as SymbolCollector // might run while parsing, rather than at the end of a translation unit. diff --git a/clang-tools-extra/clangd/test/GH75115.test b/clang-tools-extra/clangd/test/GH75115.test index 030392f1d69b3..dc86f5b9a6cee 100644 --- a/clang-tools-extra/clangd/test/GH75115.test +++ b/clang-tools-extra/clangd/test/GH75115.test @@ -1,12 +1,15 @@ // RUN: rm -rf %t.dir && mkdir -p %t.dir // RUN: echo '[{"directory": "%/t.dir", "command": "clang --target=x86_64-pc-windows-msvc -x c GH75115.test", "file": "GH75115.test"}]' > %t.dir/compile_commands.json -// RUN: not --crash clangd -enable-config=0 --compile-commands-dir=%t.dir -check=%s 2>&1 | FileCheck -strict-whitespace %s - -// FIXME: Crashes +// RUN: clangd -enable-config=0 --compile-commands-dir=%t.dir -check=%s 2>&1 | FileCheck -strict-whitespace %s // CHECK: Building preamble... // CHECK-NEXT: Built preamble // CHECK-NEXT: Indexing headers... -// CHECK-NEXT: !KeyInfoT::isEqual(Val, EmptyKey) && !KeyInfoT::isEqual(Val, TombstoneKey) && "Empty/Tombstone value shouldn't be inserted into map!" +// CHECK-NEXT: Building AST... +// CHECK-NEXT: Indexing AST... +// CHECK-NEXT: Building inlay hints +// CHECK-NEXT: semantic highlighting +// CHECK-NEXT: Testing features at each token +// CHECK-NEXT: All checks completed, 0 errors #define assert `` https://github.com/llvm/llvm-project/pull/75128 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 9c8660e - Revert "[MacroFusion] Support multiple predicators (#72219)"
Author: Wang Pengcheng Date: 2023-12-12T11:20:52+08:00 New Revision: 9c8660ebb83e26f94e487c4183433379204d29ac URL: https://github.com/llvm/llvm-project/commit/9c8660ebb83e26f94e487c4183433379204d29ac DIFF: https://github.com/llvm/llvm-project/commit/9c8660ebb83e26f94e487c4183433379204d29ac.diff LOG: Revert "[MacroFusion] Support multiple predicators (#72219)" This reverts commit d3f6e82a6a562e3288a6fc0970d324073996c16d. Added: Modified: llvm/include/llvm/CodeGen/MacroFusion.h llvm/lib/CodeGen/MacroFusion.cpp llvm/lib/Target/AMDGPU/GCNVOPDUtils.cpp Removed: diff --git a/llvm/include/llvm/CodeGen/MacroFusion.h b/llvm/include/llvm/CodeGen/MacroFusion.h index 41a027ea06696b..ea2c7a5faae385 100644 --- a/llvm/include/llvm/CodeGen/MacroFusion.h +++ b/llvm/include/llvm/CodeGen/MacroFusion.h @@ -14,7 +14,7 @@ #ifndef LLVM_CODEGEN_MACROFUSION_H #define LLVM_CODEGEN_MACROFUSION_H -#include "llvm/ADT/ArrayRef.h" +#include #include namespace llvm { @@ -29,9 +29,10 @@ class SUnit; /// Check if the instr pair, FirstMI and SecondMI, should be fused /// together. Given SecondMI, when FirstMI is unspecified, then check if /// SecondMI may be part of a fused pair at all. -using MacroFusionPredTy = function_ref; +using ShouldSchedulePredTy = std::function; /// Checks if the number of cluster edges between SU and its predecessors is /// less than FuseLimit @@ -47,17 +48,15 @@ bool fuseInstructionPair(ScheduleDAGInstrs &DAG, SUnit &FirstSU, /// Create a DAG scheduling mutation to pair instructions back to back /// for instructions that benefit according to the target-specific -/// predicate functions. shouldScheduleAdjacent will be true if any of the -/// provided predicates are true. +/// shouldScheduleAdjacent predicate function. std::unique_ptr -createMacroFusionDAGMutation(ArrayRef Predicates); +createMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent); /// Create a DAG scheduling mutation to pair branch instructions with one /// of their predecessors back to back for instructions that benefit according -/// to the target-specific predicate functions. shouldScheduleAdjacent will be -/// true if any of the provided predicates are true. +/// to the target-specific shouldScheduleAdjacent predicate function. std::unique_ptr -createBranchMacroFusionDAGMutation(ArrayRef Predicates); +createBranchMacroFusionDAGMutation(ShouldSchedulePredTy shouldScheduleAdjacent); } // end namespace llvm diff --git a/llvm/lib/CodeGen/MacroFusion.cpp b/llvm/lib/CodeGen/MacroFusion.cpp index aff4d95781f45c..fa5df68b8abcc0 100644 --- a/llvm/lib/CodeGen/MacroFusion.cpp +++ b/llvm/lib/CodeGen/MacroFusion.cpp @@ -137,34 +137,19 @@ namespace { /// Post-process the DAG to create cluster edges between instrs that may /// be fused by the processor into a single operation. class MacroFusion : public ScheduleDAGMutation { - std::vector Predicates; + ShouldSchedulePredTy shouldScheduleAdjacent; bool FuseBlock; bool scheduleAdjacentImpl(ScheduleDAGInstrs &DAG, SUnit &AnchorSU); public: - MacroFusion(ArrayRef Predicates, bool FuseBlock) - : Predicates(Predicates.begin(), Predicates.end()), FuseBlock(FuseBlock) { - } + MacroFusion(ShouldSchedulePredTy shouldScheduleAdjacent, bool FuseBlock) +: shouldScheduleAdjacent(shouldScheduleAdjacent), FuseBlock(FuseBlock) {} void apply(ScheduleDAGInstrs *DAGInstrs) override; - - bool shouldScheduleAdjacent(const TargetInstrInfo &TII, - const TargetSubtargetInfo &STI, - const MachineInstr *FirstMI, - const MachineInstr &SecondMI); }; } // end anonymous namespace -bool MacroFusion::shouldScheduleAdjacent(const TargetInstrInfo &TII, - const TargetSubtargetInfo &STI, - const MachineInstr *FirstMI, - const MachineInstr &SecondMI) { - return llvm::any_of(Predicates, [&](MacroFusionPredTy Predicate) { -return Predicate(TII, STI, FirstMI, SecondMI); - }); -} - void MacroFusion::apply(ScheduleDAGInstrs *DAG) { if (FuseBlock) // For each of the SUnits in the scheduling block, try to fuse the instr in @@ -212,15 +197,17 @@ bool MacroFusion::scheduleAdjacentImpl(ScheduleDAGInstrs &DAG, SUnit &AnchorSU) } std::unique_ptr -llvm::createMacroFusionDAGMutation(ArrayRef Predicates) { - if (EnableMacroFusion) -return std::make_unique(Predicates, true); +llvm::createMacroFusionDAGMutation( + ShouldSchedulePredTy shouldScheduleAdjacent) { + if(EnableMacroFusion) +return std::make_unique(shouldScheduleAdjacent, true); return nullptr; } -std::unique_ptr llvm::createBranchMacroFusionDAGMutation( -ArrayRef Predicates) { - if (EnableMacroFusion) -return std::make_unique(Predicates, false); +
[llvm-branch-commits] [clang-tools-extra] [clangd] check for synthesized symbols when tracking include locations (PR #75128)
kadircet wrote: Hi @mizvekov thanks for the fix, but I am not sure if this is at the right level. The way you're bailing out currently prevents clangd from indexing all implicit definitions, even if we have a hard-coded mapping for them (based on the symbol name). Also the map you're preventing the insertion stores FileIDs as values, not keys, hence it isn't the place firing assertion failures. Can you instead move the logic to SymbolCollector::finish, which uses FileIDs to determine includers for objective-c symbols? we should only perform that logic if there's a valid FileID. https://github.com/llvm/llvm-project/pull/75128 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits