This is an archive of the discontinued LLVM Phabricator instance.

[AggressiveInstCombine] Add `{extract/insert}element` to `TruncInstCombine` DAG
ClosedPublic

Authored by anton-afanasyev on Sep 3 2021, 7:15 AM.

Details

Summary

Alive2 for {extract/insert}element: https://alive2.llvm.org/ce/z/hwy_E-

Actually, no one file of test suite is touched by this change,
which means that is rare pattern not generated by frontend. But
it's worth being in place.

Diff Detail

Event Timeline

anton-afanasyev created this revision.Sep 3 2021, 7:15 AM
anton-afanasyev requested review of this revision.Sep 3 2021, 7:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 3 2021, 7:15 AM

Can you add a test with insert into poison / unary shuffle?

RKSimon added inline comments.Sep 3 2021, 8:46 AM
llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
452

Are we allowed to create new shuffles inside aggressiveinstcombine? A different type, even with the same mask, means that this might have a very different performance.

anton-afanasyev marked an inline comment as done.Sep 3 2021, 10:22 AM

Can you add a test with insert into poison / unary shuffle?

Ok, added

llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
452

Hmm, if that's the case, the only stuff we could do is to remove shuffles processing back. We can check perfomance difference for specific target, but that can't be done before NewBitWidth choosing, when it is too late (the DAG is started reducing already). One could change whole algorithm, but that's not the case to do it specially for shufflevector support.

anton-afanasyev marked an inline comment as done.

Add tests

Remove shufflevector

anton-afanasyev retitled this revision from [AggressiveInstCombine] Add vector instructions to `TruncInstCombine` DAG to [AggressiveInstCombine] Add `{extract/insert}element` to `TruncInstCombine` DAG.Sep 5 2021, 7:37 AM
anton-afanasyev edited the summary of this revision. (Show Details)
xbolva00 added inline comments.
llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
149

Leave shufflevector

anton-afanasyev marked an inline comment as done.Sep 10 2021, 10:59 AM
anton-afanasyev added inline comments.
llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp
149

Ok, done

anton-afanasyev marked an inline comment as done.

Leave shufflevector in TODO

Add new test demonstrating AIC power vs IC

spatel accepted this revision.Sep 15 2021, 11:35 AM

LGTM

This revision is now accepted and ready to land.Sep 15 2021, 11:35 AM