This is an archive of the discontinued LLVM Phabricator instance.

[llvm-reduce] Fix crash when reducing integer vectors to 1
ClosedPublic

Authored by frasercrmck on Jul 13 2022, 3:28 AM.

Details

Summary

Integer vectors were previously ignored when reducing operands. When
6b8bd0f72 introduced support for reducing floating-point
scalars/vectors, the vector case was written to only handle
floating-point values. It would crash when creating an invalid
ConstantFP from the integer element type.

Instead of reinstating the old integer vector behaviour, we might as
well reduce integer vectors to all-one splats.

A couple of existing tests has also been renamed from "remove" to
"reduce" to better reflect the deltas they test.

Diff Detail

Event Timeline

frasercrmck created this revision.Jul 13 2022, 3:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 3:28 AM
frasercrmck requested review of this revision.Jul 13 2022, 3:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 3:28 AM
frasercrmck added inline comments.Jul 13 2022, 3:30 AM
llvm/test/tools/llvm-reduce/remove-operands-int.ll
1 ↗(On Diff #444204)

note: the delta seems to be called "reduce operands" but the floating-point test was called "remove" so I followed suit. Maybe they should both be renamed reduce-operands-*.ll?

I definitely support renaming any inaccurately named tests to be more accurate

Allen added a subscriber: Allen.Jul 13 2022, 7:07 AM
arsenm added inline comments.Jul 13 2022, 7:51 AM
llvm/test/tools/llvm-reduce/remove-operands-int.ll
1 ↗(On Diff #444204)

Probably should be reduce, the operands are replaced, not removed

61 ↗(On Diff #444204)

Nonsplat constant is another case worth testing

rename tests and add non-splat coverage

frasercrmck marked 2 inline comments as done.Jul 13 2022, 9:00 AM
frasercrmck added inline comments.
llvm/test/tools/llvm-reduce/remove-operands-int.ll
1 ↗(On Diff #444204)

Renamed this and the existing tests.

61 ↗(On Diff #444204)

Good idea. I've added that now

arsenm accepted this revision.Jul 13 2022, 9:04 AM
This revision is now accepted and ready to land.Jul 13 2022, 9:04 AM
frasercrmck edited the summary of this revision. (Show Details)Jul 13 2022, 9:07 AM
This revision was landed with ongoing or failed builds.Jul 13 2022, 9:08 AM
This revision was automatically updated to reflect the committed changes.
frasercrmck marked 2 inline comments as done.