[all-commits] [llvm/llvm-project] 64ad6e: [IR] Remove uses of the oddly named ConstantFP::ge...

Craig Topper via All-commits all-commits at lists.llvm.org
Tue Apr 4 09:01:46 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 64ad6ead1f5839dc6920295d00ec8b16ea118f4a
      https://github.com/llvm/llvm-project/commit/64ad6ead1f5839dc6920295d00ec8b16ea118f4a
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2023-04-04 (Tue, 04 Apr 2023)

  Changed paths:
    M llvm/lib/IR/Constants.cpp
    M llvm/lib/IR/Instructions.cpp

  Log Message:
  -----------
  [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


  Commit: 0109f8d1e3bf64e4b23db6e2f284185207e46541
      https://github.com/llvm/llvm-project/commit/0109f8d1e3bf64e4b23db6e2f284185207e46541
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2023-04-04 (Tue, 04 Apr 2023)

  Changed paths:
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/test/CodeGen/aarch64-v8.2a-fp16-intrinsics-constrained.c
    M clang/test/CodeGen/aarch64-v8.2a-fp16-intrinsics.c

  Log Message:
  -----------
  [AArch64] Use fneg instead of fsub -0.0, X Cin IR expansion of __builtin_neon_vfmsh_f16.

Addresses the FIXME and removes the only in tree use of
llvm::ConstantFP::getZeroValueForNegation for an FP type.

Reviewed By: dmgreen, SjoerdMeijer

Differential Revision: https://reviews.llvm.org/D147497


Compare: https://github.com/llvm/llvm-project/compare/8dad7f495302...0109f8d1e3bf


More information about the All-commits mailing list