[PATCH] D129148: [ConstExpr] Remove div/rem constant expressions
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 5 09:38:10 PDT 2022
nikic created this revision.
nikic added reviewers: reames, nhaehnle.
Herald added a reviewer: deadalnix.
Herald added subscribers: jsji, pengfei, arphaman, hiraditya, nemanjai.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
D128820 <https://reviews.llvm.org/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 (but could fold that into here as well).
https://reviews.llvm.org/D129148
Files:
llvm/bindings/go/llvm/ir.go
llvm/bindings/ocaml/llvm/llvm.ml
llvm/bindings/ocaml/llvm/llvm.mli
llvm/docs/ReleaseNotes.rst
llvm/include/llvm-c/Core.h
llvm/include/llvm/IR/Constants.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/IR/Constants.cpp
llvm/lib/IR/Core.cpp
llvm/test/Assembler/ConstantExprFold.ll
llvm/test/Assembler/flags.ll
llvm/test/Bindings/OCaml/core.ml
llvm/test/CodeGen/PowerPC/PR33636.ll
llvm/test/CodeGen/X86/critical-edge-split-2.ll
llvm/test/CodeGen/X86/nonconst-static-div.ll
llvm/test/CodeGen/X86/pr33396.ll
llvm/test/CodeGen/X86/pr49839-trapping-aggregate.ll
llvm/test/CodeGen/X86/selectiondag-dominator.ll
llvm/test/Transforms/GlobalOpt/constant-can-trap.ll
llvm/test/Transforms/GlobalOpt/ctor-list-opt-constexpr.ll
llvm/test/Transforms/InstCombine/indexed-gep-compares.ll
llvm/test/Transforms/InstSimplify/ConstProp/2007-02-23-sdiv.ll
llvm/test/Transforms/InstSimplify/ConstProp/2009-06-20-constexpr-zero-lhs.ll
llvm/test/Transforms/InstSimplify/ConstProp/constant-expr.ll
llvm/test/Transforms/InstSimplify/phi.ll
llvm/test/Transforms/LoopVectorize/X86/masked_load_store.ll
llvm/test/Transforms/LoopVectorize/if-conversion.ll
llvm/test/Transforms/SimplifyCFG/2006-10-19-UncondDiv.ll
llvm/test/Transforms/SimplifyCFG/ConditionalTrappingConstantExpr.ll
llvm/test/Transforms/SimplifyCFG/PR16069.ll
llvm/test/Transforms/SimplifyCFG/PR17073.ll
llvm/unittests/Analysis/ValueTrackingTest.cpp
llvm/unittests/IR/ConstantsTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129148.442334.patch
Type: text/x-patch
Size: 82161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220705/e0cc5e5f/attachment.bin>
More information about the llvm-commits
mailing list