Carries out the initial lowering of the product intrinsic into HLFIR
following a similar method to sum, the --use-hlfir-intrinsic-ops flag
in test/Lower/HLFIR/expr-box is set to false so that the tests will
pass until hlfir.product is lowered into fir.call
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks for working on this. Some comments
- This patch needs a dependency on the previous hlfir.product patch, otherwise the CI builders will fail to build it. You can add that using either a Depends on: D1234 tag to the commit message/patch description. Alternately, you could press "Edit Related Revisions" on the right hand sidebar
- --use-hlfir-intrinsic-ops=false will still be required after the patch lowering hlfir.product to fir.call because that test calls bbc -emit-fir -hlfir which emits the HLFIR after lowering and before passes run. Therefore the HLFIR intrinsics pass (where hlfir.product will be lowered to fir.call) will not be run.
- Did you consider sharing the code in flang/lib/Lower/ConvertCall.cpp with hlfir.sum using a templated function as you did in the previous patch?
Nothing to add to Tom's comment. Thanks for working on this!
(adding --use-hlfir-intrinsic-ops=false in the test is fine, I should find another way to test genExprBox without using transformational intrinsics).
Thanks for the reviews
Following Tom's comments I have moved the shared code in
genHLFIRIntrinsicRefCore to a new lambda called buildOperation.
flang/lib/Lower/ConvertCall.cpp | ||
---|---|---|
1337 | Please could you name this in a way that shows that it is only for hlfir.sum and hlfir.product. buildOperation sounds like it could build any operation. But this couldn't build hlfir.matmul or hlfir.transpose. What about buildReductionIntrinsic? |
Thanks! Two small nits, LGTM otherwise.
flang/lib/Lower/ConvertCall.cpp | ||
---|---|---|
1324 | I think you probably need to pass "fir::FirOpBuilder" by reference here and below, otherwise, I am not sure what guarantee we have the the original builder insertion point will be moved properly when using a copy here. Also nit: it seems the lambda is not capturing anything, you should rather use "[]" in this case to underline it (this helps identifying lamdas that can easily be moved as static function if desired). |
Thanks for addressing the nits.
It looks like flang/lib/Lower/ConvertCall.cpp failed clang-format in CI. It also look like the FirOpBuilder is still passed by reference.
fixes to formatting and passing FirOpBuilder by reference in buildSumOperation/buildProductOperation
I think you probably need to pass "fir::FirOpBuilder" by reference here and below, otherwise, I am not sure what guarantee we have the the original builder insertion point will be moved properly when using a copy here.
Also nit: it seems the lambda is not capturing anything, you should rather use "[]" in this case to underline it (this helps identifying lamdas that can easily be moved as static function if desired).