[all-commits] [llvm/llvm-project] fc18a8: [InstCombine] Avoid creating float binop ConstantE...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Jul 8 07:36:26 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fc18a88231ccca7c5e93f7563e44fd636833ed2c
      https://github.com/llvm/llvm-project/commit/fc18a88231ccca7c5e93f7563e44fd636833ed2c
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-07-08 (Fri, 08 Jul 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp

  Log Message:
  -----------
  [InstCombine] Avoid creating float binop ConstantExprs

Replace ConstantExpr:getFAdd etc with call to
ConstantFoldBinaryOpOperands(). I'm using the constant folding API
rather than IRBuilder here to ensure that this does actually
constant fold. These transforms don't use m_ImmConstant(), so this
would not otherwise be guaranteed (and apparently, they can't use
m_ImmConstant because they want to handle scalable vector splats).

There is an opportunity here to further migrate these to the
ConstantFoldFPInstOperands() API, which would respect the denormal
mode. I've held off on doing so here, because some of this code
explicitly checks for denormal results, and I don't want to touch
it in a mostly NFC change.




More information about the All-commits mailing list