This is an archive of the discontinued LLVM Phabricator instance.

[IR] Remove uses of the oddly named ConstantFP::getZeroValueForNegation in integer code.
ClosedPublic

Authored by craig.topper on Apr 3 2023, 8:15 PM.

Details

Summary

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.
Maybe I'll fix that next and delete ConstantFP::getZeroValueForNegation.

Diff Detail