[llvm] [X86] combineSelect - relax "vselect (X & C == 0), LHS, RHS" --> "vselect (X & C != 0), RHS, LHS" type limitation (PR #173366)

Walter Lee via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 30 04:38:22 PST 2025


googlewalt wrote:

Hi.  This causes clang crashes.  To reproduce, run this command on the attached source:

```
clang -O2 --target=x86_64-grtev4-linux-gnu -mavx -std=gnu++20 -c input.cc -o input.o
```

```
struct A {
  virtual void m_fn1(int*, int) const;
};
struct B {
  B(A*);
};
int ai, q, k, n;
constexpr int ak = sizeof(int) * 8;
template <class r>
void s(r a, int p2) {
  bool j;
  for (int i = 0; i < p2; ++i) {
    j = q & 1 << i;
    a(i, j);
  }
}
template <class r>
void t(r a) {
  long an;
  s(a(an), ak);
}
int* b;
struct C {
  template <typename r>
  void d(r a) {
    t([&](long ac) {
      auto al = a(ac);
      return [=](int i, bool ad) { al(i, ad, b[i]); };
    });
  }
};
struct f {
  int operator()(int*, int, int) {
    C g;
    float h;
    g.d([&](long) {
      return [=](long, bool ad, float ae) { ai = ad ? ae : h; };
    });
  }
};
template <typename... l>
auto c() {
  return [](int* af, l... ag) { f()(af, ag...); };
}
auto m = c<float, float>();
struct F : A {
  void m_fn1(int* a, int) const { m(a, k, n); }
};
void e() { B(new F); }

```


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


More information about the llvm-commits mailing list