Reduce llvm.vscale to constant based on vscale_range attribute.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Hi @junparser, thanks for looking into this performance improvement! However, I personally think it makes more sense to just always replace a call to vscale directly with a constant if you know the value of vscale at runtime - possibly done in InstSimplify or something like that? That way you don't need to add lots of different instcombine changes to support all the different folds that can happen. Constant folds would just kick in automatically.
llvm/lib/Analysis/InstructionSimplify.cpp | ||
---|---|---|
5787 | I'd say that SVE isn't a good variable name here since RISC-V will also use this attribute at some point. |
llvm/lib/Analysis/InstructionSimplify.cpp | ||
---|---|---|
5787 | Ah, good spot @frasercrmck ! Sorry I missed that. :( |
llvm/test/Transforms/InstSimplify/fold-vscale.ll | ||
---|---|---|
10 | The shifts in these tests are not necessary to show the transform, so I'd take them out. |
llvm/lib/Analysis/InstructionSimplify.cpp | ||
---|---|---|
5787 | nit: I think 'Scalar' here is a bit confusing as that's kind of the opposite of 'Vector'. Perhaps 'Scalable' is better? |
llvm/lib/Analysis/InstructionSimplify.cpp | ||
---|---|---|
5787 | Yeah. Or VScaleMin and VScaleMax? |
I'd say that SVE isn't a good variable name here since RISC-V will also use this attribute at some point.