[PATCH] D154193: [X86]Remove TEST in AND32+TEST16rr in peephole-opt
Wang, Xin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 30 02:15:37 PDT 2023
XinWang10 created this revision.
Herald added subscribers: pengfei, hiraditya.
Herald added a project: All.
XinWang10 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Previously we remove a pattern like:
%reg = and32ri %in_reg, 5
... // EFLAGS not changed.
%src_reg = subreg_to_reg 0, %reg, %subreg.sub_index
test64rr %src_reg, %src_reg, implicit-def $eflags
We can remove test64rr since it has same functionality as and subreg_to_reg avoid the opt in previous code, so we handle this case specially.
And this case is also can be opted for the same reason, like:
%reg = and32ri %in_reg, 5
... // EFLAGS not changed.
%src_reg = copy %reg.sub_16bit:gr32
test16rr %src_reg, %src_reg, implicit-def $eflags
The COPY from gr32 to gr16 prevent the opt in previous code too, just handle it specially as what we do for test64rr.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D154193
Files:
llvm/lib/Target/X86/X86InstrInfo.cpp
llvm/test/CodeGen/X86/peephole-test-after-add.mir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154193.536150.patch
Type: text/x-patch
Size: 9621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230630/dd572408/attachment.bin>
More information about the llvm-commits
mailing list