[all-commits] [llvm/llvm-project] 11950e: [ConstExpr] Remove div/rem constant expressions

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Jul 6 01:13:16 PDT 2022


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

  Changed paths:
    M llvm/bindings/go/llvm/ir.go
    M llvm/bindings/ocaml/llvm/llvm.ml
    M llvm/bindings/ocaml/llvm/llvm.mli
    M llvm/docs/ReleaseNotes.rst
    M llvm/include/llvm-c/Core.h
    M llvm/include/llvm/IR/Constants.h
    M llvm/lib/AsmParser/LLParser.cpp
    M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
    M llvm/lib/IR/Constants.cpp
    M llvm/lib/IR/Core.cpp
    M llvm/test/Assembler/flags.ll
    M llvm/test/Bindings/OCaml/core.ml
    R llvm/test/CodeGen/X86/critical-edge-split-2.ll
    R llvm/test/CodeGen/X86/nonconst-static-div.ll
    R llvm/test/CodeGen/X86/pr33396.ll
    R llvm/test/CodeGen/X86/pr49839-trapping-aggregate.ll
    R llvm/test/CodeGen/X86/selectiondag-dominator.ll
    R llvm/test/Transforms/GlobalOpt/constant-can-trap.ll
    M llvm/test/Transforms/GlobalOpt/ctor-list-opt-constexpr.ll
    M llvm/test/Transforms/InstCombine/indexed-gep-compares.ll
    M llvm/test/Transforms/InstSimplify/phi.ll
    M llvm/test/Transforms/LoopVectorize/X86/masked_load_store.ll
    M llvm/test/Transforms/LoopVectorize/if-conversion.ll
    R llvm/test/Transforms/SimplifyCFG/2006-10-19-UncondDiv.ll
    R llvm/test/Transforms/SimplifyCFG/ConditionalTrappingConstantExpr.ll
    R llvm/test/Transforms/SimplifyCFG/PR16069.ll
    R llvm/test/Transforms/SimplifyCFG/PR17073.ll
    M llvm/unittests/Analysis/ValueTrackingTest.cpp
    M llvm/unittests/IR/ConstantsTest.cpp

  Log Message:
  -----------
  [ConstExpr] Remove div/rem constant expressions

D128820 stopped creating div/rem constant expressions by default;
this patch removes support for them entirely.

The getUDiv(), getExactUDiv(), getSDiv(), getExactSDiv(), getURem()
and getSRem() on ConstantExpr are removed, and ConstantExpr::get()
now only accepts binary operators for which
ConstantExpr::isSupportedBinOp() returns true. Uses of these methods
may be replaced either by corresponding IRBuilder methods, or
ConstantFoldBinaryOpOperands (if a constant result is required).

On the C API side, LLVMConstUDiv, LLVMConstExactUDiv, LLVMConstSDiv,
LLVMConstExactSDiv, LLVMConstURem and LLVMConstSRem are removed and
corresponding LLVMBuild methods should be used.

Importantly, this also means that constant expressions can no longer
trap! This patch still keeps the canTrap() method to minimize diff --
I plan to drop it in a separate NFC patch.

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




More information about the All-commits mailing list