[ConstantFold] Fold operations to poison if possible
authorJuneyoung Lee <aqjune@gmail.com>
Fri, 27 Nov 2020 02:04:04 +0000 (11:04 +0900)
committerJuneyoung Lee <aqjune@gmail.com>
Sat, 28 Nov 2020 17:28:40 +0000 (02:28 +0900)
commitc6b62efb9103466b6cefca1bd99a5b04b4ced044
treec39b23d7f4708eb878f748e2cb15e1538b144aa2
parent47c902ba8479fc1faed73b86f59d58830df06644
[ConstantFold] Fold operations to poison if possible

This patch updates ConstantFold, so operations are folded into poison if possible.

<alive2 proofs>
casts: https://alive2.llvm.org/ce/z/WSj7rw
binary operations (arithmetic): https://alive2.llvm.org/ce/z/_7dEyJ
binary operations (bitwise): https://alive2.llvm.org/ce/z/cezjVN
vector/aggregate operations: https://alive2.llvm.org/ce/z/BQ7hWz
unary ops: https://alive2.llvm.org/ce/z/yBRs4q
other ops: https://alive2.llvm.org/ce/z/iXbcFD

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D92203
llvm/lib/IR/ConstantFold.cpp
llvm/lib/IR/Constants.cpp
llvm/test/Transforms/InstSimplify/ConstProp/InsertElement.ll
llvm/test/Transforms/InstSimplify/ConstProp/poison.ll [new file with mode: 0644]
llvm/unittests/IR/ConstantsTest.cpp