Is there an easy way to detect whether auto vectorization had happened
in the IR level. Currently, I am trying to modify SIMD width at IR
level (changing from <8 *float > to <4 *float> etc). However, I am
having hard time to detect the exact basic block that is used for
vector.body. For now I am using more a worse method that detecting
instruction pattern that existed in the vector.body of my IR which i
am certain will not be able to apply to broader cases.
Why do you need to know the original basic-block? Surely if you are replacing vector of 8float with 4float, all you need to do is double up the actual operations? Anything else is unlikely to work in ALL cases, since the outer code may do non-obvious things based on having [for example] 8 elements per vector - it may have unrolled all or part of a loop, just to give a single example. [And watch for conversions from 8float to 8int and similar operations, that later lead to a conditional statement - this could get quite a challenge in the “unvectorize” case, as you need to understand how to split the conditions apart and maintain the same functionality.
I personally would have thought it easier to only let the vectorizer generate 4*float IR in the first place…