This is an archive of the discontinued LLVM Phabricator instance.

[X86] Freeze shl(x,1) -> add(x,x) vector fold (PR50468)
ClosedPublic

Authored by RKSimon on Jul 23 2021, 8:51 AM.

Details

Summary

Vector fold shl(x,1) ->add(freeze(x),freeze(x)) to avoid the undef issues identified in PR50468

Diff Detail

Event Timeline

RKSimon created this revision.Jul 23 2021, 8:51 AM
RKSimon requested review of this revision.Jul 23 2021, 8:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 23 2021, 8:51 AM
RKSimon planned changes to this revision.Sep 28 2021, 12:54 AM
RKSimon updated this revision to Diff 432262.May 26 2022, 6:20 AM

Rebase to see how close we are now - we're still missing a DAG equivalent of pushFreezeToPreventPoisonFromPropagating to stop freeze nodes obscuring some folds.

Herald added a project: Restricted Project. · View Herald TranscriptMay 26 2022, 6:20 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
RKSimon edited the summary of this revision. (Show Details)Aug 9 2022, 2:20 AM
RKSimon updated this revision to Diff 451118.Aug 9 2022, 5:20 AM

rebase (still WIP)

RKSimon updated this revision to Diff 451436.Aug 10 2022, 6:22 AM

rebase (still WIP)

RKSimon updated this revision to Diff 452536.Aug 14 2022, 10:16 AM
RKSimon retitled this revision from [WIP][X86] Freeze shl(x,1) -> add(x,x) vector fold (PR50468) to [X86] Freeze shl(x,1) -> add(x,x) vector fold (PR50468).

Move the (shl V, 1) -> (add (freeze V),(freeze V)) fold inside LowerShiftByScalarImmediate so it's only attempted on legal types.

With the recently improved freeze combines this appears to fix most of the regressions we were seeing.

RKSimon added inline comments.Aug 14 2022, 10:18 AM
llvm/test/CodeGen/X86/oddsubvector.ll
237–238

We've lost a INSERT_VECTOR_ELT -> (dependency breaking) SCALAR_TO_VECTOR optimization - still investigating this.

RKSimon retitled this revision from [X86] Freeze shl(x,1) -> add(x,x) vector fold (PR50468) to [X86] shl(x,1) -> add(freeze(x),freeze(x)) vector fold (PR50468).Aug 14 2022, 10:18 AM
RKSimon retitled this revision from [X86] shl(x,1) -> add(freeze(x),freeze(x)) vector fold (PR50468) to [X86] Freeze shl(x,1) -> add(x,x) vector fold (PR50468).
RKSimon updated this revision to Diff 452658.Aug 15 2022, 7:11 AM

rebase - ready for review

spatel accepted this revision.Aug 15 2022, 7:51 AM

LGTM

This revision is now accepted and ready to land.Aug 15 2022, 7:51 AM
This revision was landed with ongoing or failed builds.Aug 15 2022, 8:18 AM
This revision was automatically updated to reflect the committed changes.