Skip to content

Commit c4d7727

Browse files
author
z1.cciauto
committed
merge main into amd-staging
2 parents fe18234 + 6182015 commit c4d7727

File tree

94 files changed

+1018
-690
lines changed

Some content is hidden

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

94 files changed

+1018
-690
lines changed

clang/lib/AST/Decl.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,9 @@ void LinkageComputer::mergeTemplateLV(
400400
FunctionTemplateDecl *temp = specInfo->getTemplate();
401401
// Merge information from the template declaration.
402402
LinkageInfo tempLV = getLVForDecl(temp, computation);
403-
// The linkage and visibility of the specialization should be
404-
// consistent with the template declaration.
405-
LV.mergeMaybeWithVisibility(tempLV, considerVisibility);
403+
// The linkage of the specialization should be consistent with the
404+
// template declaration.
405+
LV.setLinkage(tempLV.getLinkage());
406406

407407
// Merge information from the template parameters.
408408
LinkageInfo paramsLV =
@@ -1051,13 +1051,6 @@ LinkageComputer::getLVForClassMember(const NamedDecl *D,
10511051
if (const auto *redeclTemp = dyn_cast<RedeclarableTemplateDecl>(temp)) {
10521052
if (isExplicitMemberSpecialization(redeclTemp)) {
10531053
explicitSpecSuppressor = temp->getTemplatedDecl();
1054-
} else if (const RedeclarableTemplateDecl *from =
1055-
redeclTemp->getInstantiatedFromMemberTemplate()) {
1056-
// If no explicit visibility is specified yet, and this is an
1057-
// instantiated member of a template, look up visibility there
1058-
// as well.
1059-
LinkageInfo fromLV = from->getLinkageAndVisibility();
1060-
LV.mergeMaybeWithVisibility(fromLV, considerVisibility);
10611054
}
10621055
}
10631056
}

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5495,12 +5495,12 @@ bool Sema::CheckCallingConvAttr(const ParsedAttr &Attrs, CallingConv &CC,
54955495

54965496
TargetInfo::CallingConvCheckResult A = TargetInfo::CCCR_OK;
54975497
const TargetInfo &TI = Context.getTargetInfo();
5498+
auto *Aux = Context.getAuxTargetInfo();
54985499
// CUDA functions may have host and/or device attributes which indicate
54995500
// their targeted execution environment, therefore the calling convention
55005501
// of functions in CUDA should be checked against the target deduced based
55015502
// on their host/device attributes.
55025503
if (LangOpts.CUDA) {
5503-
auto *Aux = Context.getAuxTargetInfo();
55045504
assert(FD || CFT != CUDAFunctionTarget::InvalidTarget);
55055505
auto CudaTarget = FD ? CUDA().IdentifyTarget(FD) : CFT;
55065506
bool CheckHost = false, CheckDevice = false;
@@ -5525,6 +5525,15 @@ bool Sema::CheckCallingConvAttr(const ParsedAttr &Attrs, CallingConv &CC,
55255525
A = HostTI->checkCallingConvention(CC);
55265526
if (A == TargetInfo::CCCR_OK && CheckDevice && DeviceTI)
55275527
A = DeviceTI->checkCallingConvention(CC);
5528+
} else if (LangOpts.SYCLIsDevice && TI.getTriple().isAMDGPU() &&
5529+
CC == CC_X86VectorCall) {
5530+
// Assuming SYCL Device AMDGPU CC_X86VectorCall functions are always to be
5531+
// emitted on the host. The MSVC STL has CC-based specializations so we
5532+
// cannot change the CC to be the default as that will cause a clash with
5533+
// another specialization.
5534+
A = TI.checkCallingConvention(CC);
5535+
if (Aux && A != TargetInfo::CCCR_OK)
5536+
A = Aux->checkCallingConvention(CC);
55285537
} else {
55295538
A = TI.checkCallingConvention(CC);
55305539
}

clang/test/CodeGenCXX/visibility.cpp

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,45 +1457,9 @@ namespace test71 {
14571457
// CHECK-LABEL: declare hidden noundef i32 @_ZN6test713fooIiE3zedEv(
14581458
// CHECK-LABEL: define linkonce_odr noundef i32 @_ZN6test713fooIiE3barIiEET_v(
14591459
// CHECK-LABEL: define linkonce_odr hidden noundef i64 @_ZN6test713fooIlE3zedEv(
1460-
// CHECK-LABEL: define linkonce_odr hidden noundef i32 @_ZN6test713fooIlE3barIiEET_v(
1460+
// CHECK-LABEL: define linkonce_odr noundef i32 @_ZN6test713fooIlE3barIiEET_v(
14611461
// CHECK-HIDDEN-LABEL: declare hidden noundef i32 @_ZN6test713fooIiE3zedEv(
14621462
// CHECK-HIDDEN-LABEL: define linkonce_odr noundef i32 @_ZN6test713fooIiE3barIiEET_v(
14631463
// CHECK-HIDDEN-LABEL: define linkonce_odr hidden noundef i64 @_ZN6test713fooIlE3zedEv(
14641464
// CHECK-HIDDEN-LABEL: define linkonce_odr hidden noundef i32 @_ZN6test713fooIlE3barIiEET_v(
14651465
}
1466-
1467-
// https://github.com/llvm/llvm-project/issues/103477
1468-
namespace test72 {
1469-
template <class a>
1470-
struct t {
1471-
template <int>
1472-
static HIDDEN void bar() {}
1473-
};
1474-
1475-
void test() {
1476-
t<char>::bar<1>();
1477-
}
1478-
// CHECK-LABEL: define linkonce_odr hidden void @_ZN6test721tIcE3barILi1EEEvv(
1479-
// CHECK-HIDDEN-LABEL: define linkonce_odr hidden void @_ZN6test721tIcE3barILi1EEEvv(
1480-
}
1481-
1482-
// https://github.com/llvm/llvm-project/issues/31462
1483-
namespace test73 {
1484-
template <class T> struct s {
1485-
template <class U>
1486-
__attribute__((__visibility__("hidden"))) U should_not_be_exported();
1487-
};
1488-
1489-
template <class T> template <class U> U s<T>::should_not_be_exported() {
1490-
return U();
1491-
}
1492-
1493-
extern template struct __attribute__((__visibility__("default"))) s<int>;
1494-
1495-
int f() {
1496-
s<int> o;
1497-
return o.should_not_be_exported<int>();
1498-
}
1499-
// CHECK-LABEL: define linkonce_odr noundef i32 @_ZN6test731sIiE22should_not_be_exportedIiEET_v(
1500-
// CHECK-HIDDEN-LABEL: define linkonce_odr noundef i32 @_ZN6test731sIiE22should_not_be_exportedIiEET_v(
1501-
}

clang/test/Format/lit.local.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import platform
23
import lit.formats
34

@@ -27,3 +28,8 @@ config.suffixes = [
2728
# python implementation does, so use that for cross platform compatibility
2829
if platform.system() == "AIX":
2930
config.test_format = lit.formats.ShTest()
31+
32+
# Create an empty .clang-format-ignore file so that tests don't get messed
33+
# up if one exists higher in the tree
34+
with open(".clang-format-ignore", 'w'):
35+
pass
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
template <typename F> struct A{};
3+
4+
template <typename Ret, typename C, typename... Args> struct A<Ret ( C::*)(Args...) noexcept> { static constexpr int value = 0; };
5+
template <typename Ret, typename C, typename... Args> struct A<Ret (__vectorcall C::*)(Args...) noexcept> { static constexpr int value = 1; };
6+
7+
template <typename F> constexpr int A_v = A<F>::value;
8+
9+
struct B
10+
{
11+
void f() noexcept {}
12+
void __vectorcall g() noexcept {}
13+
};
14+
15+
int main()
16+
{
17+
return A_v<decltype(&B::f)> + A_v<decltype(&B::g)>;
18+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: %clang_cc1 -isystem %S/Inputs/ -fsycl-is-device -triple amdgcn-amd-hsa -aux-triple x86_64-pc-windows-msvc -fsyntax-only -verify %s
2+
3+
// expected-no-diagnostics
4+
5+
#include <vectorcall.hpp>

flang-rt/include/flang-rt/runtime/io-stmt.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "flang/Common/optional.h"
2121
#include "flang/Common/reference-wrapper.h"
2222
#include "flang/Common/visit.h"
23+
#include "flang/Runtime/freestanding-tools.h"
2324
#include "flang/Runtime/io-api.h"
2425
#include <flang/Common/variant.h>
2526
#include <functional>
@@ -180,8 +181,8 @@ class IoStatementState {
180181

181182
private:
182183
RT_API_ATTRS void CheckForAsterisk() {
183-
hasAsterisk_ =
184-
at_ && at_ < limit_ && std::memchr(at_, '*', limit_ - at_) != nullptr;
184+
hasAsterisk_ = at_ && at_ < limit_ &&
185+
runtime::memchr(at_, '*', limit_ - at_) != nullptr;
185186
}
186187

187188
ConnectionState &connection_;

flang/lib/Optimizer/CodeGen/LowerRepackArrays.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ class LowerRepackArraysPass
357357
patterns.insert<PackArrayConversion>(context);
358358
patterns.insert<UnpackArrayConversion>(context);
359359
mlir::GreedyRewriteConfig config;
360-
config.setRegionSimplificationLevel(
361-
mlir::GreedySimplifyRegionLevel::Disabled);
360+
config.enableRegionSimplification =
361+
mlir::GreedySimplifyRegionLevel::Disabled;
362362
(void)applyPatternsGreedily(module, std::move(patterns), config);
363363
}
364364

flang/lib/Optimizer/HLFIR/Transforms/InlineElementals.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ class InlineElementalsPass
119119

120120
mlir::GreedyRewriteConfig config;
121121
// Prevent the pattern driver from merging blocks.
122-
config.setRegionSimplificationLevel(
123-
mlir::GreedySimplifyRegionLevel::Disabled);
122+
config.enableRegionSimplification =
123+
mlir::GreedySimplifyRegionLevel::Disabled;
124124

125125
mlir::RewritePatternSet patterns(context);
126126
patterns.insert<InlineElementalConversion>(context);

flang/lib/Optimizer/HLFIR/Transforms/InlineHLFIRAssign.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ class InlineHLFIRAssignPass
135135

136136
mlir::GreedyRewriteConfig config;
137137
// Prevent the pattern driver from merging blocks.
138-
config.setRegionSimplificationLevel(
139-
mlir::GreedySimplifyRegionLevel::Disabled);
138+
config.enableRegionSimplification =
139+
mlir::GreedySimplifyRegionLevel::Disabled;
140140

141141
mlir::RewritePatternSet patterns(context);
142142
patterns.insert<InlineHLFIRAssignConversion>(context);

0 commit comments

Comments
 (0)