[llvm-reduce] Add reduction passes to reduce operands to undef/1/0
authorArthur Eubanks <aeubanks@google.com>
Wed, 13 Oct 2021 23:00:00 +0000 (16:00 -0700)
committerArthur Eubanks <aeubanks@google.com>
Tue, 19 Oct 2021 22:25:21 +0000 (15:25 -0700)
commit9660563950aaed54020bfdf0be07e7096a9553e4
treec50437c1dfb248808152a09ce62e41927cd52d18
parent922bf57fc8fe41ebcbbe581a7c8e730fbebf572f
[llvm-reduce] Add reduction passes to reduce operands to undef/1/0

Having non-undef constants in a final llvm-reduce output is nicer than
having undefs.

This splits the existing reduce-operands pass into three, one which does
the same as the current pass of reducing to undef, and two more to
reduce to the constant 1 and the constant 0. Do not reduce to undef if
the operand is a ConstantData, and do not reduce 0s to 1s.

Reducing GEP operands very frequently causes invalid IR (since types may
not match up if we index differently into a struct), so don't touch GEPs.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D111765
llvm/test/tools/llvm-reduce/remove-invoked-functions.ll
llvm/test/tools/llvm-reduce/remove-operands.ll
llvm/tools/llvm-reduce/DeltaManager.cpp
llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp
llvm/tools/llvm-reduce/deltas/ReduceOperands.h