[all-commits] [llvm/llvm-project] f34dcf: [IRBuilder] Migrate all binops to folding API

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Jun 30 07:41:32 PDT 2022


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

  Changed paths:
    M llvm/include/llvm/Analysis/InstSimplifyFolder.h
    M llvm/include/llvm/Analysis/TargetFolder.h
    M llvm/include/llvm/IR/ConstantFolder.h
    M llvm/include/llvm/IR/IRBuilder.h
    M llvm/include/llvm/IR/IRBuilderFolder.h
    M llvm/include/llvm/IR/NoFolder.h
    M llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp

  Log Message:
  -----------
  [IRBuilder] Migrate all binops to folding API

Migrate all binops to use FoldXYZ rather than CreateXYZ APIs,
which are compatible with InstSimplifyFolder and fallible constant
folding.

Rather than continuing to add one method for every single operator,
add a generic FoldBinOp (plus variants for nowrap, exact and fmf
operators), which we would need anyway for CreateBinaryOp.

This change is not NFC because IRBuilder with InstSimplifyFolder
may perform more folding. However, this patch changes SCEVExpander
to not use the folder in InsertBinOp to minimize practical impact
and keep this change as close to NFC as possible.




More information about the All-commits mailing list