[llvm] [SCCP] Handle llvm.vscale intrinsic calls (PR #114033)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 29 08:06:16 PDT 2024
dtcxzyw wrote:
> > I'm not opposed to handling more intrinsics in SCCP. But do we really need it? Can you provide some tests that cannot be simplified by InstSimplify/InstCombine?
>
> The motivating case for this is actually to make use of the constantrange information in Function Specialization. We see cases like the following:
>
> ```
> define i32 @void(i32 %x) vscale_range(1, 16) {
> ...
> %scale = call i32 @llvm.vscale.i32
> %bound = shl nsw nuw i32 %scale, 3
> %cmp = icmp ult i32 %x, %bound
> br i1 %cmp, label %after, label %work
>
> work:
> ...do a lot of work...
> br label %after
>
> after:
> ...
> ```
>
> We currently aren't able to detect that a specialization candidate, e.g. `{ x = 1 }`, can make the `%work` block dead, because in IPSCCP the SCCPSolver hasn't found `%bound` to have a constant range. This prevents us from properly estimating the codesize savings for a specialization.
Make sense to me. Can you add this case?
https://github.com/llvm/llvm-project/pull/114033
More information about the llvm-commits
mailing list