[PATCH] D62478: [LV] Wrap LV illegality reporting in a function. NFC.

Pavel Samolysov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 01:32:52 PDT 2019


psamolysov added a comment.

I believe the LoopVectorize class also should use this function since there are a number of occurrences of the same pattern: to report about a problem into `dbgs()` and emit an ORE (i.e. see the `LoopVectorizationCostModel::computeMaxVF`, `LoopVectorizationCostModel::selectVectorizationFactor` methods). So, if we don't want to duplicate the code, the method `reportVectorizationFailure` can't be a static function available only in a single translation unit. It could be a public method of `LoopVectorizationLegality` and be invoked via the `Legal` pointer, be a static method of the `LoopVectorizationLegality`, or be a non-static function defined there and taking `ORE` as a parameter, or just be duplicated in `LoopVectorizationLegality.cpp` and `LoopVectorize.cpp` but obviously this is not a good idea.

By the way, I'm a bit confused: in `LoopVectorizationLegality.cpp` the `createMissedAnalysis` function is used to emit an ORE while in `LoopVectorize.cpp` the `creatingLVMissedAnalysis`, which takes the pass name argument, is. I believe a PassName parameter (const char * with default value = nullptr) should be introduced for the `reportVectorizationFailure` function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62478





More information about the llvm-commits mailing list