[PATCH] D63396: [WinEH] Allocate space in funclets stack to save XMM CSRs

Pengfei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 17:28:32 PDT 2019


pengfei added a comment.

In D63396#1638301 <https://reviews.llvm.org/D63396#1638301>, @rnk wrote:

> This broke this C++ code:
>
>   int getcsr();
>   void usecsrs(double, int, int, int, int, int, int, int, int);
>   double getxmm();
>   struct HasDtor {
>     int x = 42;
>     ~HasDtor();
>   };
>   int foo() {
>     int v1 = getcsr();
>     int v2 = getcsr();
>     int v3 = getcsr();
>     int v4 = getcsr();
>     int v5 = getcsr();
>     int v6 = getcsr();
>     int v7 = getcsr();
>     int v8 = getcsr();
>     double f1 = getxmm();
>     HasDtor o;
>     usecsrs(f1, v1, v2, v3, v4, v5, v6, v7, v8);
>     usecsrs(f1, v1, v2, v3, v4, v5, v6, v7, v8);
>     usecsrs(f1, v1, v2, v3, v4, v5, v6, v7, v8);
>     usecsrs(f1, v1, v2, v3, v4, v5, v6, v7, v8);
>     return v1 + v2 + v3 + v4 + v5 + v6 + v7 + v8;
>   }
>
>
> The movaps instruction in the funclet epilogue does not match the prologue:
>
>   $ ninja -j900 clang && clang -S t.cpp  -o - -O1 | grep 'movaps.*rsp\|dtor'
>   ninja: no work to do.
>           .def     "?dtor$5@?0??foo@@YAHXZ at 4HA";
>   "?dtor$5@?0??foo@@YAHXZ at 4HA":
>   .seh_proc "?dtor$5@?0??foo@@YAHXZ at 4HA"
>           movaps  %xmm6, 64(%rsp)
>           movaps  72(%rsp), %xmm6
>           .long   "?dtor$5@?0??foo@@YAHXZ at 4HA"@IMGREL # Action
>
>
> The code crashes in the epilogue.
>
> I fixed a different issue in rL368631 <https://reviews.llvm.org/rL368631>, but I think this time I will revert this.


Thanks for reporting this, I found a similar issue and got a solution. Can you wait for a moment and I will put the patch on Phabricator?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63396/new/

https://reviews.llvm.org/D63396





More information about the llvm-commits mailing list