[X86] Teach computeKnownBitsForTargetNode about MUL_IMM
authorKazu Hirata <kazu@google.com>
Mon, 27 Mar 2023 16:02:19 +0000 (09:02 -0700)
committerKazu Hirata <kazu@google.com>
Mon, 27 Mar 2023 16:02:20 +0000 (09:02 -0700)
commit258b5424edcf72063561ef7bb2ba6e5fbf24181a
tree00fd964a12cd858fb7a1413fd53ad4e8ad73af74
parent1a35893d2a58fdead33ec7daa9f1fe53f4787614
[X86] Teach computeKnownBitsForTargetNode about MUL_IMM

This patch teaches computeKnownBitsForTargetNode about MUL_IMM.

MUL_IMM comes up in certain select of constants.  Specifically, it is
used to multiply the result of SETCC.  Computing the known zero bits
of MUL_IMM allows matchAddressRecursively us to convert some OR into
ADD, which eventually becomes a part of LEA.

This patch fixes:

https://github.com/llvm/llvm-project/issues/61365

Differential Revision: https://reviews.llvm.org/D146787
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/pr57402.ll
llvm/test/CodeGen/X86/select-constant-lea.ll