aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
diff options
context:
space:
mode:
authorYingwei Zheng <dtcxzyw2333@gmail.com>2024-09-15 18:38:06 +0800
committerGitHub <noreply@github.com>2024-09-15 18:38:06 +0800
commit87663fdab9d0e7bcc0b963ea078da9e2eb574908 (patch)
treec6afb6cf3b22fd788ef094c7e25dd4e594df4d2b /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
parentba8e4246e2f17030788e8a4954bf5c290332206f (diff)
downloadllvm-87663fdab9d0e7bcc0b963ea078da9e2eb574908.zip
llvm-87663fdab9d0e7bcc0b963ea078da9e2eb574908.tar.gz
llvm-87663fdab9d0e7bcc0b963ea078da9e2eb574908.tar.bz2
[VectorCombine] Don't shrink lshr if the shamt is not less than bitwidth (#108705)
Consider the following case: ``` define <2 x i32> @test(<2 x i64> %vec.ind16, <2 x i32> %broadcast.splat20) { %19 = icmp eq <2 x i64> %vec.ind16, zeroinitializer %20 = zext <2 x i1> %19 to <2 x i32> %21 = lshr <2 x i32> %20, %broadcast.splat20 ret <2 x i32> %21 } ``` After https://github.com/llvm/llvm-project/pull/104606, we shrink the lshr into: ``` define <2 x i32> @test(<2 x i64> %vec.ind16, <2 x i32> %broadcast.splat20) { %1 = icmp eq <2 x i64> %vec.ind16, zeroinitializer %2 = trunc <2 x i32> %broadcast.splat20 to <2 x i1> %3 = lshr <2 x i1> %1, %2 %4 = zext <2 x i1> %3 to <2 x i32> ret <2 x i32> %4 } ``` It is incorrect since `lshr i1 X, 1` returns `poison`. This patch adds additional check on the shamt operand. The lshr will get shrunk iff we ensure that the shamt is less than bitwidth of the smaller type. As `computeKnownBits(&I, *DL).countMaxActiveBits() > BW` always evaluates to true for `lshr(zext(X), Y)`, this check will only apply to bitwise logical instructions. Alive2: https://alive2.llvm.org/ce/z/j_RmTa Fixes https://github.com/llvm/llvm-project/issues/108698.
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
0 files changed, 0 insertions, 0 deletions