-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[flang] [acc] [NFC] Remove dead code after acc cache directive TODO #170729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-flang-fir-hlfir Author: Zhen Wang (wangzpgi) ChangesRemove unreachable code after the TODO in the acc cache directive lowering function. Full diff: https://github.com/llvm/llvm-project/pull/170729.diff 1 Files Affected:
diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index 5a548f4fcf435..50b08cea12004 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -4786,39 +4786,8 @@ static void
genACC(Fortran::lower::AbstractConverter &converter,
Fortran::semantics::SemanticsContext &semanticsContext,
const Fortran::parser::OpenACCCacheConstruct &cacheConstruct) {
- fir::FirOpBuilder &builder = converter.getFirOpBuilder();
mlir::Location loc = converter.genLocation(cacheConstruct.source);
TODO(loc, "OpenACC cache directive");
- auto loopOp = builder.getRegion().getParentOfType<mlir::acc::LoopOp>();
- auto crtPos = builder.saveInsertionPoint();
- if (loopOp) {
- builder.setInsertionPoint(loopOp);
- Fortran::lower::StatementContext stmtCtx;
- llvm::SmallVector<mlir::Value> cacheOperands;
- const Fortran::parser::AccObjectListWithModifier &listWithModifier =
- std::get<Fortran::parser::AccObjectListWithModifier>(cacheConstruct.t);
- const auto &accObjectList =
- std::get<Fortran::parser::AccObjectList>(listWithModifier.t);
- const auto &modifier =
- std::get<std::optional<Fortran::parser::AccDataModifier>>(
- listWithModifier.t);
-
- mlir::acc::DataClause dataClause = mlir::acc::DataClause::acc_cache;
- if (modifier &&
- (*modifier).v == Fortran::parser::AccDataModifier::Modifier::ReadOnly)
- dataClause = mlir::acc::DataClause::acc_cache_readonly;
- genDataOperandOperations<mlir::acc::CacheOp>(
- accObjectList, converter, semanticsContext, stmtCtx, cacheOperands,
- dataClause,
- /*structured=*/true, /*implicit=*/false,
- /*async=*/{}, /*asyncDeviceTypes=*/{}, /*asyncOnlyDeviceTypes=*/{},
- /*setDeclareAttr*/ false);
- loopOp.getCacheOperandsMutable().append(cacheOperands);
- } else {
- llvm::report_fatal_error(
- "could not find loop to attach OpenACC cache information.");
- }
- builder.restoreInsertionPoint(crtPos);
}
mlir::Value Fortran::lower::genOpenACCConstruct(
|
|
@llvm/pr-subscribers-openacc Author: Zhen Wang (wangzpgi) ChangesRemove unreachable code after the TODO in the acc cache directive lowering function. Full diff: https://github.com/llvm/llvm-project/pull/170729.diff 1 Files Affected:
diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index 5a548f4fcf435..50b08cea12004 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -4786,39 +4786,8 @@ static void
genACC(Fortran::lower::AbstractConverter &converter,
Fortran::semantics::SemanticsContext &semanticsContext,
const Fortran::parser::OpenACCCacheConstruct &cacheConstruct) {
- fir::FirOpBuilder &builder = converter.getFirOpBuilder();
mlir::Location loc = converter.genLocation(cacheConstruct.source);
TODO(loc, "OpenACC cache directive");
- auto loopOp = builder.getRegion().getParentOfType<mlir::acc::LoopOp>();
- auto crtPos = builder.saveInsertionPoint();
- if (loopOp) {
- builder.setInsertionPoint(loopOp);
- Fortran::lower::StatementContext stmtCtx;
- llvm::SmallVector<mlir::Value> cacheOperands;
- const Fortran::parser::AccObjectListWithModifier &listWithModifier =
- std::get<Fortran::parser::AccObjectListWithModifier>(cacheConstruct.t);
- const auto &accObjectList =
- std::get<Fortran::parser::AccObjectList>(listWithModifier.t);
- const auto &modifier =
- std::get<std::optional<Fortran::parser::AccDataModifier>>(
- listWithModifier.t);
-
- mlir::acc::DataClause dataClause = mlir::acc::DataClause::acc_cache;
- if (modifier &&
- (*modifier).v == Fortran::parser::AccDataModifier::Modifier::ReadOnly)
- dataClause = mlir::acc::DataClause::acc_cache_readonly;
- genDataOperandOperations<mlir::acc::CacheOp>(
- accObjectList, converter, semanticsContext, stmtCtx, cacheOperands,
- dataClause,
- /*structured=*/true, /*implicit=*/false,
- /*async=*/{}, /*asyncDeviceTypes=*/{}, /*asyncOnlyDeviceTypes=*/{},
- /*setDeclareAttr*/ false);
- loopOp.getCacheOperandsMutable().append(cacheOperands);
- } else {
- llvm::report_fatal_error(
- "could not find loop to attach OpenACC cache information.");
- }
- builder.restoreInsertionPoint(crtPos);
}
mlir::Value Fortran::lower::genOpenACCConstruct(
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. You can add [NFC] in your commit title since this does not change the way things work now.
razvanlupusoru
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I was debating whether to ask to remove the follow-up code in your initial PR. I was torn since TODO is not meant to be permanent.
I can understand that's a good reason to debate. |
…70729) Remove unreachable code after the TODO in the acc cache directive lowering function.
Remove unreachable code after the TODO in the acc cache directive lowering function.