Skip to content

Commit

Permalink
merge main into amd-stg-open
Browse files Browse the repository at this point in the history
Change-Id: I599afc0889875f67cb856a87fd9ec19229588d65
  • Loading branch information
Jenkins committed Nov 6, 2023
2 parents 3d351c2 + 07f5cf1 commit e936e2f
Show file tree
Hide file tree
Showing 121 changed files with 3,798 additions and 2,022 deletions.
7 changes: 2 additions & 5 deletions clang/lib/AST/Interp/ByteCodeExprGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,13 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
if (!this->visit(SubExpr))
return false;

if (FromT == ToT) {
assert(ToT != PT_IntAP && ToT != PT_IntAPS);
return true;
}

if (ToT == PT_IntAP)
return this->emitCastAP(*FromT, Ctx.getBitWidth(CE->getType()), CE);
if (ToT == PT_IntAPS)
return this->emitCastAPS(*FromT, Ctx.getBitWidth(CE->getType()), CE);

if (FromT == ToT)
return true;
return this->emitCast(*FromT, *ToT, CE);
}

Expand Down
11 changes: 11 additions & 0 deletions clang/test/AST/Interp/intap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ static_assert(UBitIntZero1 == 0, "");
constexpr unsigned _BitInt(2) BI1 = 3u;
static_assert(BI1 == 3, "");

namespace APCast {
constexpr _BitInt(10) A = 1;
constexpr _BitInt(11) B = A;
static_assert(B == 1, "");
constexpr _BitInt(16) B2 = A;
static_assert(B2 == 1, "");
constexpr _BitInt(32) B3 = A;
static_assert(B3 == 1, "");
constexpr unsigned _BitInt(32) B4 = A;
static_assert(B4 == 1, "");
}

#ifdef __SIZEOF_INT128__
namespace i128 {
Expand Down
2 changes: 0 additions & 2 deletions flang/include/flang/Optimizer/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ std::unique_ptr<mlir::Pass>
createAlgebraicSimplificationPass(const mlir::GreedyRewriteConfig &config);
std::unique_ptr<mlir::Pass> createPolymorphicOpConversionPass();

std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
createOMPEarlyOutliningPass();
std::unique_ptr<mlir::Pass> createOMPFunctionFilteringPass();
std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
createOMPMarkDeclareTargetPass();
Expand Down
12 changes: 0 additions & 12 deletions flang/include/flang/Optimizer/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -318,18 +318,6 @@ def LoopVersioning : Pass<"loop-versioning", "mlir::func::FuncOp"> {
let dependentDialects = [ "fir::FIROpsDialect" ];
}

def OMPEarlyOutliningPass
: Pass<"omp-early-target-outlining", "mlir::ModuleOp"> {
let summary = "Outlines all target ops into separate functions";
let description = [{
This pass outlines all omp.target operations into individual functions.
It is invoked in the front end after the initial FIR has been constructed.
This pass is only needed when compiling for the target device to prevent
the optimizer to perform transforms across target region boundaries.
}];
let constructor = "::fir::createOMPEarlyOutliningPass()";
}

def OMPMarkDeclareTargetPass
: Pass<"omp-mark-declare-target", "mlir::ModuleOp"> {
let summary = "Marks all functions called by an OpenMP declare target function as declare target";
Expand Down
4 changes: 1 addition & 3 deletions flang/include/flang/Tools/CLOptions.inc
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,8 @@ inline void createHLFIRToFIRPassPipeline(
inline void createOpenMPFIRPassPipeline(
mlir::PassManager &pm, bool isTargetDevice) {
pm.addPass(fir::createOMPMarkDeclareTargetPass());
if (isTargetDevice) {
pm.addPass(fir::createOMPEarlyOutliningPass());
if (isTargetDevice)
pm.addPass(fir::createOMPFunctionFilteringPass());
}
}

#if !defined(FLANG_EXCLUDE_CODEGEN)
Expand Down
8 changes: 6 additions & 2 deletions flang/lib/Lower/ConvertVariable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1645,9 +1645,13 @@ void Fortran::lower::genDeclareSymbol(
!sym.detailsIf<Fortran::semantics::CommonBlockDetails>()) {
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
const mlir::Location loc = genLocation(converter, sym);
// FIXME: Using the ultimate symbol for translating symbol attributes will
// lead to situations where the VOLATILE/ASYNCHRONOUS attributes are not
// propagated to the hlfir.declare (these attributes can be added when
// using module variables).
fir::FortranVariableFlagsAttr attributes =
Fortran::lower::translateSymbolAttributes(builder.getContext(), sym,
extraFlags);
Fortran::lower::translateSymbolAttributes(
builder.getContext(), sym.GetUltimate(), extraFlags);
auto name = converter.mangleName(sym);
hlfir::EntityWithAttributes declare =
hlfir::genDeclare(loc, builder, exv, name, attributes);
Expand Down
Loading

0 comments on commit e936e2f

Please sign in to comment.