[flang-commits] [clang] [flang] [flang] Support -f(no-)protect-parens (PR #170505)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Wed Jan 21 21:09:13 PST 2026


================
@@ -1703,12 +1703,23 @@ class HlfirBuilder {
     BinaryOp<D> binaryOp;
     auto left = hlfir::loadTrivialScalar(loc, builder, gen(op.left()));
     auto right = hlfir::loadTrivialScalar(loc, builder, gen(op.right()));
+
+    bool noReassoc = getConverter().getLoweringOptions().getProtectParens() &&
+                     (left.template getDefiningOp<hlfir::NoReassocOp>() ||
+                      right.template getDefiningOp<hlfir::NoReassocOp>());
----------------
eugeneepshteyn wrote:

@jeanPerier , I only made changes to support array operations. Could you please check if the new direction makes sense? 

I will address other PR comments separately.

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


More information about the flang-commits mailing list