Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
65b2793
[Flang][Fir] Fix the error when lowering `fir.iterate_while` to `scf …
NexMing Dec 4, 2025
6f8e17c
[libc] make clock_conversion.h common and document it (#167723)
bojle Dec 4, 2025
e933ccd
[AMDGPU][GlobalISel] Fix / workaround amdgcn.kill/.unreachable loweri…
ro-i Dec 4, 2025
e56611c
[MLIR][LLVM] Fix the import of LLVM IR metadata (#170631)
gysit Dec 4, 2025
e7f3226
[DAGCombiner] Handle type-promoted constants in SDIV exact lowering (…
SavchenkoValeriy Dec 4, 2025
cc92552
[MLIR] Apply clang-tidy fixes for readability-identifier-naming in In…
joker-eph Aug 21, 2025
bc2a64f
[InferAlignment] Enhance alignment propagation for and(ptrtoint, con…
egorshamshura Dec 4, 2025
81a0863
[clang-tidy] fix false negatives in readability-redundant-casting whe…
HerrCai0907 Dec 4, 2025
b8b7eda
AMDGPU: Use correct chain when emitting error on a call (#170645)
arsenm Dec 4, 2025
e502dce
[SLP][NFC]Simplify analysis of the scalars, NFC.
alexey-bataev Dec 4, 2025
5c6918f
[DAGCombiner] Allow promoted constants in MULHU by power-of-2 -> SRL …
SavchenkoValeriy Dec 4, 2025
04bc0af
[flang][OpenMP] Expand GetOmpObjectList to all subclasses of OmpClaus…
kparzysz Dec 4, 2025
b31a398
[MLIR][NVVM] Fix wmma test after d3edc94d (#170659)
sohaibiftikhar Dec 4, 2025
9a23702
Add parentheses around '&&' within '||' (#170652)
kwk Dec 4, 2025
9a64c9f
[Hexagon] Fix assert: = -> == (#170643)
kwk Dec 4, 2025
f49504a
[Hexagon] Fix assignment (#170646)
kwk Dec 4, 2025
9f42291
[NVGPU] Fix nvdsl examples - take 2 (#167321)
castigli Dec 4, 2025
184416b
[LIBC][BUILD] Fix deps after 6f8e17c9 (#170661)
sohaibiftikhar Dec 4, 2025
3402391
[flang] Enable Driver/exec.f90 test (NFC) (#170544)
kkwli Dec 4, 2025
9ad9572
[X86] wide-scalar-shift-by-byte-multiple-legalization.ll - cleanup ch…
RKSimon Dec 4, 2025
5b87337
[lldb][windows] fix copying instead of using a reference of STARTUPIN…
charles-zablit Dec 4, 2025
07e63a3
[SPIR-V] Move ASSIGN_TYPE generation to PostLegalizer (#169696)
s-perron Dec 4, 2025
d8b43ed
[libc][wctype] Add cmake flag for configuring wctype implementation u…
mleleszi Dec 4, 2025
4f0eee3
[Github] Make issue-write cat all comments
boomanaiden154 Dec 4, 2025
e8defb5
[libc][math] Refactor expm1 implementation to header-only in src/__su…
bassiounix Dec 4, 2025
a2a3d89
[SLP][NFC]Hoist invariant request for user nodes out of the loop, NFC
alexey-bataev Dec 4, 2025
dddaefb
merge main into amd-staging
z1-cciauto Dec 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/issue-write.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,4 @@ jobs:
if: >-
always() &&
steps.download-artifact.outputs.artifact-ids != ''
run: cat comments
run: cat comments*
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "RedundantCastingCheck.h"
#include "../utils/FixItHintUtils.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/TypeBase.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"

Expand All @@ -29,7 +30,7 @@ static bool areTypesEqual(QualType S, QualType D) {
const QualType PtrD = D->getPointeeType();

if (!PtrS.isNull() && !PtrD.isNull())
return areTypesEqual(PtrS, PtrD);
return areTypesEqual(PtrS.IgnoreParens(), PtrD.IgnoreParens());

const DeducedType *DT = S->getContainedDeducedType();
if (DT && DT->isDeduced())
Expand Down
4 changes: 4 additions & 0 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,10 @@ Changes in existing checks
<clang-tidy/checks/readability/qualified-auto>` check by adding the option
`IgnoreAliasing`, that allows not looking at underlying types of type aliases.

- Improved :doc:`readability-redundant-casting
<clang-tidy/checks/readability/redundant-casting>` check by fixing false
negatives when explicitly cast from function pointer.

- Improved :doc:`readability-uppercase-literal-suffix
<clang-tidy/checks/readability/uppercase-literal-suffix>` check to recognize
literal suffixes added in C++23 and C23.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,13 @@ void testRedundantDependentNTTPCasting() {
// CHECK-MESSAGES: :[[@LINE-4]]:25: note: source type originates from referencing this non-type template parameter
// CHECK-FIXES: T a = V;
}

namespace gh170476 {
int f(void);
int g1() {
int (*fp)() = (int(*)(void))&f;
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: redundant explicit casting to the same type 'int (*)()' as the sub-expression, remove this casting [readability-redundant-casting]
// CHECK-FIXES: int (*fp)() = (&f);
return fp();
}
} // namespace gh170476
1 change: 0 additions & 1 deletion flang-rt/test/Driver/exec.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
! REQUIRES: flang-rt
! UNSUPPORTED: offload-cuda

! Verify that flang can correctly build executables.
Expand Down
82 changes: 82 additions & 0 deletions flang/include/flang/Parser/openmp-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define FORTRAN_PARSER_OPENMP_UTILS_H

#include "flang/Common/indirection.h"
#include "flang/Common/template.h"
#include "flang/Parser/parse-tree.h"
#include "llvm/Frontend/OpenMP/OMP.h"

Expand Down Expand Up @@ -127,7 +128,88 @@ template <typename T> struct IsStatement<Statement<T>> {
std::optional<Label> GetStatementLabel(const ExecutionPartConstruct &x);
std::optional<Label> GetFinalLabel(const OpenMPConstruct &x);

namespace detail {
// Clauses with flangClass = "OmpObjectList".
using MemberObjectListClauses =
std::tuple<OmpClause::Copyin, OmpClause::Copyprivate, OmpClause::Exclusive,
OmpClause::Firstprivate, OmpClause::HasDeviceAddr, OmpClause::Inclusive,
OmpClause::IsDevicePtr, OmpClause::Link, OmpClause::Private,
OmpClause::Shared, OmpClause::UseDeviceAddr, OmpClause::UseDevicePtr>;

// Clauses with flangClass = "OmpSomeClause", and OmpObjectList a
// member of tuple OmpSomeClause::t.
using TupleObjectListClauses = std::tuple<OmpClause::AdjustArgs,
OmpClause::Affinity, OmpClause::Aligned, OmpClause::Allocate,
OmpClause::Enter, OmpClause::From, OmpClause::InReduction,
OmpClause::Lastprivate, OmpClause::Linear, OmpClause::Map,
OmpClause::Reduction, OmpClause::TaskReduction, OmpClause::To>;

// Does U have WrapperTrait (i.e. has a member 'v'), and if so, is T the
// type of v?
template <typename T, typename U, bool IsWrapper> struct WrappedInType {
static constexpr bool value{false};
};

template <typename T, typename U> struct WrappedInType<T, U, true> {
static constexpr bool value{std::is_same_v<T, decltype(U::v)>};
};

// Same as WrappedInType, but with a list of types Us. Satisfied if any
// type U in Us satisfies WrappedInType<T, U>.
template <typename...> struct WrappedInTypes;

template <typename T> struct WrappedInTypes<T> {
static constexpr bool value{false};
};

template <typename T, typename U, typename... Us>
struct WrappedInTypes<T, U, Us...> {
static constexpr bool value{WrappedInType<T, U, WrapperTrait<U>>::value ||
WrappedInTypes<T, Us...>::value};
};

// Same as WrappedInTypes, but takes type list in a form of a tuple or
// a variant.
template <typename...> struct WrappedInTupleOrVariant {
static constexpr bool value{false};
};
template <typename T, typename... Us>
struct WrappedInTupleOrVariant<T, std::tuple<Us...>> {
static constexpr bool value{WrappedInTypes<T, Us...>::value};
};
template <typename T, typename... Us>
struct WrappedInTupleOrVariant<T, std::variant<Us...>> {
static constexpr bool value{WrappedInTypes<T, Us...>::value};
};
template <typename T, typename U>
constexpr bool WrappedInTupleOrVariantV{WrappedInTupleOrVariant<T, U>::value};
} // namespace detail

template <typename T> const OmpObjectList *GetOmpObjectList(const T &clause) {
using namespace detail;
static_assert(std::is_class_v<T>, "Unexpected argument type");

if constexpr (common::HasMember<T, decltype(OmpClause::u)>) {
if constexpr (common::HasMember<T, MemberObjectListClauses>) {
return &clause.v;
} else if constexpr (common::HasMember<T, TupleObjectListClauses>) {
return &std::get<OmpObjectList>(clause.v.t);
} else {
return nullptr;
}
} else if constexpr (WrappedInTupleOrVariantV<T, TupleObjectListClauses>) {
return &std::get<OmpObjectList>(clause.t);
} else if constexpr (WrappedInTupleOrVariantV<T, decltype(OmpClause::u)>) {
return nullptr;
} else {
// The condition should be type-dependent, but it should always be false.
static_assert(sizeof(T) < 0 && "Unexpected argument type");
}
}

const OmpObjectList *GetOmpObjectList(const OmpClause &clause);
const OmpObjectList *GetOmpObjectList(const OmpClause::Depend &clause);
const OmpObjectList *GetOmpObjectList(const OmpDependClause::TaskDep &x);

template <typename T>
const T *GetFirstArgument(const OmpDirectiveSpecification &spec) {
Expand Down
14 changes: 10 additions & 4 deletions flang/lib/Optimizer/Transforms/FIRToSCF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ struct IterWhileConversion : public mlir::OpRewritePattern<fir::IterWhileOp> {

mlir::Value okInit = iterWhileOp.getIterateIn();
mlir::ValueRange iterArgs = iterWhileOp.getInitArgs();
bool hasFinalValue = iterWhileOp.getFinalValue().has_value();

mlir::SmallVector<mlir::Value> initVals;
initVals.push_back(lowerBound);
Expand Down Expand Up @@ -164,17 +165,22 @@ struct IterWhileConversion : public mlir::OpRewritePattern<fir::IterWhileOp> {

auto *afterBody = scfWhileOp.getAfterBody();
auto resultOp = mlir::cast<fir::ResultOp>(afterBody->getTerminator());
mlir::SmallVector<mlir::Value> results(resultOp->getOperands());
mlir::Value ivInAfter = scfWhileOp.getAfterArguments()[0];
mlir::SmallVector<mlir::Value> results;
mlir::Value iv = scfWhileOp.getAfterArguments()[0];

rewriter.setInsertionPointToStart(afterBody);
results[0] = mlir::arith::AddIOp::create(rewriter, loc, ivInAfter, step);
results.push_back(mlir::arith::AddIOp::create(rewriter, loc, iv, step));
llvm::append_range(results, hasFinalValue
? resultOp->getOperands().drop_front()
: resultOp->getOperands());

rewriter.setInsertionPointToEnd(afterBody);
rewriter.replaceOpWithNewOp<mlir::scf::YieldOp>(resultOp, results);

scfWhileOp->setAttrs(iterWhileOp->getAttrs());
rewriter.replaceOp(iterWhileOp, scfWhileOp);
rewriter.replaceOp(iterWhileOp,
hasFinalValue ? scfWhileOp->getResults()
: scfWhileOp->getResults().drop_front());
return mlir::success();
}
};
Expand Down
45 changes: 11 additions & 34 deletions flang/lib/Parser/openmp-utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,43 +117,20 @@ std::optional<Label> GetFinalLabel(const OpenMPConstruct &x) {
}

const OmpObjectList *GetOmpObjectList(const OmpClause &clause) {
// Clauses with OmpObjectList as its data member
using MemberObjectListClauses = std::tuple<OmpClause::Copyin,
OmpClause::Copyprivate, OmpClause::Exclusive, OmpClause::Firstprivate,
OmpClause::HasDeviceAddr, OmpClause::Inclusive, OmpClause::IsDevicePtr,
OmpClause::Link, OmpClause::Private, OmpClause::Shared,
OmpClause::UseDeviceAddr, OmpClause::UseDevicePtr>;

// Clauses with OmpObjectList in the tuple
using TupleObjectListClauses = std::tuple<OmpClause::AdjustArgs,
OmpClause::Affinity, OmpClause::Aligned, OmpClause::Allocate,
OmpClause::Enter, OmpClause::From, OmpClause::InReduction,
OmpClause::Lastprivate, OmpClause::Linear, OmpClause::Map,
OmpClause::Reduction, OmpClause::TaskReduction, OmpClause::To>;

// TODO:: Generate the tuples using TableGen.
return common::visit([](auto &&s) { return GetOmpObjectList(s); }, clause.u);
}

const OmpObjectList *GetOmpObjectList(const OmpClause::Depend &clause) {
return common::visit(
common::visitors{
[&](const OmpClause::Depend &x) -> const OmpObjectList * {
if (auto *taskDep{std::get_if<OmpDependClause::TaskDep>(&x.v.u)}) {
return &std::get<OmpObjectList>(taskDep->t);
} else {
return nullptr;
}
},
[&](const auto &x) -> const OmpObjectList * {
using Ty = std::decay_t<decltype(x)>;
if constexpr (common::HasMember<Ty, MemberObjectListClauses>) {
return &x.v;
} else if constexpr (common::HasMember<Ty,
TupleObjectListClauses>) {
return &std::get<OmpObjectList>(x.v.t);
} else {
return nullptr;
}
},
[](const OmpDoacross &) { return nullptr; },
[](const OmpDependClause::TaskDep &x) { return GetOmpObjectList(x); },
},
clause.u);
clause.v.u);
}

const OmpObjectList *GetOmpObjectList(const OmpDependClause::TaskDep &x) {
return &std::get<OmpObjectList>(x.t);
}

const BlockConstruct *GetFortranBlockConstruct(
Expand Down
9 changes: 3 additions & 6 deletions flang/lib/Semantics/check-omp-loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,8 @@ void OmpStructureChecker::CheckDistLinear(

// Collect symbols of all the variables from linear clauses
for (auto &clause : clauses.v) {
if (auto *linearClause{std::get_if<parser::OmpClause::Linear>(&clause.u)}) {
auto &objects{std::get<parser::OmpObjectList>(linearClause->v.t)};
GetSymbolsInObjectList(objects, indexVars);
if (std::get_if<parser::OmpClause::Linear>(&clause.u)) {
GetSymbolsInObjectList(*parser::omp::GetOmpObjectList(clause), indexVars);
}
}

Expand Down Expand Up @@ -604,8 +603,6 @@ void OmpStructureChecker::Leave(const parser::OpenMPLoopConstruct &x) {
auto *maybeModifier{OmpGetUniqueModifier<ReductionModifier>(modifiers)};
if (maybeModifier &&
maybeModifier->v == ReductionModifier::Value::Inscan) {
const auto &objectList{
std::get<parser::OmpObjectList>(reductionClause->v.t)};
auto checkReductionSymbolInScan = [&](const parser::Name *name) {
if (auto &symbol = name->symbol) {
if (!symbol->test(Symbol::Flag::OmpInclusiveScan) &&
Expand All @@ -618,7 +615,7 @@ void OmpStructureChecker::Leave(const parser::OpenMPLoopConstruct &x) {
}
}
};
for (const auto &ompObj : objectList.v) {
for (const auto &ompObj : parser::omp::GetOmpObjectList(clause)->v) {
common::visit(
common::visitors{
[&](const parser::Designator &designator) {
Expand Down
Loading