Skip to content

Commit 69a21d6

Browse files
authored
Merge branch 'main' into dev/amaclean/upstream/st-imm
2 parents 336b4b9 + 0529a34 commit 69a21d6

File tree

73 files changed

+1474
-847
lines changed

Some content is hidden

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

73 files changed

+1474
-847
lines changed

.ci/compute_projects.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
DEPENDENT_RUNTIMES_TO_TEST = {
7878
"clang": {"compiler-rt"},
7979
"clang-tools-extra": {"libc"},
80+
"libc": {"libc"},
8081
".ci": {"compiler-rt", "libc"},
8182
}
8283
DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG = {

.ci/compute_projects_test.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def test_top_level_file(self):
187187
self.assertEqual(env_variables["runtimes_check_targets"], "")
188188
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
189189

190-
def test_exclude_runtiems_in_projects(self):
190+
def test_exclude_libcxx_in_projects(self):
191191
env_variables = compute_projects.get_env_variables(
192192
["libcxx/CMakeLists.txt"], "Linux"
193193
)
@@ -197,6 +197,16 @@ def test_exclude_runtiems_in_projects(self):
197197
self.assertEqual(env_variables["runtimes_check_targets"], "")
198198
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
199199

200+
def test_include_libc_in_runtimes(self):
201+
env_variables = compute_projects.get_env_variables(
202+
["libc/CMakeLists.txt"], "Linux"
203+
)
204+
self.assertEqual(env_variables["projects_to_build"], "clang;lld")
205+
self.assertEqual(env_variables["project_check_targets"], "")
206+
self.assertEqual(env_variables["runtimes_to_build"], "libc")
207+
self.assertEqual(env_variables["runtimes_check_targets"], "check-libc")
208+
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
209+
200210
def test_exclude_docs(self):
201211
env_variables = compute_projects.get_env_variables(
202212
["llvm/docs/CIBestPractices.rst"], "Linux"

clang/include/clang/Basic/Sanitizers.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ bool parseSanitizerWeightedValue(StringRef Value, bool AllowGroups,
218218
void serializeSanitizerSet(SanitizerSet Set,
219219
SmallVectorImpl<StringRef> &Values);
220220

221-
/// Serialize a SanitizerMaskCutoffs into values for -fsanitize= or
222-
/// -fno-sanitize=.
221+
/// Serialize a SanitizerMaskCutoffs into command line arguments.
223222
void serializeSanitizerMaskCutoffs(const SanitizerMaskCutoffs &Cutoffs,
224223
SmallVectorImpl<std::string> &Values);
225224

clang/include/clang/Basic/riscv_vector.td

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,7 @@ let ManualCodegen = [{
18161816
// Unmasked: (passthru, op0, round_mode, vl)
18171817
// Masked: (passthru, op0, mask, frm, vl, policy)
18181818

1819-
SmallVector<llvm::Value*, 7> Operands;
1819+
SmallVector<llvm::Value*, 6> Operands;
18201820
bool HasMaskedOff = !(
18211821
(IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
18221822
(!IsMasked && PolicyAttrs & RVV_VTA));
@@ -2013,15 +2013,15 @@ let Log2LMUL = [-3, -2, -1, 0, 1, 2] in {
20132013
}
20142014

20152015
// Zvfbfmin - Vector convert BF16 to FP32
2016-
let Log2LMUL = [-2, -1, 0, 1, 2] in
2016+
let RequiredFeatures = ["zvfbfmin"], Log2LMUL = [-2, -1, 0, 1, 2] in
20172017
def vfwcvtbf16_f_f_v : RVVConvBuiltin<"Fw", "Fwv", "y", "vfwcvtbf16_f">;
20182018

20192019
let ManualCodegen = [{
20202020
{
20212021
// LLVM intrinsic
20222022
// Unmasked: (passthru, op0, frm, vl)
20232023
// Masked: (passthru, op0, mask, frm, vl, policy)
2024-
SmallVector<llvm::Value*, 7> Operands;
2024+
SmallVector<llvm::Value*, 6> Operands;
20252025
bool HasMaskedOff = !(
20262026
(IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
20272027
(!IsMasked && PolicyAttrs & RVV_VTA));
@@ -2121,7 +2121,8 @@ let ManualCodegen = [{
21212121
}
21222122

21232123
// Zvfbfmin - Vector convert FP32 to BF16
2124-
let Log2LMUL = [-2, -1, 0, 1, 2],
2124+
let RequiredFeatures = ["zvfbfmin"],
2125+
Log2LMUL = [-2, -1, 0, 1, 2],
21252126
OverloadedName = "vfncvtbf16_f" in
21262127
defm : RVVConvBuiltinSet<"vfncvtbf16_f_f_w", "y", [["v", "vFwu"]]>;
21272128
}
@@ -2225,7 +2226,7 @@ let ManualCodegen = [{
22252226
// Unmasked: (passthru, op0, op1, round_mode, vl)
22262227
// Masked: (passthru, vector_in, vector_in/scalar_in, mask, frm, vl, policy)
22272228

2228-
SmallVector<llvm::Value*, 7> Operands;
2229+
SmallVector<llvm::Value*, 6> Operands;
22292230
bool HasMaskedOff = !(
22302231
(IsMasked && (PolicyAttrs & RVV_VTA) && (PolicyAttrs & RVV_VMA)) ||
22312232
(!IsMasked && PolicyAttrs & RVV_VTA));

clang/include/clang/Lex/Preprocessor.h

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ class Preprocessor {
350350
/// Whether the last token we lexed was an '@'.
351351
bool LastTokenWasAt = false;
352352

353-
/// First pp-token in current translation unit.
354-
std::optional<Token> FirstPPToken;
353+
/// First pp-token source location in current translation unit.
354+
SourceLocation FirstPPTokenLoc;
355355

356356
/// A position within a C++20 import-seq.
357357
class StdCXXImportSeq {
@@ -1769,20 +1769,13 @@ class Preprocessor {
17691769
std::optional<LexEmbedParametersResult> LexEmbedParameters(Token &Current,
17701770
bool ForHasEmbed);
17711771

1772-
/// Whether the preprocessor already seen the first pp-token in main file.
1773-
bool hasSeenMainFileFirstPPToken() const { return FirstPPToken.has_value(); }
1774-
1775-
/// Record first pp-token and check if it has a Token::FirstPPToken flag.
1776-
void HandleMainFileFirstPPToken(const Token &Tok) {
1777-
if (!hasSeenMainFileFirstPPToken() && Tok.isFirstPPToken() &&
1778-
SourceMgr.isWrittenInMainFile(Tok.getLocation()))
1779-
FirstPPToken = Tok;
1772+
/// Get the start location of the first pp-token in main file.
1773+
SourceLocation getMainFileFirstPPTokenLoc() const {
1774+
assert(FirstPPTokenLoc.isValid() &&
1775+
"Did not see the first pp-token in the main file");
1776+
return FirstPPTokenLoc;
17801777
}
17811778

1782-
Token getMainFileFirstPPToken() const {
1783-
assert(FirstPPToken && "First main file pp-token doesn't exists");
1784-
return *FirstPPToken;
1785-
}
17861779
bool LexAfterModuleImport(Token &Result);
17871780
void CollectPpImportSuffix(SmallVectorImpl<Token> &Toks);
17881781

clang/include/clang/Lex/TokenLexer.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ class TokenLexer {
139139
void Init(const Token *TokArray, unsigned NumToks, bool DisableMacroExpansion,
140140
bool OwnsTokens, bool IsReinject);
141141

142-
/// If the next token lexed will pop this macro off the expansion stack,
143-
/// return std::nullopt, otherwise return the next unexpanded token.
142+
/// If TokenLexer::isAtEnd returns true(the next token lexed will pop this
143+
/// macro off the expansion stack), return std::nullopt, otherwise return the
144+
/// next unexpanded token.
144145
std::optional<Token> peekNextPPToken() const;
145146

146147
/// Lex and return a token from this macro stream.

clang/lib/Driver/SanitizerArgs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
740740
options::OPT_fno_sanitize_merge_handlers_EQ);
741741
MergeKinds &= Kinds;
742742

743-
// Parse -fno-sanitize-top-hot flags
743+
// Parse -fno-fsanitize-skip-hot-cutoff flags
744744
SkipHotCutoffs = parseSanitizeSkipHotCutoffArgs(D, Args, DiagnoseErrors);
745745

746746
// Parse -f(no-)?sanitize-annotate-debug-info flags

clang/lib/Lex/Lexer.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3228,6 +3228,7 @@ std::optional<Token> Lexer::peekNextPPToken() {
32283228
bool atStartOfLine = IsAtStartOfLine;
32293229
bool atPhysicalStartOfLine = IsAtPhysicalStartOfLine;
32303230
bool leadingSpace = HasLeadingSpace;
3231+
bool isFirstPPToken = IsFirstPPToken;
32313232

32323233
Token Tok;
32333234
Lex(Tok);
@@ -3238,7 +3239,7 @@ std::optional<Token> Lexer::peekNextPPToken() {
32383239
HasLeadingSpace = leadingSpace;
32393240
IsAtStartOfLine = atStartOfLine;
32403241
IsAtPhysicalStartOfLine = atPhysicalStartOfLine;
3241-
3242+
IsFirstPPToken = isFirstPPToken;
32423243
// Restore the lexer back to non-skipping mode.
32433244
LexingRawMode = false;
32443245

@@ -3740,10 +3741,6 @@ bool Lexer::Lex(Token &Result) {
37403741
bool returnedToken = LexTokenInternal(Result, atPhysicalStartOfLine);
37413742
// (After the LexTokenInternal call, the lexer might be destroyed.)
37423743
assert((returnedToken || !isRawLex) && "Raw lex must succeed");
3743-
3744-
if (returnedToken && Result.isFirstPPToken() && PP &&
3745-
!PP->hasSeenMainFileFirstPPToken())
3746-
PP->HandleMainFileFirstPPToken(Result);
37473744
return returnedToken;
37483745
}
37493746

@@ -4547,8 +4544,6 @@ const char *Lexer::convertDependencyDirectiveToken(
45474544
Result.setFlag((Token::TokenFlags)DDTok.Flags);
45484545
Result.setLength(DDTok.Length);
45494546
BufferPtr = TokPtr + DDTok.Length;
4550-
if (PP && !PP->hasSeenMainFileFirstPPToken() && Result.isFirstPPToken())
4551-
PP->HandleMainFileFirstPPToken(Result);
45524547
return TokPtr;
45534548
}
45544549

clang/lib/Lex/PPDirectives.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,9 +1242,6 @@ void Preprocessor::HandleDirective(Token &Result) {
12421242
// pp-directive.
12431243
bool ReadAnyTokensBeforeDirective =CurPPLexer->MIOpt.getHasReadAnyTokensVal();
12441244

1245-
if (!hasSeenMainFileFirstPPToken())
1246-
HandleMainFileFirstPPToken(Result);
1247-
12481245
// Save the '#' token in case we need to return it later.
12491246
Token SavedHash = Result;
12501247

clang/lib/Lex/PPMacroExpansion.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,6 @@ bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier,
431431
// to disable the optimization in this case.
432432
if (CurPPLexer) CurPPLexer->MIOpt.ExpandedMacro();
433433

434-
if (!hasSeenMainFileFirstPPToken())
435-
HandleMainFileFirstPPToken(Identifier);
436-
437434
// If this is a builtin macro, like __LINE__ or _Pragma, handle it specially.
438435
if (MI->isBuiltinMacro()) {
439436
if (Callbacks)

0 commit comments

Comments
 (0)