[clang] [clang][CodeGen] Fix metadata when vectorization is disabled by pragma (PR #135163)
Michael Kruse via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 23 04:52:14 PDT 2025
https://github.com/Meinersbur commented:
Unfortuantely IIRC there is a semantic difference between pragma and metadata:
* llvm.loop.vectorize.enable==false disables vectorization AND interleaving (by switching off the entire LoopVectorize pass which does both of thise things)
* llvm.loop.vectorize.width==1 disables vectorization, but still permits interlaving
* llvm.loop.interleave.count==1 should disable interleaving but still permit vectorization
This is why `vectorize(disable)` should only set ` llvm.loop.vectorize.width==1`, interleaving is still permitted (like unrolling still is). Only `vectorize(disable) interlave(disable)` could theoretically set the `llvm.loop.vectorize.enable==false` metadata.
You could theoretically add a separate `llvm.loop.interlave.enable` and followup-metadata with the corresponding compatibility problem (which is why I didn't do this).
I think the correct logic should detect that "llvm.loop.vectorize.width==1" means off, and like that add the unroll to the metadata node itself, instead its followup.
https://github.com/llvm/llvm-project/pull/135163
More information about the cfe-commits
mailing list