Skip to content

Commit 656f54b

Browse files
author
z1_cciauto
authored
merge main into amd-staging (llvm#2717)
2 parents ac2b7c1 + 5f94bc3 commit 656f54b

File tree

44 files changed

+1800
-347
lines changed

Some content is hidden

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

44 files changed

+1800
-347
lines changed

bolt/test/AArch64/r_aarch64_prelxx.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// REQUIRES: system-linux
66

77
// RUN: %clang %cflags -nostartfiles -nostdlib %s -o %t.exe -mlittle-endian \
8-
// RUN: -Wl,-q -Wl,-z,max-page-size=4
8+
// RUN: -Wl,-q -Wl,-z,max-page-size=4 -Wl,--no-relax
99
// RUN: llvm-readelf -Wa %t.exe | FileCheck %s -check-prefix=CHECKPREL
1010

1111
// CHECKPREL: R_AARCH64_PREL16 {{.*}} .dummy + 0
@@ -36,9 +36,9 @@
3636
.type _start, %function
3737
_start:
3838
adrp x0, datatable
39-
add x0, x0, :lo12:datable
39+
add x0, x0, :lo12:datatable
4040
mov x0, #0
41-
ret
41+
ret
4242

4343
.section .dummy, "a", @progbits
4444
dummy:

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@ Bug Fixes to C++ Support
868868
- Fixed the handling of pack indexing types in the constraints of a member function redeclaration. (#GH138255)
869869
- Clang now correctly parses arbitrary order of ``[[]]``, ``__attribute__`` and ``alignas`` attributes for declarations (#GH133107)
870870
- Fixed a crash when forming an invalid function type in a dependent context. (#GH138657) (#GH115725) (#GH68852)
871+
- Fixed a function declaration mismatch that caused inconsistencies between concepts and variable template declarations. (#GH139476)
871872
- Clang no longer segfaults when there is a configuration mismatch between modules and their users (http://crbug.com/400353616).
872873
- Fix an incorrect deduction when calling an explicit object member function template through an overload set address.
873874
- Fixed bug in constant evaluation that would allow using the value of a

clang/lib/AST/StmtProfile.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,8 +2189,14 @@ StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) {
21892189

21902190
void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) {
21912191
VisitExpr(S);
2192-
VisitNestedNameSpecifier(S->getQualifier());
2193-
VisitName(S->getName(), /*TreatAsDecl*/ true);
2192+
bool DescribingDependentVarTemplate =
2193+
S->getNumDecls() == 1 && isa<VarTemplateDecl>(*S->decls_begin());
2194+
if (DescribingDependentVarTemplate) {
2195+
VisitDecl(*S->decls_begin());
2196+
} else {
2197+
VisitNestedNameSpecifier(S->getQualifier());
2198+
VisitName(S->getName(), /*TreatAsDecl*/ true);
2199+
}
21942200
ID.AddBoolean(S->hasExplicitTemplateArgs());
21952201
if (S->hasExplicitTemplateArgs())
21962202
VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs());

clang/lib/CIR/Dialect/Transforms/CIRSimplify.cpp

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,31 @@ struct SimplifySwitch : public OpRewritePattern<SwitchOp> {
260260
}
261261
};
262262

263+
struct SimplifyVecSplat : public OpRewritePattern<VecSplatOp> {
264+
using OpRewritePattern<VecSplatOp>::OpRewritePattern;
265+
LogicalResult matchAndRewrite(VecSplatOp op,
266+
PatternRewriter &rewriter) const override {
267+
mlir::Value splatValue = op.getValue();
268+
auto constant =
269+
mlir::dyn_cast_if_present<cir::ConstantOp>(splatValue.getDefiningOp());
270+
if (!constant)
271+
return mlir::failure();
272+
273+
auto value = constant.getValue();
274+
if (!mlir::isa_and_nonnull<cir::IntAttr>(value) &&
275+
!mlir::isa_and_nonnull<cir::FPAttr>(value))
276+
return mlir::failure();
277+
278+
cir::VectorType resultType = op.getResult().getType();
279+
SmallVector<mlir::Attribute, 16> elements(resultType.getSize(), value);
280+
auto constVecAttr = cir::ConstVectorAttr::get(
281+
resultType, mlir::ArrayAttr::get(getContext(), elements));
282+
283+
rewriter.replaceOpWithNewOp<cir::ConstantOp>(op, constVecAttr);
284+
return mlir::success();
285+
}
286+
};
287+
263288
//===----------------------------------------------------------------------===//
264289
// CIRSimplifyPass
265290
//===----------------------------------------------------------------------===//
@@ -275,7 +300,8 @@ void populateMergeCleanupPatterns(RewritePatternSet &patterns) {
275300
patterns.add<
276301
SimplifyTernary,
277302
SimplifySelect,
278-
SimplifySwitch
303+
SimplifySwitch,
304+
SimplifyVecSplat
279305
>(patterns.getContext());
280306
// clang-format on
281307
}
@@ -288,7 +314,7 @@ void CIRSimplifyPass::runOnOperation() {
288314
// Collect operations to apply patterns.
289315
llvm::SmallVector<Operation *, 16> ops;
290316
getOperation()->walk([&](Operation *op) {
291-
if (isa<TernaryOp, SelectOp, SwitchOp>(op))
317+
if (isa<TernaryOp, SelectOp, SwitchOp, VecSplatOp>(op))
292318
ops.push_back(op);
293319
});
294320

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -979,9 +979,7 @@ mlir::LogicalResult CIRToLLVMConstantOpLowering::matchAndRewrite(
979979
}
980980

981981
attr = rewriter.getArrayAttr(components);
982-
}
983-
984-
else {
982+
} else {
985983
return op.emitError() << "unsupported constant type " << op.getType();
986984
}
987985

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: cir-opt %s -cir-simplify -o - | FileCheck %s
2+
3+
!s32i = !cir.int<s, 32>
4+
5+
module {
6+
cir.func @fold_shuffle_vector_op_test() -> !cir.vector<4 x !s32i> {
7+
%v = cir.const #cir.int<3> : !s32i
8+
%vec = cir.vec.splat %v : !s32i, !cir.vector<4 x !s32i>
9+
cir.return %vec : !cir.vector<4 x !s32i>
10+
}
11+
12+
// CHECK: cir.func @fold_shuffle_vector_op_test() -> !cir.vector<4 x !s32i> {
13+
// CHECK-NEXT: %0 = cir.const #cir.const_vector<[#cir.int<3> : !s32i, #cir.int<3> : !s32i,
14+
// CHECK-SAME: #cir.int<3> : !s32i, #cir.int<3> : !s32i]> : !cir.vector<4 x !s32i>
15+
// CHECK-NEXT: cir.return %0 : !cir.vector<4 x !s32i>
16+
}

clang/test/SemaCXX/exception-spec.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,24 @@ namespace AssignmentOp {
5252
D2 &operator=(const D2&); // expected-error {{more lax}}
5353
};
5454
}
55+
56+
namespace OverloadedFunctions {
57+
58+
template <typename T>
59+
void f(T&) noexcept;
60+
61+
template <typename T, int N>
62+
void f(T (&arr)[N]) noexcept(noexcept(f(*arr)));
63+
64+
template <typename T>
65+
inline void f(T&) noexcept {}
66+
67+
template <typename T, int N>
68+
inline void f(T (&arr)[N]) noexcept(noexcept(f(*arr))) {}
69+
70+
void g() {
71+
int x[1];
72+
f(x);
73+
}
74+
75+
}

clang/test/SemaTemplate/concepts-out-of-line-def.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,3 +853,18 @@ template <int... Ts>
853853
requires C<Ts...[0]>
854854
auto TplClass<int>::buggy() -> void {}
855855
}
856+
857+
namespace GH139476 {
858+
859+
namespace moo {
860+
template <typename T>
861+
constexpr bool baa = true;
862+
863+
template <typename T> requires baa<T>
864+
void caw();
865+
}
866+
867+
template <typename T> requires moo::baa<T>
868+
void moo::caw() {}
869+
870+
}

compiler-rt/lib/tsan/rtl/tsan_platform.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ bool IsAppMem(uptr mem) { return SelectMapping<IsAppMemImpl>(mem); }
931931
struct IsShadowMemImpl {
932932
template <typename Mapping>
933933
static bool Apply(uptr mem) {
934-
return mem >= Mapping::kShadowBeg && mem <= Mapping::kShadowEnd;
934+
return mem >= Mapping::kShadowBeg && mem < Mapping::kShadowEnd;
935935
}
936936
};
937937

@@ -943,7 +943,7 @@ bool IsShadowMem(RawShadow *p) {
943943
struct IsMetaMemImpl {
944944
template <typename Mapping>
945945
static bool Apply(uptr mem) {
946-
return mem >= Mapping::kMetaShadowBeg && mem <= Mapping::kMetaShadowEnd;
946+
return mem >= Mapping::kMetaShadowBeg && mem < Mapping::kMetaShadowEnd;
947947
}
948948
};
949949

compiler-rt/lib/tsan/rtl/tsan_rtl_access.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ ALWAYS_INLINE USED void UnalignedMemoryAccess(ThreadState* thr, uptr pc,
525525
void ShadowSet(RawShadow* p, RawShadow* end, RawShadow v) {
526526
DCHECK_LE(p, end);
527527
DCHECK(IsShadowMem(p));
528-
DCHECK(IsShadowMem(end));
528+
DCHECK(p == end || IsShadowMem(end - 1));
529529
UNUSED const uptr kAlign = kShadowCnt * kShadowSize;
530530
DCHECK_EQ(reinterpret_cast<uptr>(p) % kAlign, 0);
531531
DCHECK_EQ(reinterpret_cast<uptr>(end) % kAlign, 0);
@@ -669,7 +669,7 @@ void MemoryAccessRangeT(ThreadState* thr, uptr pc, uptr addr, uptr size) {
669669
RawShadow* shadow_mem = MemToShadow(addr);
670670
DPrintf2("#%d: MemoryAccessRange: @%p %p size=%d is_read=%d\n", thr->tid,
671671
(void*)pc, (void*)addr, (int)size, is_read);
672-
672+
DCHECK_NE(size, 0);
673673
#if SANITIZER_DEBUG
674674
if (!IsAppMem(addr)) {
675675
Printf("Access to non app mem start: %p\n", (void*)addr);

0 commit comments

Comments
 (0)