[llvm] [LV] Cost EVL width-adjusting zext/trunc as free (PR #225016)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 03:08:11 PDT 2026


lukel97 wrote:

> I cooked one with AI's assistance: https://github.com/wangpc-pp/llvm-project/commits/main-evl-getvl-i64. I think overloading the result type of `llvm.experimental.get.vector.length` won't fix everything, because the `EVL` parameter of VP intrinsics is also fixed to `i32` type. It can remove some `zext/trunc` of the result, but it also results in more `trunc i64 to i32` when passing the result of `llvm.experimental.get.vector.length` to VP intrinsics. All these are by-designed and we can't balance both except that we overload VP's EVL parameter as well. But this change is too large. cc @lukel97 @ElvisWang123
> 
> So maybe we can go with the approach in this PR? And I don't think we need a new TTI hook since it seems to be true for all cases I can see.

Argh that's right, I forgot about the EVL argument being fixed to i32. The approach in this PR seems fine then

https://github.com/llvm/llvm-project/pull/225016


More information about the llvm-commits mailing list