This is an archive of the discontinued LLVM Phabricator instance.

[X86] Rework the logic in LowerBuildVectorv16i8 to make better use of any_extend and break false dependencies. Other improvements
ClosedPublic

Authored by craig.topper on Jun 23 2019, 11:43 PM.

Details

Summary

This patch rewrites the loop iteration to only visit every other element starting with element 0. And we work on the "even" element and "next" element at the same time. The "First" logic has been moved to the bottom of the loop and doesn't run on every element. I believe it could create dangling nodes previously since we didn't check if we were going to use SCALAR_TO_VECTOR for the first insertion. I got rid of the "First" variable and just do a null check on V which should be equivalent. We also no longer use undef as the starting V for vectors with no zeroes to avoid false dependencies. This matches v8i16.

I've changed all the extends and OR operations to use MVT::i32 since that's what they'll be promoted to anyway. I've tried to use zero_extend only when necessary and use any_extend otherwise. This resulted in some improvements in tests where we are now able to promote aligned (i32 (extload i8)) to a 32-bit load.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Jun 23 2019, 11:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2019, 11:44 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
RKSimon accepted this revision.Jun 26 2019, 11:24 AM

LGTM - cheers

This revision is now accepted and ready to land.Jun 26 2019, 11:24 AM
This revision was automatically updated to reflect the committed changes.