[PATCH] D78054: [VFDatabase] Scalar functions are vector functions with VF =1

Francesco Petrogalli via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 14:34:15 PDT 2020


fpetrogalli added inline comments.


================
Comment at: llvm/test/Transforms/LoopVectorize/vectorizeVFone.ll:8
+; CHECK-LABEL: getScalarFunc
+; CHECK-NOT: call fast <{{[0-9]+}} x double> @{{.*}}atan{{.*}}(<{{[0-9]+}} x double> %{{[0-9]+}})
+entry:
----------------
masoud.ataei wrote:
> fpetrogalli wrote:
> > Are you sure you are checking the right thing here? If vectorization happens with VF = 2, you wouldn't be catching this because the VFDatabase would be redirecting the VF=2 call  to `__atand2_massv`, as specified by the VFABI attribute below. If my understanding is correct, whaat you want to test here is that the compiler doesn't crash, and that it does not emit vector code. I think that should be tested by:
> > 
> > ```
> > ; CHECK-LABEL: getScalarFunc
> > ; CHECK-NOT: <{{[0-9]+}} x double>
> > ```
> I checked the force vectorize with vectorization factor=2, and I get this line:
> 
> ```
> %10 = call fast <2 x double> @__atand2_massv(<2 x double> %9)
> ```
> So this will be caught by that check. About `__atand2_massv` function, regular expression `{{.*}}atan{{.*}}` will trigger it. 
> 
> The reason that I cannot simply check for `<{{[0-9]+}} x double>` is this: There is 
> ```
> declare <2 x double> @__atand2_massv(<2 x double>) #1
> ```
> declaration in IR when you want to do vectorization. So `CHECK-NOT: <{{[0-9]+}} x double>` will always return true. 
Thank you for explaining! I missed the fact that the check was valid also for the massv version of atan2. Might be worth adding a comment right before the check, saying that such check is supposed to catch also the massv version of the function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78054





More information about the llvm-commits mailing list