banach-space / llvm-tutor

A collection of out-of-tree LLVM passes for teaching and learning
MIT License
2.95k stars 393 forks source link

SLPVectorizer didn't vectorize test examples #86

Closed khei4 closed 1 year ago

khei4 commented 1 year ago

for SLP tests, File check commands have lacked. If add it, tests failed. So it might be better to update them. like

; RUN: opt -passes=slp-vectorizer,dce -mtriple=x86_64-unknown-linuxgnu -S %s | FileCheck %s

If this is intentional for some reasons, close this silently :)

https://github.com/banach-space/llvm-tutor/blob/main/test/llvm/slp_x86.ll https://github.com/banach-space/llvm-tutor/blob/main/test/llvm/slp_aarch64.ll

khei4 commented 1 year ago

Vector addition tests seem reasonable to introduction tests.

https://github.com/llvm/llvm-project/blob/8b56da5e9f3ba737a5ff4bf5dee654416849042f/llvm/test/Transforms/SLPVectorizer/X86/addsub.ll

https://github.com/llvm/llvm-project/blob/580210a0c938531ef9fd79f9ffedb93eeb2e66c2/llvm/test/Transforms/SLPVectorizer/X86/arith-add.ll

banach-space commented 1 year ago

Hi @khei4 , thank you for visiting and for reporting this!

If this is intentional for some reasons, close this silently :)

No, this is an oversight. I don't remember why I left it like this. Clearly these tests need some love, but I don't have the bandwidth. PRs are welcome ;-)

-Andrzej

khei4 commented 1 year ago

@banach-space Thank you for replying! These examples seem to be decided unprofitable to vectorize, I found a similar case on the LLVM discourse thread. Adding -slp-threshold=-100 vectorized these examples, and updating the tests with update_test_checks.py works fine. Adding a negative threshold seems better to keep the test simple I think. TBH, I'm not familiar with the syntax for FileCheck, but I'll work on sustaining the original test cases :)

banach-space commented 1 year ago

Having auto-generated checks is better than no checks at all ;-)