-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[GISEL][AArch64][NFC] Stop using wip_match_opcode for some opcodes #106702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,14 +13,14 @@ include "llvm/Target/GlobalISel/Combine.td" | |
|
||
def fconstant_to_constant : GICombineRule< | ||
(defs root:$root), | ||
(match (wip_match_opcode G_FCONSTANT):$root, | ||
(match (G_FCONSTANT $dst, $src):$root, | ||
[{ return matchFConstantToConstant(*${root}, MRI); }]), | ||
(apply [{ applyFConstantToConstant(*${root}); }])>; | ||
|
||
def icmp_redundant_trunc_matchdata : GIDefMatchData<"Register">; | ||
def icmp_redundant_trunc : GICombineRule< | ||
(defs root:$root, icmp_redundant_trunc_matchdata:$matchinfo), | ||
(match (wip_match_opcode G_ICMP):$root, | ||
(match (G_ICMP $dst, $tst, $src1, $src2):$root, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is the issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All I am saying, it could reduce compile-time, if we replaced the G_ICMP with something ala:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The combiner would only jump into the C++ code, if there is a G_TRUNC on the lhs and a G_CONSTANT 0 on the rhs. |
||
[{ return matchICmpRedundantTrunc(*${root}, MRI, Helper.getKnownBits(), ${matchinfo}); }]), | ||
(apply [{ applyICmpRedundantTrunc(*${root}, MRI, B, Observer, ${matchinfo}); }])>; | ||
|
||
|
@@ -178,14 +178,14 @@ def adjust_icmp_imm_matchdata : | |
GIDefMatchData<"std::pair<uint64_t, CmpInst::Predicate>">; | ||
def adjust_icmp_imm : GICombineRule < | ||
(defs root:$root, adjust_icmp_imm_matchdata:$matchinfo), | ||
(match (wip_match_opcode G_ICMP):$root, | ||
(match (G_ICMP $dst, $tst, $src1, $src2):$root, | ||
[{ return matchAdjustICmpImmAndPred(*${root}, MRI, ${matchinfo}); }]), | ||
(apply [{ applyAdjustICmpImmAndPred(*${root}, ${matchinfo}, B, Observer); }]) | ||
>; | ||
|
||
def swap_icmp_operands : GICombineRule < | ||
(defs root:$root), | ||
(match (wip_match_opcode G_ICMP):$root, | ||
(match (G_ICMP $dst, $tst, $src1, $src2):$root, | ||
[{ return trySwapICmpOperands(*${root}, MRI); }]), | ||
(apply [{ applySwapICmpOperands(*${root}, Observer); }]) | ||
>; | ||
|
@@ -226,14 +226,14 @@ def build_vector_lowering : GICombineGroup<[build_vector_to_dup]>; | |
|
||
def lower_vector_fcmp : GICombineRule< | ||
(defs root:$root), | ||
(match (wip_match_opcode G_FCMP):$root, | ||
(match (G_FCMP $dst, $tst, $src1, $src2):$root, | ||
[{ return matchLowerVectorFCMP(*${root}, MRI, B); }]), | ||
(apply [{ applyLowerVectorFCMP(*${root}, MRI, B); }])>; | ||
|
||
def form_truncstore_matchdata : GIDefMatchData<"Register">; | ||
def form_truncstore : GICombineRule< | ||
(defs root:$root, form_truncstore_matchdata:$matchinfo), | ||
(match (wip_match_opcode G_STORE):$root, | ||
(match (G_STORE $src, $addr):$root, | ||
[{ return matchFormTruncstore(*${root}, MRI, ${matchinfo}); }]), | ||
(apply [{ applyFormTruncstore(*${root}, MRI, B, Observer, ${matchinfo}); }]) | ||
>; | ||
|
@@ -254,7 +254,7 @@ def mutate_anyext_to_zext : GICombineRule< | |
|
||
def split_store_zero_128 : GICombineRule< | ||
(defs root:$d), | ||
(match (wip_match_opcode G_STORE):$d, | ||
(match (G_STORE $src, $addr):$d, | ||
[{ return matchSplitStoreZero128(*${d}, MRI); }]), | ||
(apply [{ applySplitStoreZero128(*${d}, MRI, B, Observer); }]) | ||
>; | ||
|
@@ -277,7 +277,7 @@ def unmerge_ext_to_unmerge : GICombineRule< | |
def regtriple_matchdata : GIDefMatchData<"std::tuple<Register, Register, Register>">; | ||
def or_to_bsp: GICombineRule < | ||
(defs root:$root, regtriple_matchdata:$matchinfo), | ||
(match (wip_match_opcode G_OR):$root, | ||
(match (G_OR $dst, $src1, $src2):$root, | ||
[{ return matchOrToBSP(*${root}, MRI, ${matchinfo}); }]), | ||
(apply [{ applyOrToBSP(*${root}, MRI, B, ${matchinfo}); }]) | ||
>; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name and the C++ code hint at a more precise pattern, which is not expressed in MIR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't
$dst
and$src
just names given to operands? If so, what change would it bring in the matching algorithm?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning! Does not compile!
see
llvm-project/llvm/lib/Target/AArch64/GISel/AArch64PreLegalizerCombiner.cpp
Line 92 in b0eefb4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a MIR test called
icmp-trunc.mir
to test this scenario. The test compiles exactly the same before and after this commit. How can I modify the test to see the problem?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your changes should NFC. You can put it into the PR title.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean there is no issue with removing
wip_match_opcode
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No.