[Constant] Add 'isElementWiseEqual()' method
authorRoman Lebedev <lebedev.ri@gmail.com>
Sat, 24 Aug 2019 06:49:51 +0000 (06:49 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sat, 24 Aug 2019 06:49:51 +0000 (06:49 +0000)
commit9cf08c6de1da1174986a8b198134121450832941
treee83928e55cb619a08ead27cdb521735ad16289a3
parentde19f749e0e6108de7eff4d77e8e6afa8c9f64cb
[Constant] Add 'isElementWiseEqual()' method

Promoting it from InstCombine's tryToReuseConstantFromSelectInComparison().

Return true if this constant and a constant 'Y' are element-wise equal.
This is identical to just comparing the pointers, with the exception that
for vectors, if only one of the constants has an `undef` element in some
lane, the constants still match.

llvm-svn: 369842
llvm/include/llvm/IR/Constant.h
llvm/lib/IR/Constants.cpp
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp