Skip to content

Commit f6128cd

Browse files
committed
Merge from 'main' to 'sycl-web' (64 commits)
CONFLICT (content): Merge conflict in clang/test/Driver/cuda-external-tools.cu
2 parents 45c8527 + 6cfcfbd commit f6128cd

File tree

233 files changed

+5070
-3670
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

233 files changed

+5070
-3670
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
set(LLVM_LINK_COMPONENTS
22
BOLTCore
33
MC
4-
Object
54
Support
6-
${LLVM_TARGETS_TO_BUILD}
5+
AArch64Desc
76
)
87

98
add_llvm_library(LLVMBOLTTargetAArch64
109
AArch64MCPlusBuilder.cpp
1110

1211
DEPENDS
13-
intrinsics_gen
1412
AArch64CommonTableGen
1513
)
1614

17-
include_directories(${LLVM_MAIN_SRC_DIR}/lib/Target/AArch64 ${LLVM_BINARY_DIR}/lib/Target/AArch64)
15+
include_directories(
16+
${LLVM_MAIN_SRC_DIR}/lib/Target/AArch64
17+
${LLVM_BINARY_DIR}/lib/Target/AArch64
18+
)

bolt/lib/Target/X86/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ set(LLVM_LINK_COMPONENTS
22
BOLTCore
33
BOLTUtils
44
MC
5-
Object
65
Support
7-
${LLVM_TARGETS_TO_BUILD}
6+
X86Desc
87
)
98

109
add_llvm_library(LLVMBOLTTargetX86
1110
X86MCPlusBuilder.cpp
1211

1312
DEPENDS
14-
intrinsics_gen
1513
X86CommonTableGen
1614
)
1715

18-
include_directories(${LLVM_MAIN_SRC_DIR}/lib/Target/X86 ${LLVM_BINARY_DIR}/lib/Target/X86)
16+
include_directories(
17+
${LLVM_MAIN_SRC_DIR}/lib/Target/X86
18+
${LLVM_BINARY_DIR}/lib/Target/X86
19+
)

clang-tools-extra/clangd/IncludeFixer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ std::vector<Fix> IncludeFixer::fix(DiagnosticsEngine::Level DiagLevel,
198198
case diag::err_no_member_template_suggest:
199199
case diag::warn_implicit_function_decl:
200200
case diag::ext_implicit_function_decl_c99:
201-
case diag::err_opencl_implicit_function_decl:
202201
dlog("Unresolved name at {0}, last typo was {1}",
203202
Info.getLocation().printToString(Info.getSourceManager()),
204203
LastUnresolvedName

clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,12 +553,12 @@ TEST(DiagnosticTest, ClangTidyEnablesClangWarning) {
553553
// clang-diagnostic-* is acceptable
554554
TU.ClangTidyProvider = addClangArgs({"-Wunused"}, "clang-diagnostic-*");
555555
EXPECT_THAT(*TU.build().getDiagnostics(), ElementsAre(UnusedFooWarning));
556-
// And plain *
556+
// And plain * (may turn on other checks too).
557557
TU.ClangTidyProvider = addClangArgs({"-Wunused"}, "*");
558-
EXPECT_THAT(*TU.build().getDiagnostics(), ElementsAre(UnusedFooWarning));
558+
EXPECT_THAT(*TU.build().getDiagnostics(), Contains(UnusedFooWarning));
559559
// And we can explicitly exclude a category too.
560-
TU.ClangTidyProvider =
561-
addClangArgs({"-Wunused"}, "*,-clang-diagnostic-unused-function");
560+
TU.ClangTidyProvider = addClangArgs(
561+
{"-Wunused"}, "clang-diagnostic-*,-clang-diagnostic-unused-function");
562562
EXPECT_THAT(*TU.build().getDiagnostics(), IsEmpty());
563563

564564
// Without the exact check specified, the warnings are not enabled.

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ New check aliases
136136
Changes in existing checks
137137
^^^^^^^^^^^^^^^^^^^^^^^^^^
138138

139+
- Fixed nonsensical suggestion of :doc:`altera-struct-pack-align
140+
<clang-tidy/checks/altera-struct-pack-align>` check for empty structs.
141+
142+
- Fixed some false positives in :doc:`bugprone-infinite-loop
143+
<clang-tidy/checks/bugprone-infinite-loop>` involving dependent expressions.
144+
139145
- Fixed a crash in :doc:`bugprone-sizeof-expression
140146
<clang-tidy/checks/bugprone-sizeof-expression>` when `sizeof(...)` is
141147
compared against a `__int128_t`.
@@ -158,26 +164,20 @@ Changes in existing checks
158164
<clang-tidy/checks/misc-redundant-expression>` involving assignments in
159165
conditions. This fixes `Issue 35853 <https://github.com/llvm/llvm-project/issues/35853>`_.
160166

161-
- Fixed a crash in :doc:`readability-const-return-type
162-
<clang-tidy/checks/readability-const-return-type>` when a pure virtual function
163-
overrided has a const return type. Removed the fix for a virtual function.
164-
165-
- Fixed a false positive in :doc:`readability-non-const-parameter
166-
<clang-tidy/checks/readability-non-const-parameter>` when the parameter is
167-
referenced by an lvalue.
168-
169167
- Improved :doc:`performance-inefficient-vector-operation
170168
<clang-tidy/checks/performance-inefficient-vector-operation>` to work when
171169
the vector is a member of a structure.
172170

173-
- Fixed nonsensical suggestion of :doc:`altera-struct-pack-align
174-
<clang-tidy/checks/altera-struct-pack-align>` check for empty structs.
171+
- Fixed a crash in :doc:`readability-const-return-type
172+
<clang-tidy/checks/readability-const-return-type>` when a pure virtual function
173+
overrided has a const return type. Removed the fix for a virtual function.
175174

176175
- Fixed incorrect suggestions for :doc:`readability-container-size-empty
177176
<clang-tidy/checks/readability-container-size-empty>` when smart pointers are involved.
178177

179-
- Fixed some false positives in :doc:`bugprone-infinite-loop
180-
<clang-tidy/checks/bugprone-infinite-loop>` involving dependent expressions.
178+
- Fixed a false positive in :doc:`readability-non-const-parameter
179+
<clang-tidy/checks/readability-non-const-parameter>` when the parameter is
180+
referenced by an lvalue.
181181

182182
Removed checks
183183
^^^^^^^^^^^^^^

clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "clang/Analysis/FlowSensitive/StorageLocation.h"
2222
#include "clang/Analysis/FlowSensitive/Value.h"
2323
#include "llvm/ADT/DenseMap.h"
24+
#include "llvm/ADT/DenseSet.h"
2425
#include <cassert>
2526
#include <memory>
2627
#include <type_traits>
@@ -45,9 +46,6 @@ class DataflowAnalysisContext {
4546
assert(this->S != nullptr);
4647
}
4748

48-
/// Returns the SAT solver instance that is available in this context.
49-
Solver &getSolver() const { return *S; }
50-
5149
/// Takes ownership of `Loc` and returns a reference to it.
5250
///
5351
/// Requirements:
@@ -151,7 +149,39 @@ class DataflowAnalysisContext {
151149
/// calls with the same argument will return the same result.
152150
BoolValue &getOrCreateNegationValue(BoolValue &Val);
153151

152+
/// Creates a fresh flow condition and returns a token that identifies it. The
153+
/// token can be used to perform various operations on the flow condition such
154+
/// as adding constraints to it, forking it, joining it with another flow
155+
/// condition, or checking implications.
156+
AtomicBoolValue &makeFlowConditionToken();
157+
158+
/// Adds `Constraint` to the flow condition identified by `Token`.
159+
void addFlowConditionConstraint(AtomicBoolValue &Token,
160+
BoolValue &Constraint);
161+
162+
/// Creates a new flow condition with the same constraints as the flow
163+
/// condition identified by `Token` and returns its token.
164+
AtomicBoolValue &forkFlowCondition(AtomicBoolValue &Token);
165+
166+
/// Creates a new flow condition that represents the disjunction of the flow
167+
/// conditions identified by `FirstToken` and `SecondToken`, and returns its
168+
/// token.
169+
AtomicBoolValue &joinFlowConditions(AtomicBoolValue &FirstToken,
170+
AtomicBoolValue &SecondToken);
171+
172+
/// Returns true if and only if the constraints of the flow condition
173+
/// identified by `Token` imply that `Val` is true.
174+
bool flowConditionImplies(AtomicBoolValue &Token, BoolValue &Val);
175+
154176
private:
177+
/// Adds all constraints of the flow condition identified by `Token` and all
178+
/// of its transitive dependencies to `Constraints`. `VisitedTokens` is used
179+
/// to track tokens of flow conditions that were already visited by recursive
180+
/// calls.
181+
void addTransitiveFlowConditionConstraints(
182+
AtomicBoolValue &Token, llvm::DenseSet<BoolValue *> &Constraints,
183+
llvm::DenseSet<AtomicBoolValue *> &VisitedTokens) const;
184+
155185
std::unique_ptr<Solver> S;
156186

157187
// Storage for the state of a program.
@@ -178,6 +208,27 @@ class DataflowAnalysisContext {
178208
llvm::DenseMap<std::pair<BoolValue *, BoolValue *>, DisjunctionValue *>
179209
DisjunctionVals;
180210
llvm::DenseMap<BoolValue *, NegationValue *> NegationVals;
211+
212+
// Flow conditions are tracked symbolically: each unique flow condition is
213+
// associated with a fresh symbolic variable (token), bound to the clause that
214+
// defines the flow condition. Conceptually, each binding corresponds to an
215+
// "iff" of the form `FC <=> (C1 ^ C2 ^ ...)` where `FC` is a flow condition
216+
// token (an atomic boolean) and `Ci`s are the set of constraints in the flow
217+
// flow condition clause. Internally, we do not record the formula directly as
218+
// an "iff". Instead, a flow condition clause is encoded as conjuncts of the
219+
// form `(FC v !C1 v !C2 v ...) ^ (C1 v !FC) ^ (C2 v !FC) ^ ...`. The first
220+
// conjuct is stored in the `FlowConditionFirstConjuncts` map and the set of
221+
// remaining conjuncts are stored in the `FlowConditionRemainingConjuncts`
222+
// map, both keyed by the token of the flow condition.
223+
//
224+
// Flow conditions depend on other flow conditions if they are created using
225+
// `forkFlowCondition` or `joinFlowConditions`. The graph of flow condition
226+
// dependencies is stored in the `FlowConditionDeps` map.
227+
llvm::DenseMap<AtomicBoolValue *, llvm::DenseSet<AtomicBoolValue *>>
228+
FlowConditionDeps;
229+
llvm::DenseMap<AtomicBoolValue *, BoolValue *> FlowConditionFirstConjuncts;
230+
llvm::DenseMap<AtomicBoolValue *, llvm::DenseSet<BoolValue *>>
231+
FlowConditionRemainingConjuncts;
181232
};
182233

183234
} // namespace dataflow

clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,13 @@ class Environment {
111111

112112
/// Creates an environment that uses `DACtx` to store objects that encompass
113113
/// the state of a program.
114-
explicit Environment(DataflowAnalysisContext &DACtx) : DACtx(&DACtx) {}
114+
explicit Environment(DataflowAnalysisContext &DACtx);
115+
116+
Environment(const Environment &Other);
117+
Environment &operator=(const Environment &Other);
118+
119+
Environment(Environment &&Other) = default;
120+
Environment &operator=(Environment &&Other) = default;
115121

116122
/// Creates an environment that uses `DACtx` to store objects that encompass
117123
/// the state of a program.
@@ -297,9 +303,8 @@ class Environment {
297303
: makeAnd(makeImplication(LHS, RHS), makeImplication(RHS, LHS));
298304
}
299305

300-
const llvm::DenseSet<BoolValue *> &getFlowConditionConstraints() const {
301-
return FlowConditionConstraints;
302-
}
306+
/// Returns the token that identifies the flow condition of the environment.
307+
AtomicBoolValue &getFlowConditionToken() const { return *FlowConditionToken; }
303308

304309
/// Adds `Val` to the set of clauses that constitute the flow condition.
305310
void addToFlowCondition(BoolValue &Val);
@@ -345,7 +350,7 @@ class Environment {
345350
std::pair<StructValue *, const ValueDecl *>>
346351
MemberLocToStruct;
347352

348-
llvm::DenseSet<BoolValue *> FlowConditionConstraints;
353+
AtomicBoolValue *FlowConditionToken;
349354
};
350355

351356
} // namespace dataflow

clang/include/clang/Basic/BuiltinsRISCV.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ TARGET_BUILTIN(__builtin_riscv_orc_b_32, "ZiZi", "nc", "zbb")
2020
TARGET_BUILTIN(__builtin_riscv_orc_b_64, "WiWi", "nc", "zbb,64bit")
2121
TARGET_BUILTIN(__builtin_riscv_clz_32, "ZiZi", "nc", "zbb")
2222
TARGET_BUILTIN(__builtin_riscv_clz_64, "WiWi", "nc", "zbb,64bit")
23+
TARGET_BUILTIN(__builtin_riscv_ctz_32, "ZiZi", "nc", "zbb")
24+
TARGET_BUILTIN(__builtin_riscv_ctz_64, "WiWi", "nc", "zbb,64bit")
2325

2426
// Zbc or Zbkc extension
2527
TARGET_BUILTIN(__builtin_riscv_clmul, "LiLiLi", "nc", "zbc|zbkc")

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10260,8 +10260,6 @@ def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
1026010260
"element. (%0 and %1)">;
1026110261
def err_bad_kernel_param_type : Error<
1026210262
"%0 cannot be used as the type of a kernel parameter">;
10263-
def err_opencl_implicit_function_decl : Error<
10264-
"implicit declaration of function %0 is invalid in OpenCL">;
1026510263
def err_record_with_pointers_kernel_param : Error<
1026610264
"%select{struct|union}0 kernel parameters may not contain pointers">;
1026710265
def note_within_field_of_type : Note<

clang/include/clang/Basic/LangOptions.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,12 @@ class LangOptions : public LangOptionsBase {
545545
return CPlusPlus || C2x || DisableKNRFunctions;
546546
}
547547

548+
/// Returns true if implicit function declarations are allowed in the current
549+
/// language mode.
550+
bool implicitFunctionsAllowed() const {
551+
return !requiresStrictPrototypes() && !OpenCL;
552+
}
553+
548554
/// Check if return address signing is enabled.
549555
bool hasSignReturnAddress() const {
550556
return getSignReturnAddressScope() != SignReturnAddressScopeKind::None;

0 commit comments

Comments
 (0)