This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][InstCombine] Optimize coercion through an undef vector
AbandonedPublic

Authored by asavonic on Apr 9 2021, 1:16 PM.

Details

Reviewers
None
Summary

Clang (after D100225) generates the following sequence as a way to
keep information about undefined bits in a coerced value:

%call = tail call i64 @_Z3fooi(i32 %x) #2
%coerce.val.ii = trunc i64 %call to i32
%coerce.val.vec = insertelement <2 x i32> undef, i32 %coerce.val.ii, i8 0
%coerce.val.vec.ii = bitcast <2 x i32> %coerce.val.vec to i64
ret i64 %coerce.val.vec.ii

This can be folded to just call + ret, because higher bits are known
to be undef.

Diff Detail

Event Timeline

asavonic created this revision.Apr 9 2021, 1:16 PM
asavonic requested review of this revision.Apr 9 2021, 1:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 9 2021, 1:16 PM
asavonic retitled this revision from [AArch64] Teach InstCombine to optimize coercion through an undef vector to [AArch64][InstCombine] Optimize coercion through an undef vector.Apr 11 2021, 8:02 AM
asavonic abandoned this revision.Nov 9 2021, 5:03 AM