[LoopVectorize] Don't create unnecessary vscale intrinsic calls
authorDavid Sherwood <david.sherwood@arm.com>
Mon, 19 Apr 2021 13:56:35 +0000 (14:56 +0100)
committerDavid Sherwood <david.sherwood@arm.com>
Thu, 22 Apr 2021 08:01:52 +0000 (09:01 +0100)
commit5a229a6702e2e810c4f8ed29eb3b5af01afff2c7
treee6fee0c675f4bc3217bdd01d745ec337e091e595
parentdff8315892e764c57324921bd75b4e9ad184de7c
[LoopVectorize] Don't create unnecessary vscale intrinsic calls

In quite a few cases in LoopVectorize.cpp we call createStepForVF
with a step value of 0, which leads to unnecessary generation of
llvm.vscale intrinsic calls. I've optimised IRBuilder::CreateVScale
and createStepForVF to return 0 when attempting to multiply
vscale by 0.

Differential Revision: https://reviews.llvm.org/D100763
llvm/lib/IR/IRBuilder.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/unittests/IR/IRBuilderTest.cpp