Re: [PATCH V2] Support folding min(poly,poly) to const

2023-09-08 Thread Lehua Ding
Sorry, just realised that the poly_int_tree_p tests are redundant. The caller has already checked that. Indeed, I will removed poly_int_tree_p tests like the following code. Thanks for timely remind. /* Returns true if we know who is smaller or equal, ARG1 or ARG2, and set the min value

Re: [PATCH V2] Support folding min(poly,poly) to const

2023-09-08 Thread Richard Sandiford via Gcc-patches
Richard Sandiford writes: > Lehua Ding writes: >> Hi, >> >> This patch adds support that tries to fold `MIN (poly, poly)` to >> a constant. Consider the following C Code: >> >> ``` >> void foo2 (int* restrict a, int* restrict b, int n) >> { >> for (int i = 0; i < 3; i += 1) >> a[i] += b

Re: Re: [PATCH V2] Support folding min(poly,poly) to const

2023-09-08 Thread 钟居哲
Thanks Richard and Lehua. LGTM from RISC-V side. juzhe.zh...@rivai.ai From: Richard Sandiford Date: 2023-09-08 16:12 To: Lehua Ding CC: gcc-patches; richard.guenther; juzhe.zhong; jeffreyalaw Subject: Re: [PATCH V2] Support folding min(poly,poly) to const Lehua Ding writes: > Hi, >

Re: [PATCH V2] Support folding min(poly,poly) to const

2023-09-08 Thread Richard Sandiford via Gcc-patches
Lehua Ding writes: > Hi, > > This patch adds support that tries to fold `MIN (poly, poly)` to > a constant. Consider the following C Code: > > ``` > void foo2 (int* restrict a, int* restrict b, int n) > { > for (int i = 0; i < 3; i += 1) > a[i] += b[i]; > } > ``` > > Before this patch: >

[PATCH V2] Support folding min(poly,poly) to const

2023-09-07 Thread Lehua Ding
Hi, This patch adds support that tries to fold `MIN (poly, poly)` to a constant. Consider the following C Code: ``` void foo2 (int* restrict a, int* restrict b, int n) { for (int i = 0; i < 3; i += 1) a[i] += b[i]; } ``` Before this patch: ``` void foo2 (int * restrict a, int * restri