[llvm] [X86, SimplifyCFG] Support hoisting load/store with conditional faulting (Part II) (PR #108812)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 27 05:50:08 PDT 2024


RKSimon wrote:

For cases like this why aren't we folding to:
```
void src(int a, int *c, int *d) {
  if (a)
   *c = a;
  else
   *d = a;
}

void tgt(int a, int *c, int *d) {
  int *p = a ? c : d;
  *p = a;
}
```
or the even more general:
```
void src(int s, int a, int b, int *c, int *d) {
  if (s)
   *c = a;
  else
   *d = b;
}

void tgt(int s, int a, int b, int *c, int *d) {
  int *p = s ? c : d;
  int v = s ? a : b;
  *p = v;
}
```

https://github.com/llvm/llvm-project/pull/108812


More information about the llvm-commits mailing list