[llvm] [llvm] Mark win x64 SEH pseudo instruction as meta instructions (PR #110889)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 03:43:04 PDT 2024


mstorsjo wrote:

Unfortunately, this caused errors, quite surprisingly, when compiling for i386. How that's possible, I'm not quite sure, but I've bisected and verified that the issue indeed is caused by this commit.

Repro:
```c++
using a = int;
class b {
public:
  void c();
};
struct B;
template <class> struct e { typedef B f; };
template <class g> struct h : e<g>::f {};
struct B {
  h<int> *operator->() { return static_cast<h<int> *>(this); }
  a i;
};
class j {
  using k = B;
  k d;

public:
  a l() { return d->i; }
};
class m {
  enum { aa };
  struct {
    char n[sizeof(void *)];
    j *ab;
    a m_fn4() const { return n[aa] ? ab->l() : 1; }
  } o;

public:
  bool p() const {
    a r = o.m_fn4();
    return r;
  }
};
bool q;
struct G {
  bool s() const;
  m ag;
};
bool G::s() const {
  q = ag.p();
  b().c();
}
```

```console
$ clang -target i686-w64-mingw32 -w -c repro.cpp -O3 -g -gcodeview
error: directive must appear between .cv_fpo_proc and .cv_fpo_endprologue
error: directive must appear between .cv_fpo_proc and .cv_fpo_endprologue
2 errors generated.
```

The same issue also triggers for `i686-windows-msvc` targets (where the last `-gcodeview` is redundant).

I'm not quite sure why this happens, for i686, which shouldn't be using these SEH instructions at all.

But nevertheless, I'll go ahead and revert this commit to unbreak things, and then we can sort out the proper fix afterwards.

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


More information about the llvm-commits mailing list