[llvm] [SLP]Change the insertion point for outside-block-used nodes and prevec phi operand gathers (PR #139917)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Sat May 17 01:19:11 PDT 2025


mstorsjo wrote:

This broke compilation of an older version of Qt.
Reduced repro:
```c++
typedef double qreal;
void qRound(double);
struct QMatrix {
  qreal _m11, _m12;
  qreal _dx, _dy;
};
enum TransformationType { TxScale, TxShear, TxProject = 10 };
QMatrix affine;
qreal affine_3, affine_2, mapToPolygon_w;
struct QTransform {
  void mapToPolygon() const;
  TransformationType inline_type() const;
};
void QTransform::mapToPolygon() const {
  TransformationType t = inline_type();
  qreal x[2]{};
  qreal x_0, y_1, y_0, x_2, y_2;
  if (t <= TxScale) {
    y_0 = affine._dy;
    qreal h = y_1 = affine._dy;
    y_2 = h;
  } else
    switch (t) {
    case TxShear:
    case TxProject:
      x_0 = affine._dx;
      if (t == TxProject)
        x[1] *= y_1 *= mapToPolygon_w;
    }
  switch (t) {
  case TxShear:
  case TxProject:
    x_2 = affine._m11 + affine_2 * 0 + affine._dx;
    y_2 = affine._m12 + affine_3 * 0 + affine._dy;
    if (t == TxProject) {
      x_2 *= 0;
      y_2 *= 0;
    }
  }
  qRound(x_0);
  qRound(y_0);
  qRound(x[1]);
  qRound(y_1);
  qRound(x_2);
  qRound(y_2);
}
```
Compiled like this:
```console
$ clang -target x86_64-linux-gnu -c -O2 repro.cpp
 Instruction does not dominate all uses!
  %22 = fadd <2 x double> %17, %18
  %19 = shufflevector <2 x double> %22, <2 x double> poison, <6 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison>
in function _ZNK10QTransform12mapToPolygonEv
fatal error: error in backend: Broken function found, compilation aborted!
```

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


More information about the llvm-commits mailing list