Skip to content

Remove power-of-two constraint on the trip count when tail folding #82626

Open
@SamTebbs33

Description

@SamTebbs33

Currently, in getMaximizedVFForTarget in LoopVectorize.cpp, we add a constraint when tail-folding that the trip count (number of elements processed per loop iteration) we are working with must be a power of two in order for us to clamp the vector factor (number of vector elements processed per loop iteration when the loop is vectorised). If we know, for example, the maximum trip count is 7, it seems wasteful to still choose VF=16 or VF=vscale x 16. We would be better off clamping the value to be VF=8 or VF=vscale x 8 in that case, with the remaining element being ignored since we're tail-folding.

(!FoldTailByMasking || isPowerOf2_32(MaxTripCount))) {

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions