[llvm] GlobalISel needs fdiv 1 / sqrt(x) to rsq combine (PR #78673)

Nick Anderson via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 21 21:46:58 PST 2024


nickleus27 wrote:

@Pierre-VH @tschuett thank you for your reviews. Your comments helped a lot. First, my apologies for force pushing an amend. I know according to the docs I should've pushed a fix up commit due to your reviews. I accidentally amended, but next time I will remember to do fix-up.

My current commit reflects how I see the patch should look according to Pierre’s review, however, the current commit is not working. I have some questions about how TableGen works that I could not figure out from the docs. I get an error that says (‘G_FCONSTANT’) is unreachable from the pattern root! The docs state TableGen uses the DAG datatype. I am wondering if this is the same DAG that is produced from `DAG.viewGraph()` when debugging? I have included a DAG produced for MIR I am trying to match from the aforementioned graph. The image makes me believe that FSQRT would be the root of the pattern, then links with FDIV, and finally with ConstantFP. (In the commit I have FDIV as the root which would be true if looking at the instructions sequentially going bottom up.) How do I achieve this in the match pattern? I have tried different things with no luck. The docs say, “ By using another DAG node as an argument, an arbitrary graph of DAG nodes can be built.” I have tried this, and also had no luck.
![graph11824](https://github.com/llvm/llvm-project/assets/44080390/e9851e34-dfe9-49de-81e7-81ff37a4889b)

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


More information about the llvm-commits mailing list