[IR] Remove uses of the oddly named ConstantFP::getZeroValueForNegation in integer...
authorCraig Topper <craig.topper@sifive.com>
Tue, 4 Apr 2023 16:00:37 +0000 (09:00 -0700)
committerCraig Topper <craig.topper@sifive.com>
Tue, 4 Apr 2023 16:01:08 +0000 (09:01 -0700)
commit64ad6ead1f5839dc6920295d00ec8b16ea118f4a
treefbe7a649b01da72a230c0fb13e120fd3acc2ecc8
parent8dad7f495302b5f2cd186dcc1cdd76874c80958a
[IR] Remove uses of the oddly named ConstantFP::getZeroValueForNegation in integer code.

Confusingly ConstantFP's getZeroValueForNegation intentionally
handles non-FP constants. It calls getNullValue in Constant.

Nearly all uses in tree are for integers rather than FP. Maybe due
to replacing FSub -0.0, X idiom with an FNeg instructions a few
years ago.

This patch replaces all the integer uses in tree with ConstantInt::get(0, Ty).

The one remaining use is in clang with a FIXME that it should use fneg.
I'll fix that next and then delete ConstantFP::getZeroValueForNegation.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D147492
llvm/lib/IR/Constants.cpp
llvm/lib/IR/Instructions.cpp