[PatternMatch][InstCombine] match a vector with constant expression element(s) as...
authorSanjay Patel <spatel@rotateright.com>
Thu, 21 Jul 2022 19:07:06 +0000 (15:07 -0400)
committerSanjay Patel <spatel@rotateright.com>
Thu, 21 Jul 2022 19:23:57 +0000 (15:23 -0400)
commit78c09f0f24b6af6d17aeef93c13c54e251e57e8c
tree04e78dc827b9a71bb6211c536ad714abfee9661f
parentb03891268cc378ce01a8da40483224aa1cfee5b6
[PatternMatch][InstCombine] match a vector with constant expression element(s) as a constant expression

The InstCombine test is reduced from issue #56601. Without the more
liberal match for ConstantExpr, we try to rearrange constants in
Negator forever.

Alternatively, we could adjust the definition of m_ImmConstant to be
more conservative, but that's probably a larger patch, and I don't
see any downside to changing m_ConstantExpr. We never capture and
modify a ConstantExpr; transforms just want to avoid it.

Differential Revision: https://reviews.llvm.org/D130286
llvm/include/llvm/IR/PatternMatch.h
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/sub-of-negatible.ll
llvm/unittests/IR/PatternMatch.cpp