Skip to content

Commit 2a76734

Browse files
authored
merge main into amd-staging (llvm#1216)
2 parents e68153d + cdb355c commit 2a76734

File tree

82 files changed

+792
-443
lines changed

Some content is hidden

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

82 files changed

+792
-443
lines changed

clang/include/clang/Sema/SemaCodeCompletion.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ class SemaCodeCompletion : public SemaBase {
152152
void CodeCompleteDesignator(const QualType BaseType,
153153
llvm::ArrayRef<Expr *> InitExprs,
154154
const Designation &D);
155+
void CodeCompleteKeywordAfterIf(bool AfterExclaim) const;
155156
void CodeCompleteAfterIf(Scope *S, bool IsBracedThen);
156157

157158
void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext,

clang/lib/Parse/ParseStmt.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,6 +1552,11 @@ StmtResult Parser::ParseIfStatement(SourceLocation *TrailingElseLoc) {
15521552
: diag::ext_consteval_if);
15531553
IsConsteval = true;
15541554
ConstevalLoc = ConsumeToken();
1555+
} else if (Tok.is(tok::code_completion)) {
1556+
cutOffParsing();
1557+
Actions.CodeCompletion().CodeCompleteKeywordAfterIf(
1558+
NotLocation.isValid());
1559+
return StmtError();
15551560
}
15561561
}
15571562
if (!IsConsteval && (NotLocation.isValid() || Tok.isNot(tok::l_paren))) {

clang/lib/Sema/SemaCodeComplete.cpp

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6749,6 +6749,52 @@ void SemaCodeCompletion::CodeCompleteInitializer(Scope *S, Decl *D) {
67496749
CodeCompleteExpression(S, Data);
67506750
}
67516751

6752+
void SemaCodeCompletion::CodeCompleteKeywordAfterIf(bool AfterExclaim) const {
6753+
ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
6754+
CodeCompleter->getCodeCompletionTUInfo(),
6755+
CodeCompletionContext::CCC_Other);
6756+
CodeCompletionBuilder Builder(Results.getAllocator(),
6757+
Results.getCodeCompletionTUInfo());
6758+
if (getLangOpts().CPlusPlus17) {
6759+
if (!AfterExclaim) {
6760+
if (Results.includeCodePatterns()) {
6761+
Builder.AddTypedTextChunk("constexpr");
6762+
Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
6763+
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
6764+
Builder.AddPlaceholderChunk("condition");
6765+
Builder.AddChunk(CodeCompletionString::CK_RightParen);
6766+
Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
6767+
Builder.AddChunk(CodeCompletionString::CK_LeftBrace);
6768+
Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
6769+
Builder.AddPlaceholderChunk("statements");
6770+
Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
6771+
Builder.AddChunk(CodeCompletionString::CK_RightBrace);
6772+
Results.AddResult({Builder.TakeString()});
6773+
} else {
6774+
Results.AddResult({"constexpr"});
6775+
}
6776+
}
6777+
}
6778+
if (getLangOpts().CPlusPlus23) {
6779+
if (Results.includeCodePatterns()) {
6780+
Builder.AddTypedTextChunk("consteval");
6781+
Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace);
6782+
Builder.AddChunk(CodeCompletionString::CK_LeftBrace);
6783+
Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
6784+
Builder.AddPlaceholderChunk("statements");
6785+
Builder.AddChunk(CodeCompletionString::CK_VerticalSpace);
6786+
Builder.AddChunk(CodeCompletionString::CK_RightBrace);
6787+
Results.AddResult({Builder.TakeString()});
6788+
} else {
6789+
Results.AddResult({"consteval"});
6790+
}
6791+
}
6792+
6793+
HandleCodeCompleteResults(&SemaRef, CodeCompleter,
6794+
Results.getCompletionContext(), Results.data(),
6795+
Results.size());
6796+
}
6797+
67526798
void SemaCodeCompletion::CodeCompleteAfterIf(Scope *S, bool IsBracedThen) {
67536799
ResultBuilder Results(SemaRef, CodeCompleter->getAllocator(),
67546800
CodeCompleter->getCodeCompletionTUInfo(),

clang/lib/Sema/SemaRISCV.cpp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -687,22 +687,22 @@ bool SemaRISCV::CheckBuiltinFunctionCall(const TargetInfo &TI,
687687
case RISCVVector::BI__builtin_rvv_vaeskf2_vi_tu:
688688
case RISCVVector::BI__builtin_rvv_vaeskf2_vi:
689689
case RISCVVector::BI__builtin_rvv_vsm4k_vi_tu: {
690-
QualType Op1Type = TheCall->getArg(0)->getType();
691-
QualType Op2Type = TheCall->getArg(1)->getType();
692-
return CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Op1Type, 128) ||
693-
CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Op2Type, 128) ||
690+
QualType Arg0Type = TheCall->getArg(0)->getType();
691+
QualType Arg1Type = TheCall->getArg(1)->getType();
692+
return CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Arg0Type, 128) ||
693+
CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Arg1Type, 128) ||
694694
SemaRef.BuiltinConstantArgRange(TheCall, 2, 0, 31);
695695
}
696696
case RISCVVector::BI__builtin_rvv_vsm3c_vi_tu:
697697
case RISCVVector::BI__builtin_rvv_vsm3c_vi: {
698-
QualType Op1Type = TheCall->getArg(0)->getType();
699-
return CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Op1Type, 256) ||
698+
QualType Arg0Type = TheCall->getArg(0)->getType();
699+
return CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Arg0Type, 256) ||
700700
SemaRef.BuiltinConstantArgRange(TheCall, 2, 0, 31);
701701
}
702702
case RISCVVector::BI__builtin_rvv_vaeskf1_vi:
703703
case RISCVVector::BI__builtin_rvv_vsm4k_vi: {
704-
QualType Op1Type = TheCall->getArg(0)->getType();
705-
return CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Op1Type, 128) ||
704+
QualType Arg0Type = TheCall->getArg(0)->getType();
705+
return CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Arg0Type, 128) ||
706706
SemaRef.BuiltinConstantArgRange(TheCall, 1, 0, 31);
707707
}
708708
case RISCVVector::BI__builtin_rvv_vaesdf_vv:
@@ -727,33 +727,34 @@ bool SemaRISCV::CheckBuiltinFunctionCall(const TargetInfo &TI,
727727
case RISCVVector::BI__builtin_rvv_vaesz_vs_tu:
728728
case RISCVVector::BI__builtin_rvv_vsm4r_vv_tu:
729729
case RISCVVector::BI__builtin_rvv_vsm4r_vs_tu: {
730-
QualType Op1Type = TheCall->getArg(0)->getType();
731-
QualType Op2Type = TheCall->getArg(1)->getType();
732-
return CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Op1Type, 128) ||
733-
CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Op2Type, 128);
730+
QualType Arg0Type = TheCall->getArg(0)->getType();
731+
QualType Arg1Type = TheCall->getArg(1)->getType();
732+
return CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Arg0Type, 128) ||
733+
CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Arg1Type, 128);
734734
}
735735
case RISCVVector::BI__builtin_rvv_vsha2ch_vv:
736736
case RISCVVector::BI__builtin_rvv_vsha2cl_vv:
737737
case RISCVVector::BI__builtin_rvv_vsha2ms_vv:
738738
case RISCVVector::BI__builtin_rvv_vsha2ch_vv_tu:
739739
case RISCVVector::BI__builtin_rvv_vsha2cl_vv_tu:
740740
case RISCVVector::BI__builtin_rvv_vsha2ms_vv_tu: {
741-
QualType Op1Type = TheCall->getArg(0)->getType();
742-
QualType Op2Type = TheCall->getArg(1)->getType();
743-
QualType Op3Type = TheCall->getArg(2)->getType();
741+
QualType Arg0Type = TheCall->getArg(0)->getType();
742+
QualType Arg1Type = TheCall->getArg(1)->getType();
743+
QualType Arg2Type = TheCall->getArg(2)->getType();
744744
ASTContext::BuiltinVectorTypeInfo Info =
745-
Context.getBuiltinVectorTypeInfo(Op1Type->castAs<BuiltinType>());
745+
Context.getBuiltinVectorTypeInfo(Arg0Type->castAs<BuiltinType>());
746746
uint64_t ElemSize = Context.getTypeSize(Info.ElementType);
747747
if (ElemSize == 64 && !TI.hasFeature("zvknhb"))
748748
return Diag(TheCall->getBeginLoc(),
749749
diag::err_riscv_builtin_requires_extension)
750750
<< /* IsExtension */ true << TheCall->getSourceRange() << "zvknhb";
751751

752-
return CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Op1Type,
752+
return CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Arg0Type,
753753
ElemSize * 4) ||
754-
CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Op2Type,
754+
CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Arg1Type,
755755
ElemSize * 4) ||
756-
CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Op3Type, ElemSize * 4);
756+
CheckInvalidVLENandLMUL(TI, TheCall, SemaRef, Arg2Type,
757+
ElemSize * 4);
757758
}
758759

759760
case RISCVVector::BI__builtin_rvv_sf_vc_i_se:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
template <bool Flag>
2+
void test() {
3+
if constexpr (Flag) {
4+
return;
5+
}
6+
// RUN: %clang_cc1 -fsyntax-only -std=c++17 -code-completion-at=%s:3:7 %s | FileCheck -check-prefix=CHECK-CXX17 %s
7+
// RUN: %clang_cc1 -fsyntax-only -std=c++17 -code-completion-patterns -code-completion-at=%s:3:7 %s | FileCheck -check-prefix=CHECK-PATTERN-CXX17 %s
8+
// RUN: %clang_cc1 -fsyntax-only -std=c++23 -code-completion-at=%s:3:7 %s | FileCheck -check-prefix=CHECK-CXX23 %s
9+
// RUN: %clang_cc1 -fsyntax-only -std=c++23 -code-completion-patterns -code-completion-at=%s:3:7 %s | FileCheck -check-prefix=CHECK-PATTERN-CXX23 %s
10+
// CHECK-CXX17: COMPLETION: constexpr
11+
// CHECK-PATTERN-CXX17: COMPLETION: Pattern : constexpr (<#condition#>) {
12+
// CHECK-PATTERN-CXX17: <#statements#>
13+
// CHECK-PATTERN-CXX17: }
14+
// CHECK-CXX23: COMPLETION: consteval
15+
// CHECK-CXX23: COMPLETION: constexpr
16+
// CHECK-PATTERN-CXX23: COMPLETION: Pattern : consteval {
17+
// CHECK-PATTERN-CXX23: <#statements#>
18+
// CHECK-PATTERN-CXX23: }
19+
// CHECK-PATTERN-CXX23: COMPLETION: Pattern : constexpr (<#condition#>) {
20+
// CHECK-PATTERN-CXX23: <#statements#>
21+
// CHECK-PATTERN-CXX23: }
22+
if !c
23+
// RUN: %clang_cc1 -fsyntax-only -std=c++23 -code-completion-at=%s:22:8 %s -o - | FileCheck -check-prefix=CHECK-CXX23-EXCLAIM %s
24+
// RUN: %clang_cc1 -fsyntax-only -std=c++23 -code-completion-patterns -code-completion-at=%s:22:8 %s -o - | FileCheck -check-prefix=CHECK-PATTERN-CXX23-EXCLAIM %s
25+
// CHECK-CXX23-EXCLAIM: COMPLETION: consteval
26+
// CHECK-CXX23-EXCLAIM-NOT: constexpr
27+
// CHECK-PATTERN-CXX23-EXCLAIM: COMPLETION: Pattern : consteval {
28+
// CHECK-PATTERN-CXX23-EXCLAIM: <#statements#>
29+
// CHECK-PATTERN-CXX23-EXCLAIM: }
30+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//===- llvm/CodeGen/FEntryInserter.h ----------------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_CODEGEN_FENTRYINSERTER_H
10+
#define LLVM_CODEGEN_FENTRYINSERTER_H
11+
12+
#include "llvm/CodeGen/MachinePassManager.h"
13+
14+
namespace llvm {
15+
16+
class FEntryInserterPass : public PassInfoMixin<FEntryInserterPass> {
17+
public:
18+
PreservedAnalyses run(MachineFunction &MF,
19+
MachineFunctionAnalysisManager &MFAM);
20+
static bool isRequired() { return true; }
21+
};
22+
23+
} // namespace llvm
24+
25+
#endif // LLVM_CODEGEN_FENTRYINSERTER_H

llvm/include/llvm/CodeGen/ModuloSchedule.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ class ModuloScheduleExpander {
188188
/// Instructions to change when emitting the final schedule.
189189
InstrChangesTy InstrChanges;
190190

191+
/// Record the registers that need to compute live intervals.
192+
SmallVector<Register> NoIntervalRegs;
193+
191194
void generatePipelinedLoop();
192195
void generateProlog(unsigned LastStage, MachineBasicBlock *KernelBB,
193196
ValueMapTy *VRMap, MBBVectorTy &PrologBBs);
@@ -211,6 +214,7 @@ class ModuloScheduleExpander {
211214
void addBranches(MachineBasicBlock &PreheaderBB, MBBVectorTy &PrologBBs,
212215
MachineBasicBlock *KernelBB, MBBVectorTy &EpilogBBs,
213216
ValueMapTy *VRMap);
217+
void calculateIntervals();
214218
bool computeDelta(MachineInstr &MI, unsigned &Delta);
215219
void updateMemOperands(MachineInstr &NewMI, MachineInstr &OldMI,
216220
unsigned Num);

llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,12 +586,12 @@ class WrapperFunction<void(SPSTagTs...)>
586586
/// @code{.cpp}
587587
/// class MyClass {
588588
/// public:
589-
/// void myMethod(uint32_t, bool) { ... }
589+
/// std::string myMethod(uint32_t, bool) { ... }
590590
/// };
591591
///
592592
/// // SPS Method signature -- note MyClass object address as first argument.
593593
/// using SPSMyMethodWrapperSignature =
594-
/// SPSTuple<SPSExecutorAddr, uint32_t, bool>;
594+
/// SPSString(SPSExecutorAddr, uint32_t, bool);
595595
///
596596
/// WrapperFunctionResult
597597
/// myMethodCallWrapper(const char *ArgData, size_t ArgSize) {

llvm/include/llvm/InitializePasses.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void initializeExpandPostRALegacyPass(PassRegistry &);
112112
void initializeExpandReductionsPass(PassRegistry &);
113113
void initializeExpandVariadicsPass(PassRegistry &);
114114
void initializeExternalAAWrapperPassPass(PassRegistry &);
115-
void initializeFEntryInserterPass(PassRegistry &);
115+
void initializeFEntryInserterLegacyPass(PassRegistry &);
116116
void initializeFinalizeISelPass(PassRegistry &);
117117
void initializeFinalizeMachineBundlesPass(PassRegistry &);
118118
void initializeFixIrreduciblePass(PassRegistry &);

llvm/include/llvm/MC/MCAsmBackend.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ class MCAsmBackend {
8383
/// \name Target Fixup Interfaces
8484
/// @{
8585

86-
/// Get the number of target specific fixup kinds.
87-
virtual unsigned getNumFixupKinds() const = 0;
88-
8986
/// Map a relocation name used in .reloc to a fixup kind.
9087
virtual std::optional<MCFixupKind> getFixupKind(StringRef Name) const;
9188

@@ -96,7 +93,6 @@ class MCAsmBackend {
9693
virtual bool shouldForceRelocation(const MCAssembler &Asm,
9794
const MCFixup &Fixup,
9895
const MCValue &Target,
99-
const uint64_t Value,
10096
const MCSubtargetInfo *STI) {
10197
return false;
10298
}

0 commit comments

Comments
 (0)