[PATCH] D16696: InstCombine: fabs(x) * fabs(x) -> x * x
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 29 14:27:53 PST 2016
arsenm added a comment.
In http://reviews.llvm.org/D16696#339699, @spatel wrote:
> I forgot that we had intrinsic/lib folds outside of SimplifyLibCalls. Sorry, if I've missed it, but Is there a reason it's better to do this (and the sqrt and log opts) here?
I'm not a huge fan of SimplifyLibCalls and would prefer optimizations stick to the intrinsics. SimplifyLibCalls has the assumption that you you only can optimize when TargetLibraryInfo reports having a sqrt lib call (even for the intrinsic). This is not helpful for targets that do not have libcalls, and may have hardware instructions or custom expansions for the operations. Especially since we treat the math intrinsics as "fast" versions with looser rules than the library function, I don't think we should conflate the intrinsics and library calls so much.
I would prefer if optimizations stuck to the intrinsic whenever possible. See my RFC from a couple days ago: http://lists.llvm.org/pipermail/llvm-dev/2016-January/094593.html
More information about the llvm-commits