[PATCH] D130466: [LICM] - Add option to force thread model single
Shubham Narlawar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 7 02:29:24 PDT 2022
gsocshubham added inline comments.
================
Comment at: llvm/test/Transforms/LICM/promote-sink-store-arg.ll:73
+entry:
+ %n.addr = alloca i32, align 4
+ %u.addr = alloca i32, align 4
----------------
gsocshubham wrote:
> This IR is obtained from below C code -
>
> ```
> void f(int n, int u) {
> for (int i = 0; i < n; ++i) {
> u = i;
> }
> }
> ```
Updated test IR is obtained after running -sroad and -instnamer on -
```
int i, n;
void f(int u[n]) {
for (i = 0; i < n; ++i) {
if(u[i])
u[i] = i;
}
}
```
Here store to `u` will be not promoted.
================
Comment at: llvm/test/Transforms/LICM/promote-sink-store-capture.ll:83
+entry:
+ %n.addr = alloca i32, align 4
+ %u.addr = alloca i32, align 4
----------------
gsocshubham wrote:
> C testcase which is used to generate below IR -
>
> ```
> void f(int n, int u) {
> for (int i = 0, x = u; i < n; ++i) {
> x = i;
> }
> }
> ```
>
> Note - For capture case, store promotion happens irrespective of flag `-licm-force-thread-model-single` i.e. with just `-licm` with current state of LICM.
>
> In my last to last revision, without that flag captured store promotion was not happening, maybe some other patches in between have caused it.
Updated test IR is obtained after running -sroad and -instnamer on -
```
int i;
void f(int u) {
i = 0;
for (int x = u; i < 20; ++i) {
x = i;
}
}
```
Here store to `x` will be promoted.
================
Comment at: llvm/test/Transforms/LICM/promote-sink-store-constant-global.ll:77
+entry:
+ %n.addr = alloca i32, align 4
+ %x = alloca i32, align 4
----------------
gsocshubham wrote:
> This IR is obtained from C testcase -
>
> ```
> const int u = 7;
>
> void f(int n) {
> int x;
> for (int i = 0; i < n; ++i) {
> x = u;
> }
> }
> ```
Updated test IR is obtained after running -sroad and -instnamer on -
```
const int u;
int f(int n) {
int x, i;
for (i = 0; i < n; ++i) {
x = u;
}
return x + u;
}
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130466/new/
https://reviews.llvm.org/D130466
More information about the llvm-commits
mailing list