[flang-commits] [flang] [flang] Do not hoist all scalar sub-expressions from WHERE constructs (PR #91395)

via flang-commits flang-commits at lists.llvm.org
Tue May 7 13:40:55 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 97dd8e3c4f38ef345b01fbbf0a2052c7875ff7e0 60a5b9b2e233ea1a12d8c558b4ca6dedbcbb44a5 -- flang/include/flang/Lower/StatementContext.h flang/lib/Lower/Bridge.cpp flang/lib/Lower/ConvertCall.cpp flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/lib/Lower/ConvertCall.cpp b/flang/lib/Lower/ConvertCall.cpp
index f989bc7e01..c6bfe35921 100644
--- a/flang/lib/Lower/ConvertCall.cpp
+++ b/flang/lib/Lower/ConvertCall.cpp
@@ -2682,9 +2682,9 @@ bool Fortran::lower::isIntrinsicModuleProcRef(
   return module && module->attrs().test(Fortran::semantics::Attr::INTRINSIC);
 }
 
-static bool isInWhereMaskedExpression(fir::FirOpBuilder& builder) {
+static bool isInWhereMaskedExpression(fir::FirOpBuilder &builder) {
   // The MASK of the outer WHERE is not masked itself.
-  mlir::Operation* op = builder.getRegion().getParentOp();
+  mlir::Operation *op = builder.getRegion().getParentOp();
   return op && op->getParentOfType<hlfir::WhereOp>();
 }
 
@@ -2693,7 +2693,8 @@ std::optional<hlfir::EntityWithAttributes> Fortran::lower::convertCallToHLFIR(
     const evaluate::ProcedureRef &procRef, std::optional<mlir::Type> resultType,
     Fortran::lower::SymMap &symMap, Fortran::lower::StatementContext &stmtCtx) {
   auto &builder = converter.getFirOpBuilder();
-  if (resultType && !procRef.IsElemental() && isInWhereMaskedExpression(builder) &&
+  if (resultType && !procRef.IsElemental() &&
+      isInWhereMaskedExpression(builder) &&
       !builder.getRegion().getParentOfType<hlfir::ExactlyOnceOp>()) {
     // Non elemental calls inside a where-assignment-stmt must be executed
     // exactly once without mask control. Lower them in a special region so that

``````````

</details>


https://github.com/llvm/llvm-project/pull/91395


More information about the flang-commits mailing list