[PATCH] D21101: [exceptions] Upgrade exception handlers when stack protector is used

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 12:55:42 PDT 2016


majnemer added inline comments.

================
Comment at: include/llvm/Analysis/EHPersonalities.h:72-74
@@ -71,1 +71,5 @@
 
+/// \brief Returns a promoted personality function compatible with
+/// stack-protection.
+Value* getStackGuardEHPersonality(Value *Pers);
+
----------------
I'd sink this into WinEHPrepare unless you expect to use it elsewhere.

================
Comment at: lib/Analysis/EHPersonalities.cpp:44
@@ -42,1 +43,3 @@
 
+Value* llvm::getStackGuardEHPersonality(Value *Pers) {
+  Function *F =
----------------
Please change the return type to `Value *`.

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:681-683
@@ +680,5 @@
+
+  Value* PersonalityFn = F.getPersonalityFn();
+  if (PersonalityFn) {
+    Value* Personality = getStackGuardEHPersonality(PersonalityFn);
+    if (Personality) {
----------------
Ditto.

================
Comment at: lib/CodeGen/WinEHPrepare.cpp:683-684
@@ +682,4 @@
+  if (PersonalityFn) {
+    Value* Personality = getStackGuardEHPersonality(PersonalityFn);
+    if (Personality) {
+      Function* PromotedFn = cast<Function>(Personality);
----------------
You can Fold the assignment into the if.

================
Comment at: testCodeGenWinEHwineh-promote-eh.ll:1
@@ +1,2 @@
+; RUN: opt -mtriple=-mtriple=i686-windows-msvc -S -winehprepare %s | FileCheck %s
+
----------------
-mtriple=-mtriple= looks funky


http://reviews.llvm.org/D21101





More information about the llvm-commits mailing list