[PATCH] D103664: [Windows SEH]: Fix -O2 crash for Windows -EHa

Zahira Ammarguellat via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 4 12:44:18 PDT 2021


zahiraam added a comment.

In D103664#2799725 <https://reviews.llvm.org/D103664#2799725>, @tentzen wrote:

> In D103664#2798732 <https://reviews.llvm.org/D103664#2798732>, @aganea wrote:
>
>> Thanks for the quick fix! Would you mind fixing the two failing tests please? (see above)
>
> Hmm, I cannot repro locally..
>
> @zahiraam, currently -EHa is not completely ready yet. we need a couple of more patches.  So turn it off to preserve zero-diff, unless that -fasync-exceptions is explicitly specified.

Got it. Thanks. 
I was able to repro the fails. And this is the fix for it:
diff --git a/clang/test/CodeGen/windows-seh-EHa-CppDtors01.cpp b/clang/test/CodeGen/windows-seh-EHa-CppDtors01.cpp
index 47117b4a9613..b9195a2920e6 100644

- a/clang/test/CodeGen/windows-seh-EHa-CppDtors01.cpp

+++ b/clang/test/CodeGen/windows-seh-EHa-CppDtors01.cpp
@@ -1,60 +1,54 @@
 // RUN: %clang_cc1 -triple x86_64-windows -fasync-exceptions -fcxx-exceptions -fexceptions -fms-extensions -x c++ -Wno-implicit-function-declaration -S -emit-llvm %s -o - | FileCheck %s

-

-// CHECK: invoke void @llvm.seh.scope.begin()
-// CHECK: invoke void @llvm.seh.scope.begin()
-// CHECK: invoke void @llvm.seh.scope.begin()
-// CHECK: invoke void @llvm.seh.scope.end()
-// CHECK: invoke void @llvm.seh.scope.end()
-// CHECK: invoke void @llvm.seh.scope.end()
+// RUN: %clang_cc1 -triple x86_64-windows -fasync-exceptions -fcxx-exceptions -fexceptions -fms-extensions -x c++ -Wno-implicit-function-declaration -O2 -S -emit-llvm %s -o - | FileCheck %s

// CHECK: invoke void @llvm.seh.try.begin()
-// CHECK: %[[src:[0-9-]+]] = load volatile i32, i32* %i
-// CHECK-NEXT: invoke void @"?crash@@YAXH at Z"(i32 %[[src]])
+// CHECK: = load volatile i32, i32* %i
+// CHECK-NEXT: invoke void @"?crash@@YAXH at Z"(i32
 // CHECK: invoke void @llvm.seh.try.end()

I was able to repro the fail and this is the fix for it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103664



More information about the cfe-commits mailing list