[PATCH] D108284: [DAGCombiner] Combine frem into fdiv+ftrunc+fma

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 14 05:45:02 PDT 2021


spatel added a comment.

I like this as a combine because we can chain it with other combines. For example, the fdiv becomes a reciprocal op in the current tests.

I'd like to see tests for other targets though. I did a quick test, and this may trigger for any of AArch64, AMDGPU, or x86 (use -mattr=avx to make sure ftrunc is supported).

There's an open question about exactly which FMF are needed to enable this transform. Should we require 'reassoc' or others? Is 'reassoc' enough by itself? 
The current tests show 'fast' only, so we should reduce at least one of those to whatever we decide is the minimum requirement.

There's also a possible missing constraint when optimizing for minimum size - if we know this node can be lowered to a libcall, is that smaller than the expansion?

We might be able to answer some of these questions and share code with the transforms under DAGCombiner::visitFPOW().


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108284/new/

https://reviews.llvm.org/D108284



More information about the llvm-commits mailing list