[PATCH] D78353: [LV] Don't emit the Vector IV if it is not used.

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 16:25:32 PDT 2020


Ayal added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:1890
     Value *ScalarIV = CreateScalarIV(Step);
     CreateSplatIV(ScalarIV, Step);
     return;
----------------
This doesn't really broadcast when VF<=1 so should be fine?


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:1920
   Value *ScalarIV = CreateScalarIV(Step);
   CreateSplatIV(ScalarIV, Step);
   buildScalarSteps(ScalarIV, Step, EntryVal, ID);
----------------
Would it be possible to avoid generating the undesired broadcasting by wrapping this CreateSplatIV() under an "if (needsVectorInduction(EntryVal))" that checks if any user !shouldScalarizeInstruction(), analogous to needsScalarInduction(EntryVal) above?

Better avoid generating and carrying potential garbage to begin with if it's easy; or potentially augment cse() clean-up at the end.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78353/new/

https://reviews.llvm.org/D78353





More information about the llvm-commits mailing list