This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] [ExpandReduction] Fix the bug for ExpandReduction() when vector size isn't power of 2
ClosedPublic

Authored by ZhangKang on Oct 7 2019, 7:05 PM.

Details

Summary

For below test case, we will get assert error except for AArch64 and ARM:

declare i8 @llvm.experimental.vector.reduce.and.i8.v3i8(<3 x i8> %a)
define i8 @test_v3i8(<3 x i8> %a) nounwind {
  %b = call i8 @llvm.experimental.vector.reduce.and.i8.v3i8(<3 x i8> %a)
  ret i8 %b
}

In the function getShuffleReduction (), we can see it needs the vector size must be power of 2.

This patch is fix below error when the number of element is not power of 2 for those llvm.experimental.vector.reduce.* function.

Diff Detail

Event Timeline

ZhangKang created this revision.Oct 7 2019, 7:05 PM
ZhangKang edited the summary of this revision. (Show Details)Oct 7 2019, 7:10 PM
jsji accepted this revision as: jsji.Oct 27 2019, 9:14 AM

LGTM.

This revision is now accepted and ready to land.Oct 27 2019, 9:14 AM
This revision was automatically updated to reflect the committed changes.