This is an archive of the discontinued LLVM Phabricator instance.

Improve reduction intrinsics by overloading result value.
ClosedPublic

Authored by sdesmalen on Jun 7 2019, 1:07 AM.

Details

Summary

This patch uses the mechanism from D62995 to strengthen the
definitions of the reduction intrinsics by letting the scalar
result/accumulator type be overloaded from the vector element type.

For example:

; The LLVM LangRef specifies that the scalar result must equal the 
; vector element type, but this is not checked/enforced by LLVM.
declare i32 @llvm.experimental.vector.reduce.or.i32.v4i32(<4 x i32> %a)

This patch changes that into:

declare i32 @llvm.experimental.vector.reduce.or.v4i32(<4 x i32> %a)

Which has the type-constraint more explicit and causes LLVM to check
the result type with the vector element type.

Diff Detail

Event Timeline

sdesmalen created this revision.Jun 7 2019, 1:07 AM
nikic added a subscriber: nikic.Jun 8 2019, 8:33 AM
dmgreen added a subscriber: dmgreen.Jun 9 2019, 1:11 PM
arsenm accepted this revision.Jun 10 2019, 2:51 PM

LGTM

This revision is now accepted and ready to land.Jun 10 2019, 2:51 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 13 2019, 2:36 AM