Skip to content

Commit e0384a7

Browse files
author
z1_cciauto
authored
merge main into amd-staging (llvm#2965)
2 parents 3c0058c + a7cf78f commit e0384a7

File tree

196 files changed

+4586
-1458
lines changed

Some content is hidden

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

196 files changed

+4586
-1458
lines changed

clang/docs/DebuggingCoroutines.rst

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,24 @@ important. This member identifies the suspension point at which the coroutine
209209
is currently suspended.
210210

211211
However, it is non-trivial to map this number back to a source code location.
212-
In simple cases, one might correctly guess the source code location. In more
213-
complex cases, we can modify the C++ code to store additional information in
214-
the promise type:
212+
The compiler emits debug info labels for the suspension points. This allows us
213+
to map the suspension point index back to a source code location. In gdb, we
214+
can use the ``info line`` command to get the source code location of the
215+
suspension point.
216+
217+
::
218+
219+
(gdb) info line -function coro_task -label __coro_resume_2
220+
Line 45 of "llvm-example.cpp" starts at address 0x1b1b <_ZL9coro_taski.resume+555> and ends at 0x1b46 <_ZL9coro_taski.resume+598>.
221+
Line 45 of "llvm-example.cpp" starts at address 0x201b <_ZL9coro_taski.destroy+555> and ends at 0x2046 <_ZL9coro_taski.destroy+598>.
222+
Line 45 of "llvm-example.cpp" starts at address 0x253b <_ZL9coro_taski.cleanup+555> and ends at 0x2566 <_ZL9coro_taski.cleanup+598>.
223+
224+
LLDB does not support looking up labels. Furthmore, those labels are only emitted
225+
starting with clang 21.0.
226+
227+
For simple cases, you might still be able to guess the suspension point correctly.
228+
Alternatively, you might also want to modify your coroutine library to store
229+
the line number of the current suspension point in the promise:
215230

216231
.. code-block:: c++
217232

@@ -221,8 +236,6 @@ the promise type:
221236
void* _coro_return_address = nullptr;
222237
};
223238

224-
#include <source_location>
225-
226239
// For all the awaiter types we need:
227240
class awaiter {
228241
...

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,7 @@ Bug Fixes to C++ Support
915915
- Fixed a crash when constant evaluating some explicit object member assignment operators. (#GH142835)
916916
- Fixed an access checking bug when substituting into concepts (#GH115838)
917917
- Fix a bug where private access specifier of overloaded function not respected. (#GH107629)
918+
- Correctly handle allocations in the condition of a ``if constexpr``.(#GH120197) (#GH134820)
918919

919920
Bug Fixes to AST Handling
920921
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6519,11 +6519,11 @@ AST_POLYMORPHIC_MATCHER(
65196519
/// Given
65206520
/// \code
65216521
/// void a(int);
6522-
/// void b(long);
6522+
/// void b(unsigned long);
65236523
/// void c(double);
65246524
/// \endcode
65256525
/// functionDecl(hasAnyParameter(hasType(isInteger())))
6526-
/// matches "a(int)", "b(long)", but not "c(double)".
6526+
/// matches "a(int)", "b(unsigned long)", but not "c(double)".
65276527
AST_MATCHER(QualType, isInteger) {
65286528
return Node->isIntegerType();
65296529
}

clang/include/clang/Parse/ParseHLSLRootSignature.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ namespace hlsl {
2727

2828
class RootSignatureParser {
2929
public:
30-
RootSignatureParser(SmallVector<llvm::hlsl::rootsig::RootElement> &Elements,
30+
RootSignatureParser(llvm::dxbc::RootSignatureVersion Version,
31+
SmallVector<llvm::hlsl::rootsig::RootElement> &Elements,
3132
RootSignatureLexer &Lexer, clang::Preprocessor &PP);
3233

3334
/// Consumes tokens from the Lexer and constructs the in-memory
@@ -187,6 +188,7 @@ class RootSignatureParser {
187188
bool tryConsumeExpectedToken(ArrayRef<RootSignatureToken::Kind> Expected);
188189

189190
private:
191+
llvm::dxbc::RootSignatureVersion Version;
190192
SmallVector<llvm::hlsl::rootsig::RootElement> &Elements;
191193
RootSignatureLexer &Lexer;
192194

clang/include/clang/Sema/Sema.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7723,12 +7723,12 @@ class Sema final : public SemaBase {
77237723

77247724
class ConditionResult {
77257725
Decl *ConditionVar;
7726-
FullExprArg Condition;
7726+
ExprResult Condition;
77277727
bool Invalid;
77287728
std::optional<bool> KnownValue;
77297729

77307730
friend class Sema;
7731-
ConditionResult(Sema &S, Decl *ConditionVar, FullExprArg Condition,
7731+
ConditionResult(Sema &S, Decl *ConditionVar, ExprResult Condition,
77327732
bool IsConstexpr)
77337733
: ConditionVar(ConditionVar), Condition(Condition), Invalid(false) {
77347734
if (IsConstexpr && Condition.get()) {
@@ -7739,7 +7739,7 @@ class Sema final : public SemaBase {
77397739
}
77407740
}
77417741
explicit ConditionResult(bool Invalid)
7742-
: ConditionVar(nullptr), Condition(nullptr), Invalid(Invalid),
7742+
: ConditionVar(nullptr), Condition(Invalid), Invalid(Invalid),
77437743
KnownValue(std::nullopt) {}
77447744

77457745
public:

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5836,6 +5836,8 @@ bool Compiler<Emitter>::compileConstructor(const CXXConstructorDecl *Ctor) {
58365836
return false;
58375837

58385838
if (R->isUnion() && Ctor->isCopyOrMoveConstructor()) {
5839+
if (R->getNumFields() == 0)
5840+
return this->emitRetVoid(Ctor);
58395841
// union copy and move ctors are special.
58405842
assert(cast<CompoundStmt>(Ctor->getBody())->body_empty());
58415843
if (!this->emitThis(Ctor))

clang/lib/AST/TextNodeDumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "clang/Basic/Specifiers.h"
2525
#include "clang/Basic/TypeTraits.h"
2626
#include "llvm/ADT/StringExtras.h"
27-
#include "llvm/Frontend/HLSL/HLSLRootSignatureUtils.h"
27+
#include "llvm/Frontend/HLSL/HLSLRootSignature.h"
2828

2929
#include <algorithm>
3030
#include <utility>

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5670,8 +5670,9 @@ void CGDebugInfo::EmitLabel(const LabelDecl *D, CGBuilderTy &Builder) {
56705670
StringRef Name = D->getName();
56715671

56725672
// Create the descriptor for the label.
5673-
auto *L =
5674-
DBuilder.createLabel(Scope, Name, Unit, Line, CGM.getLangOpts().Optimize);
5673+
auto *L = DBuilder.createLabel(
5674+
Scope, Name, Unit, Line, Column, /*IsArtificial=*/false,
5675+
/*CoroSuspendIdx=*/std::nullopt, CGM.getLangOpts().Optimize);
56755676

56765677
// Insert an llvm.dbg.label into the current block.
56775678
DBuilder.insertLabel(L,

clang/lib/CodeGen/CGHLSLRuntime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "clang/AST/Type.h"
2424
#include "clang/Basic/TargetOptions.h"
2525
#include "llvm/ADT/SmallVector.h"
26-
#include "llvm/Frontend/HLSL/HLSLRootSignatureUtils.h"
26+
#include "llvm/Frontend/HLSL/RootSignatureMetadata.h"
2727
#include "llvm/IR/Constants.h"
2828
#include "llvm/IR/DerivedTypes.h"
2929
#include "llvm/IR/GlobalVariable.h"

clang/lib/CodeGen/TargetBuiltins/ARM.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,8 @@ static const ARMVectorIntrinsicInfo ARMSIMDIntrinsicMap [] = {
845845
NEONMAP0(vrndiq_v),
846846
NEONMAP1(vrndm_v, floor, Add1ArgType),
847847
NEONMAP1(vrndmq_v, floor, Add1ArgType),
848-
NEONMAP1(vrndn_v, arm_neon_vrintn, Add1ArgType),
849-
NEONMAP1(vrndnq_v, arm_neon_vrintn, Add1ArgType),
848+
NEONMAP1(vrndn_v, roundeven, Add1ArgType),
849+
NEONMAP1(vrndnq_v, roundeven, Add1ArgType),
850850
NEONMAP1(vrndp_v, ceil, Add1ArgType),
851851
NEONMAP1(vrndpq_v, ceil, Add1ArgType),
852852
NEONMAP1(vrndq_v, trunc, Add1ArgType),
@@ -3132,7 +3132,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
31323132
case NEON::BI__builtin_neon_vrndns_f32: {
31333133
Value *Arg = EmitScalarExpr(E->getArg(0));
31343134
llvm::Type *Tys[] = {Arg->getType()};
3135-
Function *F = CGM.getIntrinsic(Intrinsic::arm_neon_vrintn, Tys);
3135+
Function *F = CGM.getIntrinsic(Intrinsic::roundeven, Tys);
31363136
return Builder.CreateCall(F, {Arg}, "vrndn"); }
31373137

31383138
case NEON::BI__builtin_neon_vset_lane_i8:

0 commit comments

Comments
 (0)