[flang-commits] [flang] [flang][Lower] Add alternative real expression lowering (PR #207371)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Mon Jul 6 05:01:14 PDT 2026
tblah wrote:
Thanks for taking a look
> Do you know what is having the most impact with your change on SNBone, is it this the balancing of the expression in general (into a tree with less depth), or is it specifically related to the self assignment context (`x = x + ....`) where moving the read and add of `x` at the end of the chain reduce the dependency and allows for more vectorization.
It is mostly the self-assignment context. I think the tree balancing should help something but I wasn't able to find an example where it made a large improvement on its own (at least on aws graviton 4 and 5; this is probably quite CPU dependent).
> I am asking to try to understand if there is really a point to limit this to assignment context [...]
> I am also curious of the limitations (no function reference, parenthesis (in the terms, I get why parenthesis around the adds would prevent it), vector subscripts...) inside the expressions
I was intending to be as conservative as possible for the initial version and then only expand it if I found more motivating cases. I wanted to be especially cautious because it could be quite difficult to diagnose a floating point rounding issue if it was introduced.
> Should the rewrite also be applied to sub-expression trees or does it only matters at the top level?
Yes I think this could be a valid expansion, maybe for a future patch?
https://github.com/llvm/llvm-project/pull/207371
More information about the flang-commits
mailing list