[PATCH] D17731: [InstCombine] Optimize (+0.0 - A) + B
Andres Nötzli via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 29 15:39:47 PST 2016
4tXJ7f added a comment.
Ouch, I think you are right. I tested it with `a = +/- 0.0` but not with zeroes for both values, sorry about that. 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)? Would it be a good idea to do the optimization for +0.0 if `nsz` is set? The optimizer currently optimizes:
%t0 = fsub nsz float +0.000000e+00, %x
%t1 = fadd float %t0, %y
(looks like +0.000000e+00 gets turned into -0.000000e+00 and then the other optimization applies) but not:
%t0 = fsub float +0.000000e+00, %x
t1 = fadd nsz float %t0, %y
Thanks a lot!
http://reviews.llvm.org/D17731
More information about the llvm-commits
mailing list