Skip to content

Commit 2c6620f

Browse files
committed
merge main into amd-staging
2 parents 2e92145 + 6bf0c46 commit 2c6620f

File tree

132 files changed

+6409
-3902
lines changed

Some content is hidden

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

132 files changed

+6409
-3902
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,6 @@ Improvements to Clang's diagnostics
236236
under the subgroup ``-Wunsafe-buffer-usage-in-libc-call``.
237237
- Diagnostics on chained comparisons (``a < b < c``) are now an error by default. This can be disabled with
238238
``-Wno-error=parentheses``.
239-
- Adds an error diagnostic for out of bounds vector accesses; produces an error
240-
for compile time statically provable out of bounds vector accesses.
241239
- The ``-Wshift-bool`` warning has been added to warn about shifting a boolean. (#GH28334)
242240
- Fixed diagnostics adding a trailing ``::`` when printing some source code
243241
constructs, like base classes.

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10691,9 +10691,6 @@ def err_block_on_vm : Error<
1069110691
def err_sizeless_nonlocal : Error<
1069210692
"non-local variable with sizeless type %0">;
1069310693

10694-
def err_vector_index_out_of_range : Error<
10695-
"vector element index %0 is out of bounds">;
10696-
1069710694
def err_vec_builtin_non_vector : Error<
1069810695
"%select{first two|all}1 arguments to %0 must be vectors">;
1069910696
def err_vec_builtin_incompatible_vector : Error<

clang/include/clang/Sema/Sema.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2468,7 +2468,6 @@ class Sema final : public SemaBase {
24682468
const ArraySubscriptExpr *ASE = nullptr,
24692469
bool AllowOnePastEnd = true, bool IndexNegated = false);
24702470
void CheckArrayAccess(const Expr *E);
2471-
void CheckVectorAccess(const Expr *BaseExpr, const Expr *IndexExpr);
24722471

24732472
bool CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall,
24742473
const FunctionProtoType *Proto);

clang/lib/Sema/SemaChecking.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14055,23 +14055,6 @@ void Sema::CheckCastAlign(Expr *Op, QualType T, SourceRange TRange) {
1405514055
<< TRange << Op->getSourceRange();
1405614056
}
1405714057

14058-
void Sema::CheckVectorAccess(const Expr *BaseExpr, const Expr *IndexExpr) {
14059-
const auto *VTy = BaseExpr->getType()->getAs<VectorType>();
14060-
if (!VTy)
14061-
return;
14062-
14063-
Expr::EvalResult Result;
14064-
if (!IndexExpr->EvaluateAsInt(Result, Context, Expr::SE_AllowSideEffects))
14065-
return;
14066-
14067-
unsigned DiagID = diag::err_vector_index_out_of_range;
14068-
14069-
llvm::APSInt index = Result.Val.getInt();
14070-
if (index.isNegative() || index >= VTy->getNumElements())
14071-
Diag(BaseExpr->getBeginLoc(), DiagID) << toString(index, 10, true);
14072-
return;
14073-
}
14074-
1407514058
void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
1407614059
const ArraySubscriptExpr *ASE,
1407714060
bool AllowOnePastEnd, bool IndexNegated) {
@@ -14086,12 +14069,6 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
1408614069
const Type *EffectiveType =
1408714070
BaseExpr->getType()->getPointeeOrArrayElementType();
1408814071
BaseExpr = BaseExpr->IgnoreParenCasts();
14089-
14090-
if (BaseExpr->getType()->isVectorType()) {
14091-
CheckVectorAccess(BaseExpr, IndexExpr);
14092-
return;
14093-
}
14094-
1409514072
const ConstantArrayType *ArrayTy =
1409614073
Context.getAsConstantArrayType(BaseExpr->getType());
1409714074

clang/test/CodeGenCXX/x86_64-arguments.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,6 @@ union U {
215215
float f1;
216216
char __attribute__((__vector_size__(1))) f2;
217217
};
218-
int f(union U u) { return u.f2[0]; }
218+
int f(union U u) { return u.f2[1]; }
219219
// CHECK-LABEL: define{{.*}} i32 @_ZN6test111fENS_1UE(i32
220220
}

clang/test/SemaHLSL/Language/VectorOutOfRange-errors.hlsl

Lines changed: 0 additions & 19 deletions
This file was deleted.

flang/lib/Lower/OpenMP/ClauseProcessor.cpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,24 @@ void ClauseProcessor::processMapObjects(
928928
llvm::SmallVectorImpl<const semantics::Symbol *> &mapSyms,
929929
llvm::StringRef mapperIdNameRef) const {
930930
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
931+
932+
// Create the mapper symbol from its name, if specified.
931933
mlir::FlatSymbolRefAttr mapperId;
932-
std::string mapperIdName = mapperIdNameRef.str();
934+
if (!mapperIdNameRef.empty() && !objects.empty()) {
935+
std::string mapperIdName = mapperIdNameRef.str();
936+
if (mapperIdName == "default") {
937+
const omp::Object &object = objects.front();
938+
auto &typeSpec = object.sym()->owner().IsDerivedType()
939+
? *object.sym()->owner().derivedTypeSpec()
940+
: object.sym()->GetType()->derivedTypeSpec();
941+
mapperIdName = typeSpec.name().ToString() + ".default";
942+
mapperIdName = converter.mangleName(mapperIdName, *typeSpec.GetScope());
943+
}
944+
assert(converter.getModuleOp().lookupSymbol(mapperIdName) &&
945+
"mapper not found");
946+
mapperId =
947+
mlir::FlatSymbolRefAttr::get(&converter.getMLIRContext(), mapperIdName);
948+
}
933949

934950
for (const omp::Object &object : objects) {
935951
llvm::SmallVector<mlir::Value> bounds;
@@ -962,20 +978,6 @@ void ClauseProcessor::processMapObjects(
962978
}
963979
}
964980

965-
if (!mapperIdName.empty()) {
966-
if (mapperIdName == "default") {
967-
auto &typeSpec = object.sym()->owner().IsDerivedType()
968-
? *object.sym()->owner().derivedTypeSpec()
969-
: object.sym()->GetType()->derivedTypeSpec();
970-
mapperIdName = typeSpec.name().ToString() + ".default";
971-
mapperIdName = converter.mangleName(mapperIdName, *typeSpec.GetScope());
972-
}
973-
assert(converter.getModuleOp().lookupSymbol(mapperIdName) &&
974-
"mapper not found");
975-
mapperId = mlir::FlatSymbolRefAttr::get(&converter.getMLIRContext(),
976-
mapperIdName);
977-
mapperIdName.clear();
978-
}
979981
// Explicit map captures are captured ByRef by default,
980982
// optimisation passes may alter this to ByCopy or other capture
981983
// types to optimise

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,6 +2404,24 @@ void OmpAttributeVisitor::ResolveOmpObjectList(
24042404
}
24052405
}
24062406

2407+
/// True if either symbol is in a namelist or some other symbol in the same
2408+
/// equivalence set as symbol is in a namelist.
2409+
static bool SymbolOrEquivalentIsInNamelist(const Symbol &symbol) {
2410+
auto isInNamelist{[](const Symbol &sym) {
2411+
const Symbol &ultimate{sym.GetUltimate()};
2412+
return ultimate.test(Symbol::Flag::InNamelist);
2413+
}};
2414+
2415+
const EquivalenceSet *eqv{FindEquivalenceSet(symbol)};
2416+
if (!eqv) {
2417+
return isInNamelist(symbol);
2418+
}
2419+
2420+
return llvm::any_of(*eqv, [isInNamelist](const EquivalenceObject &obj) {
2421+
return isInNamelist(obj.symbol);
2422+
});
2423+
}
2424+
24072425
void OmpAttributeVisitor::ResolveOmpObject(
24082426
const parser::OmpObject &ompObject, Symbol::Flag ompFlag) {
24092427
common::visit(
@@ -2468,15 +2486,14 @@ void OmpAttributeVisitor::ResolveOmpObject(
24682486
.str()));
24692487
}
24702488
if (ompFlag == Symbol::Flag::OmpReduction) {
2471-
const Symbol &ultimateSymbol{symbol->GetUltimate()};
24722489
// Using variables inside of a namelist in OpenMP reductions
24732490
// is allowed by the standard, but is not allowed for
24742491
// privatisation. This looks like an oversight. If the
24752492
// namelist is hoisted to a global, we cannot apply the
24762493
// mapping for the reduction variable: resulting in incorrect
24772494
// results. Disabling this hoisting could make some real
24782495
// production code go slower. See discussion in #109303
2479-
if (ultimateSymbol.test(Symbol::Flag::InNamelist)) {
2496+
if (SymbolOrEquivalentIsInNamelist(*symbol)) {
24802497
context_.Say(name->source,
24812498
"Variable '%s' in NAMELIST cannot be in a REDUCTION clause"_err_en_US,
24822499
name->ToString());
@@ -2838,7 +2855,7 @@ void OmpAttributeVisitor::CheckObjectIsPrivatizable(
28382855
clauseName = "LASTPRIVATE";
28392856
}
28402857

2841-
if (ultimateSymbol.test(Symbol::Flag::InNamelist)) {
2858+
if (SymbolOrEquivalentIsInNamelist(symbol)) {
28422859
context_.Say(name.source,
28432860
"Variable '%s' in NAMELIST cannot be in a %s clause"_err_en_US,
28442861
name.ToString(), clauseName.str());
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2+
3+
! The openmp standard only dissallows namelist for privatization, but flang
4+
! also does not allow it for reduction as this would be difficult to support.
5+
!
6+
! Variables in equivalence with variables in the namelist pose the same
7+
! implementation problems.
8+
9+
subroutine test01()
10+
integer::va
11+
equivalence (va,vva)
12+
namelist /na1/vva
13+
va=1
14+
15+
!ERROR: Variable 'va' in NAMELIST cannot be in a REDUCTION clause
16+
!$omp parallel reduction(+:va)
17+
write(*,na1)
18+
!$omp end parallel
19+
end subroutine test01
20+
21+
22+
subroutine test02()
23+
integer::va
24+
equivalence (va,vva)
25+
namelist /na1/vva
26+
va=1
27+
28+
!ERROR: Variable 'va' in NAMELIST cannot be in a PRIVATE clause
29+
!$omp parallel private(va)
30+
write(*,na1)
31+
!$omp end parallel
32+
end subroutine test02

lldb/include/lldb/Target/Language.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -354,14 +354,13 @@ class Language : public PluginInterface {
354354

355355
virtual llvm::StringRef GetInstanceVariableName() { return {}; }
356356

357-
/// Returns true if this SymbolContext should be ignored when setting
358-
/// breakpoints by line (number or regex). Helpful for languages that create
359-
/// artificial functions without meaningful user code associated with them
360-
/// (e.g. code that gets expanded in late compilation stages, like by
361-
/// CoroSplitter).
362-
virtual bool IgnoreForLineBreakpoints(const SymbolContext &) const {
363-
return false;
364-
}
357+
/// Given a symbol context list of matches which supposedly represent the
358+
/// same file and line number in a CU, erases those that should be ignored
359+
/// when setting breakpoints by line (number or regex). Helpful for languages
360+
/// that create split a single source-line into many functions (e.g. call
361+
/// sites transformed by CoroSplitter).
362+
virtual void
363+
FilterForLineBreakpoints(llvm::SmallVectorImpl<SymbolContext> &) const {}
365364

366365
/// Returns a boolean indicating whether two symbol contexts are equal for the
367366
/// purposes of frame comparison. If the plugin has no opinion, it should

0 commit comments

Comments
 (0)