Skip to content

Commit 616d08b

Browse files
authored
Merge branch 'main' into dag-visitfreeze-unused
2 parents 9e66944 + 148fd6e commit 616d08b

File tree

86 files changed

+1843
-385
lines changed

Some content is hidden

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

86 files changed

+1843
-385
lines changed

.github/workflows/build-ci-container-windows.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ on:
1111
- .github/workflows/build-ci-container-windows.yml
1212
- '.github/workflows/containers/github-action-ci-windows/**'
1313
pull_request:
14-
branches:
15-
- main
1614
paths:
1715
- .github/workflows/build-ci-container-windows.yml
1816
- '.github/workflows/containers/github-action-ci-windows/**'

.github/workflows/build-ci-container.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ on:
1111
- .github/workflows/build-ci-container.yml
1212
- '.github/workflows/containers/github-action-ci/**'
1313
pull_request:
14-
branches:
15-
- main
1614
paths:
1715
- .github/workflows/build-ci-container.yml
1816
- '.github/workflows/containers/github-action-ci/**'

clang/include/clang/Sema/Overload.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,8 +1491,6 @@ class Sema;
14911491
OverloadingResult
14921492
BestViableFunctionImpl(Sema &S, SourceLocation Loc,
14931493
OverloadCandidateSet::iterator &Best);
1494-
void PerfectViableFunction(Sema &S, SourceLocation Loc,
1495-
OverloadCandidateSet::iterator &Best);
14961494
};
14971495

14981496
bool isBetterOverloadCandidate(Sema &S, const OverloadCandidate &Cand1,

clang/lib/Sema/SemaOverload.cpp

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11354,55 +11354,18 @@ OverloadingResult OverloadCandidateSet::BestViableFunction(Sema &S,
1135411354
DeferredCandidatesCount != 0 && !ResolutionByPerfectCandidateIsDisabled;
1135511355

1135611356
if (TwoPhaseResolution) {
11357-
11358-
PerfectViableFunction(S, Loc, Best);
11359-
if (Best != end())
11360-
return ResultForBestCandidate(Best);
11357+
OverloadingResult Res = BestViableFunctionImpl(S, Loc, Best);
11358+
if (Best != end() && Best->isPerfectMatch(S.Context)) {
11359+
if (!(HasDeferredTemplateConstructors &&
11360+
isa_and_nonnull<CXXConversionDecl>(Best->Function)))
11361+
return Res;
11362+
}
1136111363
}
1136211364

1136311365
InjectNonDeducedTemplateCandidates(S);
1136411366
return BestViableFunctionImpl(S, Loc, Best);
1136511367
}
1136611368

11367-
void OverloadCandidateSet::PerfectViableFunction(
11368-
Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best) {
11369-
11370-
Best = end();
11371-
for (auto It = Candidates.begin(); It != Candidates.end(); ++It) {
11372-
11373-
if (!It->isPerfectMatch(S.getASTContext()))
11374-
continue;
11375-
11376-
// We found a suitable conversion function
11377-
// but if there is a template constructor in the target class
11378-
// we might prefer that instead.
11379-
if (HasDeferredTemplateConstructors &&
11380-
isa_and_nonnull<CXXConversionDecl>(It->Function)) {
11381-
Best = end();
11382-
break;
11383-
}
11384-
11385-
if (Best == end()) {
11386-
Best = It;
11387-
continue;
11388-
}
11389-
if (Best->Function && It->Function) {
11390-
FunctionDecl *D =
11391-
S.getMoreConstrainedFunction(Best->Function, It->Function);
11392-
if (D == nullptr) {
11393-
Best = end();
11394-
break;
11395-
}
11396-
if (D == It->Function)
11397-
Best = It;
11398-
continue;
11399-
}
11400-
// ambiguous
11401-
Best = end();
11402-
break;
11403-
}
11404-
}
11405-
1140611369
OverloadingResult OverloadCandidateSet::BestViableFunctionImpl(
1140711370
Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best) {
1140811371

clang/test/CodeGenOpenCL/builtins-amdgcn-gfx1250.cl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
66

7+
typedef unsigned int uint;
78
typedef half __attribute__((ext_vector_type(2))) half2;
89

910
// CHECK-LABEL: @test_setprio_inc_wg(
@@ -42,6 +43,24 @@ void test_s_wait_tensorcnt() {
4243
__builtin_amdgcn_s_wait_tensorcnt(0);
4344
}
4445

46+
// CHECK-LABEL: @test_prng_b32(
47+
// CHECK-NEXT: entry:
48+
// CHECK-NEXT: [[OUT_ADDR:%.*]] = alloca ptr addrspace(1), align 8, addrspace(5)
49+
// CHECK-NEXT: [[A_ADDR:%.*]] = alloca i32, align 4, addrspace(5)
50+
// CHECK-NEXT: [[OUT_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[OUT_ADDR]] to ptr
51+
// CHECK-NEXT: [[A_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[A_ADDR]] to ptr
52+
// CHECK-NEXT: store ptr addrspace(1) [[OUT:%.*]], ptr [[OUT_ADDR_ASCAST]], align 8
53+
// CHECK-NEXT: store i32 [[A:%.*]], ptr [[A_ADDR_ASCAST]], align 4
54+
// CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[A_ADDR_ASCAST]], align 4
55+
// CHECK-NEXT: [[TMP1:%.*]] = call i32 @llvm.amdgcn.prng.b32(i32 [[TMP0]])
56+
// CHECK-NEXT: [[TMP2:%.*]] = load ptr addrspace(1), ptr [[OUT_ADDR_ASCAST]], align 8
57+
// CHECK-NEXT: store i32 [[TMP1]], ptr addrspace(1) [[TMP2]], align 4
58+
// CHECK-NEXT: ret void
59+
//
60+
void test_prng_b32(global uint* out, uint a) {
61+
*out = __builtin_amdgcn_prng_b32(a);
62+
}
63+
4564
// CHECK-LABEL: @test_tanh_f32(
4665
// CHECK-NEXT: entry:
4766
// CHECK-NEXT: [[OUT_ADDR:%.*]] = alloca ptr addrspace(1), align 8, addrspace(5)

clang/test/Sema/dllexport.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
// RUN: %clang_cc1 -triple x86_64-win32 -fsyntax-only -fms-extensions -verify -std=c11 %s
33
// RUN: %clang_cc1 -triple i686-mingw32 -fsyntax-only -fms-extensions -verify -std=c11 %s
44
// RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -fms-extensions -verify -std=c99 %s
5+
// RUN: %clang_cc1 -triple i686-windows-itanium -fsyntax-only -fms-extensions -verify -std=c99 %s
6+
// RUN: %clang_cc1 -triple x86_64-windows-itanium -fsyntax-only -fms-extensions -verify -std=c11 %s
7+
// RUN: %clang_cc1 -triple x86_64-sie-ps5 -fsyntax-only -fms-extensions -verify -std=c99 %s
8+
// RUN: %clang_cc1 -triple x86_64-sie-ps5 -fsyntax-only -fms-extensions -verify -std=c11 %s
59

610
// Invalid usage.
711
__declspec(dllexport) typedef int typedef1;

clang/test/SemaCXX/overload-resolution-deferred-templates.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,31 @@ void f() {
283283
}
284284

285285
#endif
286+
287+
namespace GH147374 {
288+
289+
struct String {};
290+
template <typename T> void operator+(T, String &&) = delete;
291+
292+
struct Bar {
293+
void operator+(String) const; // expected-note {{candidate function}}
294+
friend void operator+(Bar, String) {}; // expected-note {{candidate function}}
295+
};
296+
297+
struct Baz {
298+
void operator+(String); // expected-note {{candidate function}}
299+
friend void operator+(Baz, String) {}; // expected-note {{candidate function}}
300+
};
301+
302+
void test() {
303+
Bar a;
304+
String b;
305+
a + b;
306+
//expected-error@-1 {{use of overloaded operator '+' is ambiguous (with operand types 'Bar' and 'String')}}
307+
308+
Baz z;
309+
z + b;
310+
//expected-error@-1 {{use of overloaded operator '+' is ambiguous (with operand types 'Baz' and 'String')}}
311+
}
312+
313+
}

flang/lib/Lower/Bridge.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,8 +1466,9 @@ class FirConverter : public Fortran::lower::AbstractConverter {
14661466
assert(falseTarget && "missing conditional branch false block");
14671467
mlir::Location loc = toLocation();
14681468
mlir::Value bcc = builder->createConvert(loc, builder->getI1Type(), cond);
1469-
builder->create<mlir::cf::CondBranchOp>(loc, bcc, trueTarget, std::nullopt,
1470-
falseTarget, std::nullopt);
1469+
builder->create<mlir::cf::CondBranchOp>(loc, bcc, trueTarget,
1470+
mlir::ValueRange{}, falseTarget,
1471+
mlir::ValueRange{});
14711472
}
14721473
void genConditionalBranch(mlir::Value cond,
14731474
Fortran::lower::pft::Evaluation *trueTarget,
@@ -2556,8 +2557,8 @@ class FirConverter : public Fortran::lower::AbstractConverter {
25562557
builder->setInsertionPointToEnd(loopWrapperOp.getBody());
25572558
auto loopOp = builder->create<fir::DoConcurrentLoopOp>(
25582559
loc, nestLBs, nestUBs, nestSts, /*loopAnnotation=*/nullptr,
2559-
/*local_vars=*/std::nullopt,
2560-
/*local_syms=*/nullptr, /*reduce_vars=*/std::nullopt,
2560+
/*local_vars=*/mlir::ValueRange{},
2561+
/*local_syms=*/nullptr, /*reduce_vars=*/mlir::ValueRange{},
25612562
/*reduce_byref=*/nullptr, /*reduce_syms=*/nullptr,
25622563
/*reduce_attrs=*/nullptr);
25632564

@@ -3810,9 +3811,9 @@ class FirConverter : public Fortran::lower::AbstractConverter {
38103811
mlir::Block *selectCaseBlock = insertBlock(blockList[0]);
38113812
mlir::Block *assumedSizeBlock =
38123813
rankStarBlock ? rankStarBlock : defaultBlock;
3813-
builder->create<mlir::cf::CondBranchOp>(loc, isAssumedSize,
3814-
assumedSizeBlock, std::nullopt,
3815-
selectCaseBlock, std::nullopt);
3814+
builder->create<mlir::cf::CondBranchOp>(
3815+
loc, isAssumedSize, assumedSizeBlock, mlir::ValueRange{},
3816+
selectCaseBlock, mlir::ValueRange{});
38163817
startBlock(selectCaseBlock);
38173818
}
38183819
// Create fir.select_case for the other rank cases.

flang/lib/Lower/ConvertConstant.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ createStringLitOp(fir::FirOpBuilder &builder, mlir::Location loc,
303303
mlir::NamedAttribute sizeAttr(sizeTag, builder.getI64IntegerAttr(len));
304304
llvm::SmallVector<mlir::NamedAttribute> attrs = {dataAttr, sizeAttr};
305305
return builder.create<fir::StringLitOp>(
306-
loc, llvm::ArrayRef<mlir::Type>{type}, std::nullopt, attrs);
306+
loc, llvm::ArrayRef<mlir::Type>{type}, mlir::ValueRange{}, attrs);
307307
}
308308
}
309309

flang/lib/Lower/ConvertExpr.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,9 +1003,9 @@ class ScalarExprLowering {
10031003
},
10041004
[&](const fir::MutableBoxValue &toBox) {
10051005
if (toBox.isPointer()) {
1006-
Fortran::lower::associateMutableBox(converter, loc, toBox, expr,
1007-
/*lbounds=*/std::nullopt,
1008-
stmtCtx);
1006+
Fortran::lower::associateMutableBox(
1007+
converter, loc, toBox, expr,
1008+
/*lbounds=*/mlir::ValueRange{}, stmtCtx);
10091009
return;
10101010
}
10111011
// For allocatable components, a deep copy is needed.
@@ -3604,8 +3604,9 @@ class ArrayExprLowering {
36043604
mlir::Value castTo =
36053605
builder.createConvert(loc, fir::HeapType::get(seqTy), load);
36063606
mlir::Value shapeOp = builder.genShape(loc, shape);
3607-
return builder.create<fir::ArrayLoadOp>(
3608-
loc, seqTy, castTo, shapeOp, /*slice=*/mlir::Value{}, std::nullopt);
3607+
return builder.create<fir::ArrayLoadOp>(loc, seqTy, castTo, shapeOp,
3608+
/*slice=*/mlir::Value{},
3609+
mlir::ValueRange{});
36093610
};
36103611
// Custom lowering of the element store to deal with the extra indirection
36113612
// to the lazy allocated buffer.
@@ -4207,7 +4208,7 @@ class ArrayExprLowering {
42074208
auto addr =
42084209
builder->create<fir::ArrayCoorOp>(loc, eleRefTy, tmp, shape,
42094210
/*slice=*/mlir::Value{}, indices,
4210-
/*typeParams=*/std::nullopt);
4211+
/*typeParams=*/mlir::ValueRange{});
42114212
auto load = builder->create<fir::LoadOp>(loc, addr);
42124213
return builder->createConvert(loc, i1Ty, load);
42134214
};
@@ -4522,17 +4523,18 @@ class ArrayExprLowering {
45224523
fir::isRecordWithAllocatableMember(eleTy))
45234524
TODO(loc, "creating an array temp where the element type has "
45244525
"allocatable members");
4525-
mlir::Value temp = !seqTy.hasDynamicExtents()
4526-
? builder.create<fir::AllocMemOp>(loc, type)
4527-
: builder.create<fir::AllocMemOp>(
4528-
loc, type, ".array.expr", std::nullopt, shape);
4526+
mlir::Value temp =
4527+
!seqTy.hasDynamicExtents()
4528+
? builder.create<fir::AllocMemOp>(loc, type)
4529+
: builder.create<fir::AllocMemOp>(loc, type, ".array.expr",
4530+
mlir::ValueRange{}, shape);
45294531
fir::FirOpBuilder *bldr = &converter.getFirOpBuilder();
45304532
stmtCtx.attachCleanup(
45314533
[bldr, loc, temp]() { bldr->create<fir::FreeMemOp>(loc, temp); });
45324534
mlir::Value shapeOp = genShapeOp(shape);
45334535
return builder.create<fir::ArrayLoadOp>(loc, seqTy, temp, shapeOp,
45344536
/*slice=*/mlir::Value{},
4535-
std::nullopt);
4537+
mlir::ValueRange{});
45364538
}
45374539

45384540
static fir::ShapeOp genShapeOp(mlir::Location loc, fir::FirOpBuilder &builder,
@@ -6483,7 +6485,7 @@ class ArrayExprLowering {
64836485
mlir::Value initBuffSz =
64846486
builder.createIntegerConstant(loc, idxTy, clInitialBufferSize);
64856487
mem = builder.create<fir::AllocMemOp>(
6486-
loc, eleTy, /*typeparams=*/std::nullopt, initBuffSz);
6488+
loc, eleTy, /*typeparams=*/mlir::ValueRange{}, initBuffSz);
64876489
builder.create<fir::StoreOp>(loc, initBuffSz, buffSize);
64886490
}
64896491
} else {

0 commit comments

Comments
 (0)