Skip to content

Commit e18500e

Browse files
SC llvm teamSC llvm team
SC llvm team
authored and
SC llvm team
committed
Merged main:73ef397fcba35b7b4239c00bf3e0b4e689ca0add into amd-gfx:fd70dbf23e48
Local branch amd-gfx fd70dbf Merged main:fcb3a0485857c749d04ea234a8c3d629c62ab211 into amd-gfx:425372303add Remote branch main 73ef397 [libc][x86] Use prefetch for write for memcpy (llvm#90450)
2 parents fd70dbf + 73ef397 commit e18500e

File tree

48 files changed

+2902
-490
lines changed

Some content is hidden

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

48 files changed

+2902
-490
lines changed

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -323,36 +323,52 @@ bool CheckLive(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
323323
bool CheckConstant(InterpState &S, CodePtr OpPC, const Descriptor *Desc) {
324324
assert(Desc);
325325

326-
auto IsConstType = [&S](const VarDecl *VD) -> bool {
327-
QualType T = VD->getType();
328-
329-
if (T.isConstant(S.getASTContext()))
330-
return true;
331-
332-
if (S.getLangOpts().CPlusPlus && !S.getLangOpts().CPlusPlus11)
333-
return (T->isSignedIntegerOrEnumerationType() ||
334-
T->isUnsignedIntegerOrEnumerationType()) &&
335-
T.isConstQualified();
326+
const auto *D = Desc->asVarDecl();
327+
if (!D || !D->hasGlobalStorage())
328+
return true;
336329

337-
if (T.isConstQualified())
338-
return true;
330+
if (D == S.EvaluatingDecl)
331+
return true;
339332

340-
if (const auto *RT = T->getAs<ReferenceType>())
341-
return RT->getPointeeType().isConstQualified();
333+
if (D->isConstexpr())
334+
return true;
342335

343-
if (const auto *PT = T->getAs<PointerType>())
344-
return PT->getPointeeType().isConstQualified();
336+
QualType T = D->getType();
337+
bool IsConstant = T.isConstant(S.getASTContext());
338+
if (T->isIntegralOrEnumerationType()) {
339+
if (!IsConstant) {
340+
diagnoseNonConstVariable(S, OpPC, D);
341+
return false;
342+
}
343+
return true;
344+
}
345345

346-
return false;
347-
};
346+
if (IsConstant) {
347+
if (S.getLangOpts().CPlusPlus) {
348+
S.CCEDiag(S.Current->getLocation(OpPC),
349+
S.getLangOpts().CPlusPlus11
350+
? diag::note_constexpr_ltor_non_constexpr
351+
: diag::note_constexpr_ltor_non_integral,
352+
1)
353+
<< D << T;
354+
S.Note(D->getLocation(), diag::note_declared_at);
355+
} else {
356+
S.CCEDiag(S.Current->getLocation(OpPC));
357+
}
358+
return true;
359+
}
348360

349-
if (const auto *D = Desc->asVarDecl();
350-
D && D->hasGlobalStorage() && D != S.EvaluatingDecl && !IsConstType(D)) {
351-
diagnoseNonConstVariable(S, OpPC, D);
352-
return false;
361+
if (T->isPointerOrReferenceType()) {
362+
if (!T->getPointeeType().isConstant(S.getASTContext()) ||
363+
!S.getLangOpts().CPlusPlus11) {
364+
diagnoseNonConstVariable(S, OpPC, D);
365+
return false;
366+
}
367+
return true;
353368
}
354369

355-
return true;
370+
diagnoseNonConstVariable(S, OpPC, D);
371+
return false;
356372
}
357373

358374
static bool CheckConstant(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=both,expected -std=c++11 -triple x86_64-linux -pedantic %s
2+
// RUN: %clang_cc1 -verify=both,ref -std=c++11 -triple x86_64-linux -pedantic %s
3+
4+
struct T { int n; };
5+
const T t = { 42 }; // both-note 2{{declared here}}
6+
struct S {
7+
int m : t.n; // both-warning {{width of bit-field 'm' (42 bits)}} \
8+
// both-warning {{expression is not an integral constant expression}} \
9+
// both-note {{read of non-constexpr variable 't' is not allowed}}
10+
};
11+
12+
static_assert(t.n == 42, ""); // both-error {{expression is not an integral constant expression}} \
13+
// both-note {{read of non-constexpr variable 't' is not allowed}}

flang/lib/Lower/OpenMP/DataSharingProcessor.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,7 @@ void DataSharingProcessor::insertBarrier() {
231231
void DataSharingProcessor::insertLastPrivateCompare(mlir::Operation *op) {
232232
mlir::omp::LoopNestOp loopOp;
233233
if (auto wrapper = mlir::dyn_cast<mlir::omp::LoopWrapperInterface>(op))
234-
loopOp = wrapper.isWrapper()
235-
? mlir::cast<mlir::omp::LoopNestOp>(wrapper.getWrappedLoop())
236-
: nullptr;
234+
loopOp = mlir::cast<mlir::omp::LoopNestOp>(wrapper.getWrappedLoop());
237235

238236
bool cmpCreated = false;
239237
mlir::OpBuilder::InsertionGuard guard(firOpBuilder);

0 commit comments

Comments
 (0)