[LoongArch] Eliminate the redundant sign extension of division (#107971)
commit99058521d4c80635f60b2c1442b683395e0ee818
authorhev <wangrui@loongson.cn>
Tue, 10 Sep 2024 08:52:21 +0000 (10 16:52 +0800)
committerTobias Hieta <tobias@hieta.se>
Tue, 1 Oct 2024 06:51:27 +0000 (1 08:51 +0200)
tree929a12da3a671a57decd2f59665544c46758ae30
parenta7554dfc222b13624426ebd6ef46e122b9c16ee7
[LoongArch] Eliminate the redundant sign extension of division (#107971)

If all incoming values of `div.d` are sign-extended and all users only
use the lower 32 bits, then convert them to W versions.

Fixes: #107946
(cherry picked from commit 0f47e3aebdd2a4a938468a272ea4224552dbf176)
llvm/lib/Target/LoongArch/LoongArchOptWInstrs.cpp
llvm/test/CodeGen/LoongArch/ir-instruction/sdiv-udiv-srem-urem.ll