This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Removing FABS folding from DAGCombiner
ClosedPublic

Authored by mike.dvoretsky on Mar 20 2018, 8:28 AM.

Details

Summary

Since D44550 introduced FABS pattern folding in InstCombine, this patch removes the now-redundant code that causes https://bugs.llvm.org/show_bug.cgi?id=36600.

The llc test was removed as InstCombine isn't part of the llc pipeline.

Diff Detail

Repository
rL LLVM

Event Timeline

mike.dvoretsky created this revision.Mar 20 2018, 8:28 AM

I don't mind removing x86 noise, but we still need to ensure that the bug doesn't resuscitate. Please rebase with:
https://reviews.llvm.org/rL327995

Rebased. PR36600 appears fixed.

arsenm added a subscriber: arsenm.Mar 21 2018, 5:55 AM

There is supposed to be redundancy between instcombine and dagcombiner. Patterns can appear during lowering that won’t appear in instcombine

There is supposed to be redundancy between instcombine and dagcombiner. Patterns can appear during lowering that won’t appear in instcombine

If it would be preferred to keep the code, then I could basically recreate D44091 in full. I would note that currently there are no tests in which this pattern is produced specifically in DAG.

There is supposed to be redundancy between instcombine and dagcombiner. Patterns can appear during lowering that won’t appear in instcombine

I agree that there should be partial redundancy between these passes, but if we are confident that a pattern should not be created, then trying to match it is just overhead.

In this case, we have ISD::FABS, so if there's some existing code that is creating compare and select when it could be creating FABS directly, then I think it should be fixed to not do that.

spatel accepted this revision.Mar 21 2018, 10:27 AM

LGTM.

This revision is now accepted and ready to land.Mar 21 2018, 10:27 AM

@spatel, could you please commit this? I don't have commit rights.

This revision was automatically updated to reflect the committed changes.