[PATCH] D17731: [InstCombine] Optimize (+0.0 - A) + B

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 29 19:53:49 PST 2016


t.p.northover added a comment.

> Do you think that it would be a good idea to add a testcase to document this behavior (check that (+0.0 - A) + B does not get optimized and have a comment to explain why)?


Definitely. If you want to do that post-commit review would be fine. Commit away!

> Would it be a good idea to do the optimization for +0.0 if nsz is set?


I think that would be fine, but I'm more of a dabbler in IEEE-754 than an expert. It's possible we have other canonicalizations that convert "fsub nsz 0.0, %x" into "fsub nsz -0.0, %x" (and then the usual case would take over). It's also possible that if we don't that would be a better approach anyway.

Cheers.

Tim.


http://reviews.llvm.org/D17731





More information about the llvm-commits mailing list