summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEtienne Bergeron <etienneb@google.com>2016-06-30 17:52:24 +0000
committerEtienne Bergeron <etienneb@google.com>2016-06-30 17:52:24 +0000
commit078d8f69b6e62a6f68c40cc7d2e8b5ef632fb2ba (patch)
treef93f9fc3e091d4169ae31c5a3de77311f731fd45
parentbc4618647f9657af9442c20a35c7a8a6c54aff53 (diff)
downloadbcm5719-llvm-078d8f69b6e62a6f68c40cc7d2e8b5ef632fb2ba.tar.gz
bcm5719-llvm-078d8f69b6e62a6f68c40cc7d2e8b5ef632fb2ba.zip
revert http://reviews.llvm.org/D21101
llvm-svn: 274251
-rw-r--r--llvm/lib/CodeGen/WinEHPrepare.cpp39
-rw-r--r--llvm/test/CodeGen/WinEH/wineh-promote-eh.ll16
2 files changed, 0 insertions, 55 deletions
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp
index e4cee0ea7f6..041fb7b912b 100644
--- a/llvm/lib/CodeGen/WinEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WinEHPrepare.cpp
@@ -20,7 +20,6 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/StringSwitch.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/EHPersonalities.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
@@ -68,7 +67,6 @@ public:
}
private:
- void promoteEHPersonality(Function &F);
void insertPHIStores(PHINode *OriginalPHI, AllocaInst *SpillSlot);
void
insertPHIStore(BasicBlock *PredBlock, Value *PredVal, AllocaInst *SpillSlot,
@@ -466,39 +464,6 @@ static int addClrEHHandler(WinEHFuncInfo &FuncInfo, int HandlerParentState,
return FuncInfo.ClrEHUnwindMap.size() - 1;
}
-static Value *getStackGuardEHPersonality(Value *Pers) {
- Function *F =
- Pers ? dyn_cast<Function>(Pers->stripPointerCasts()) : nullptr;
- if (!F)
- return nullptr;
-
- // TODO(etienneb): Upgrade exception handlers when they are working.
- StringRef NewName = llvm::StringSwitch<StringRef>(F->getName())
- .Case("_except_handler3", "_except_handler4")
- .Default("");
- if (NewName.empty())
- return nullptr;
-
- Module *M = F->getParent();
- return M->getOrInsertFunction("_except_handler4", F->getFunctionType(),
- F->getAttributes());
-}
-
-void WinEHPrepare::promoteEHPersonality(Function &F) {
- // Promote the exception handler when stack protection is activated.
- if (!F.hasFnAttribute(Attribute::StackProtect) &&
- !F.hasFnAttribute(Attribute::StackProtectReq) &&
- !F.hasFnAttribute(Attribute::StackProtectStrong))
- return;
-
- if (Value *PersonalityFn = F.getPersonalityFn()) {
- if (Value *Personality = getStackGuardEHPersonality(PersonalityFn)) {
- Function* PromotedFn = cast<Function>(Personality);
- F.setPersonalityFn(PromotedFn);
- }
- }
-}
-
void llvm::calculateClrEHStateNumbers(const Function *Fn,
WinEHFuncInfo &FuncInfo) {
// Return if it's already been done.
@@ -1063,10 +1028,6 @@ void WinEHPrepare::verifyPreparedFunclets(Function &F) {
}
bool WinEHPrepare::prepareExplicitEH(Function &F) {
- // When stack-protector is present, some exception handlers need to be
- // promoted to a compatible handlers.
- promoteEHPersonality(F);
-
// Remove unreachable blocks. It is not valuable to assign them a color and
// their existence can trick us into thinking values are alive when they are
// not.
diff --git a/llvm/test/CodeGen/WinEH/wineh-promote-eh.ll b/llvm/test/CodeGen/WinEH/wineh-promote-eh.ll
deleted file mode 100644
index 7bda4d7bd4d..00000000000
--- a/llvm/test/CodeGen/WinEH/wineh-promote-eh.ll
+++ /dev/null
@@ -1,16 +0,0 @@
-; RUN: opt -mtriple=i686-windows-msvc -S -winehprepare %s | FileCheck %s
-
-declare i32 @_except_handler3(...)
-
-define void @test1a() personality i32 (...)* @_except_handler3 {
-; CHECK: define void @test1a() personality i32 (...)* @_except_handler3
-entry:
- ret void
-}
-
-define void @test1b() ssp personality i32 (...)* @_except_handler3 {
-; CHECK: define void @test1b() [[attr:.*]] personality i32 (...)* @_except_handler4
-entry:
- ret void
-}
-
OpenPOWER on IntegriCloud