This is an archive of the discontinued LLVM Phabricator instance.

[llvm-stress] Fix dead code preventing us generating per-element vector selects
ClosedPublic

Authored by RKSimon on Jun 10 2021, 4:50 AM.

Details

Summary

This has been reported several times by the PVS Studio team as well as coming up in some static analysis.

getRandom() % 1 always returns 0 so we never actually test this codepath, (git blame suggests this has always been like this) - given that we have plenty of other "getRandom() & 1" the typo is pretty obvious, and matches the intention in the comment above - with this change we generate a nice mixture of scalar/vector condition selects of vectors.

I don't know llvm-stress that well - but I don't think we guarantee that the same seed value will always generate the same IR for later versions of the program - just that the same binary would.

Diff Detail

Event Timeline

RKSimon requested review of this revision.Jun 10 2021, 4:50 AM
RKSimon created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJun 10 2021, 4:50 AM
lebedev.ri accepted this revision.Jun 10 2021, 4:57 AM

Never seen this program before, but the bug is obvious and i don't really believe we'd need to maintain backwards compatibility for previously-buggy inputs.

This revision is now accepted and ready to land.Jun 10 2021, 4:57 AM
This revision was landed with ongoing or failed builds.Jun 11 2021, 2:57 AM
This revision was automatically updated to reflect the committed changes.