[GlobalISel] Look through extends etc in CombinerHelper::matchConstantOp
authorJessica Paquette <jpaquette@apple.com>
Mon, 15 Jun 2020 19:16:33 +0000 (12:16 -0700)
committerJessica Paquette <jpaquette@apple.com>
Mon, 15 Jun 2020 23:34:25 +0000 (16:34 -0700)
commit5a4c3f6b06f6f4045a4c18f41082561ddebc6775
treebe1e2626107cf953ce1bc1461d139fcb19aee0c3
parentc8d0aaa7ffd535ae6c90f5603f46370d652c4c46
[GlobalISel] Look through extends etc in CombinerHelper::matchConstantOp

It's possible to end up with a zext or something in the way of a G_CONSTANT,
even pre-legalization. This can happen with memsets.

e.g.

https://godbolt.org/z/Bjc8cw

To make sure we can catch these cases, use `getConstantVRegValWithLookThrough`
instead of `mi_match`.

Differential Revision: https://reviews.llvm.org/D81875
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-trivial-arith.mir