[all-commits] [llvm/llvm-project] a6d4b4: [ConstantFold] Supports compares in ConstantFoldIn...

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Jun 30 02:05:43 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a6d4b4138ffcffabfacef12d1d903a44882ec933
      https://github.com/llvm/llvm-project/commit/a6d4b4138ffcffabfacef12d1d903a44882ec933
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-06-30 (Thu, 30 Jun 2022)

  Changed paths:
    M llvm/lib/Analysis/ConstantFolding.cpp
    M llvm/lib/Analysis/InstructionSimplify.cpp
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp

  Log Message:
  -----------
  [ConstantFold] Supports compares in ConstantFoldInstOperands()

Support compares in ConstantFoldInstOperands(), instead of
forcing the use of ConstantFoldCompareInstOperands(). Also handle
insertvalue (extractvalue was already handled).

This removes a footgun, where many uses of ConstantFoldInstOperands()
need a separate check for compares beforehand. It's particularly
insidious if called on a constant expression, because it doesn't
fail in that case, but will just not do DL-dependent folding.




More information about the All-commits mailing list