[clang] [Clang][RISCV] Add assumptions to vsetvli/vsetvlimax (PR #79975)

2024-02-18 Thread Wang Pengcheng via cfe-commits
wangpc-pp wrote: > Can we implement this in `computeKnownBitsFromOperator/getRangeForIntrinsic`? > > https://github.com/llvm/llvm-project/blob/b21e3282864c9f7ad656c64bc375f5869ef76d19/llvm/lib/Analysis/ValueTracking.cpp#L1578-L1584 Thanks! We can implement this partly (will create another PR

[clang] [Clang][RISCV] Add assumptions to vsetvli/vsetvlimax (PR #79975)

2024-02-12 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: Can we implement this in `computeKnownBitsFromOperator/getRangeForIntrinsic`? https://github.com/llvm/llvm-project/blob/b21e3282864c9f7ad656c64bc375f5869ef76d19/llvm/lib/Analysis/ValueTracking.cpp#L1578-L1584 https://github.com/llvm/llvm-project/pull/79975

[clang] [Clang][RISCV] Add assumptions to vsetvli/vsetvlimax (PR #79975)

2024-02-06 Thread Wang Pengcheng via cfe-commits
wangpc-pp wrote: Ping for comments. https://github.com/llvm/llvm-project/pull/79975 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][RISCV] Add assumptions to vsetvli/vsetvlimax (PR #79975)

2024-02-01 Thread Wang Pengcheng via cfe-commits
wangpc-pp wrote: > Also I guess most of RVV intrinsic could add `const` too, that could help > some generic optimization work better like CSE. This PR doesn't add the `const` attribute, I don't know if adding `const` may help to optimize. https://github.com/llvm/llvm-project/pull/79975

[clang] [Clang][RISCV] Add assumptions to vsetvli/vsetvlimax (PR #79975)

2024-02-01 Thread Kito Cheng via cfe-commits
kito-cheng wrote: Also I guess most of RVV intrinsic could add `const` too, that could help some generic optimization work better like CSE. https://github.com/llvm/llvm-project/pull/79975 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang][RISCV] Add assumptions to vsetvli/vsetvlimax (PR #79975)

2024-02-01 Thread Kito Cheng via cfe-commits
kito-cheng wrote: I guess we need add that at RVVEmitter::createbuilt...@riscvvemitter.cpp? [1] https://github.com/llvm/llvm-project/blob/main/clang/utils/TableGen/RISCVVEmitter.cpp#L418 [2] https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Basic/Builtins.h#L122-L124 [3]

[clang] [Clang][RISCV] Add assumptions to vsetvli/vsetvlimax (PR #79975)

2024-01-31 Thread Wang Pengcheng via cfe-commits
wangpc-pp wrote: > I'm concerned that llvm.assume is handled differently than a branch to > unreachable in the middle end. Actually the CodeGen part is written by referring to the LLVM IR generated by unreachable way (https://godbolt.org/z/vf1v7f744). > Have you tested that these assumes

[clang] [Clang][RISCV] Add assumptions to vsetvli/vsetvlimax (PR #79975)

2024-01-31 Thread Craig Topper via cfe-commits
topperc wrote: I'm concerned that llvm.assume is handled differently than a branch to unreachable in the middle end. Have you tested that these assumes have the intended effect? https://github.com/llvm/llvm-project/pull/79975 ___ cfe-commits mailing

[clang] [Clang][RISCV] Add assumptions to vsetvli/vsetvlimax (PR #79975)

2024-01-31 Thread Wang Pengcheng via cfe-commits
wangpc-pp wrote: After some random thinking, I think these assumptions may need to be added to vsetvli/vsetvlimax LLVM intrinsics instead of adding them in Clang CodeGen. In this way, we can make other frontends like `flang/Rust/TVM/MLIR/...` benefit from these assumptions. Is it possible? I

[clang] [Clang][RISCV] Add assumptions to vsetvli/vsetvlimax (PR #79975)

2024-01-31 Thread via cfe-commits
hiraditya wrote: cc: @alexey-bataev @nikolaypanchenko https://github.com/llvm/llvm-project/pull/79975 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][RISCV] Add assumptions to vsetvli/vsetvlimax (PR #79975)

2024-01-30 Thread Kito Cheng via cfe-commits
kito-cheng wrote: Does it possible to add testcases to demonstrate that can improve optimization? https://github.com/llvm/llvm-project/pull/79975 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Clang][RISCV] Add assumptions to vsetvli/vsetvlimax (PR #79975)

2024-01-30 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-backend-risc-v @llvm/pr-subscribers-clang Author: Wang Pengcheng (wangpc-pp) Changes There are some assumptions of the return value of vsetvli/vsetvlimax, we add them via `llvm.assume` so that middle-end optimizations can benefit from them. --- Patch