[llvm] [GlobalIsel][AArch64] Add ADDO combine to the postlegalizer combiner (PR #101327)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 2 07:04:47 PDT 2024
KRM7 wrote:
> > > > > This sounds like an interesting optimization. Why doesn't it happen already after legalizing the add?
> > > >
> > > >
> > > > Where/why would you expect this to already happen?
> > >
> > >
> > > The legalizer will split the ADD into G_UADDO and G_UADDE. A post legalizer combiner should then be able to see that the G_UADDO created for the lower half has an all 0 input. That's how it's handed in SelectionDAG. Maybe such a post legalizer combine is missing for G_UADDO?
> >
> >
> > We rely on
> > https://github.com/llvm/llvm-project/blob/5dfdac74cadd9483a66eb17e51dc632b554cccb1/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp#L7215
>
> So we need this change?
>
> ```
> diff --git a/llvm/lib/Target/AArch64/AArch64Combine.td b/llvm/lib/Target/AArch64/AArch64Combine.td
> index 3f717c8a6005..90cb004dcebd 100644
> --- a/llvm/lib/Target/AArch64/AArch64Combine.td
> +++ b/llvm/lib/Target/AArch64/AArch64Combine.td
> @@ -322,5 +322,5 @@ def AArch64PostLegalizerCombiner
> select_to_minmax, or_to_bsp, combine_concat_vector,
> commute_constant_to_rhs,
> push_freeze_to_prevent_poison_from_propagating,
> - combine_mul_cmlt]> {
> + combine_mul_cmlt, match_addos]> {
> }
> ```
Yep, adding this was enough.
https://github.com/llvm/llvm-project/pull/101327
More information about the llvm-commits
mailing list