diff options
author | Kerry McLaughlin <kerry.mclaughlin@arm.com> | 2021-07-19 13:32:11 +0100 |
---|---|---|
committer | Kerry McLaughlin <kerry.mclaughlin@arm.com> | 2021-07-21 09:56:00 +0100 |
commit | e22a59967251294ccdac6b43a06f48c1b7075240 (patch) | |
tree | 83f7d94e2843dc753421c759c2fb71227db64517 /clang/lib/Lex/ModuleMap.cpp | |
parent | 278df28557f138481ac852d2d064d4c27626048a (diff) | |
download | llvm-e22a59967251294ccdac6b43a06f48c1b7075240.zip llvm-e22a59967251294ccdac6b43a06f48c1b7075240.tar.gz llvm-e22a59967251294ccdac6b43a06f48c1b7075240.tar.bz2 |
[LV] Use lookThroughAnd with logical reductions
If a reduction Phi has a single user which `AND`s the Phi with a type mask,
`lookThroughAnd` will return the user of the Phi and the narrower type represented
by the mask. Currently this is only used for arithmetic reductions, whereas loops
containing logical reductions will create a reduction intrinsic using the widened
type, for example:
for.body:
%phi = phi i32 [ %and, %for.body ], [ 255, %entry ]
%mask = and i32 %phi, 255
%gep = getelementptr inbounds i8, i8* %ptr, i32 %iv
%load = load i8, i8* %gep
%ext = zext i8 %load to i32
%and = and i32 %mask, %ext
...
^ this will generate an and reduction intrinsic such as the following:
call i32 @llvm.vector.reduce.and.v8i32(<8 x i32>...)
The same example for an add instruction would create an intrinsic of type i8:
call i8 @llvm.vector.reduce.add.v8i8(<8 x i8>...)
This patch changes AddReductionVar to call lookThroughAnd for other integer
reductions, allowing loops similar to the example above with reductions such
as and, or & xor to vectorize.
Reviewed By: david-arm, dmgreen
Differential Revision: https://reviews.llvm.org/D105632
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
0 files changed, 0 insertions, 0 deletions