make -fno-rtti the default unless a directory builds with REQUIRES_RTTI.
[oota-llvm.git] / lib / Transforms / Utils / LowerInvoke.cpp
index 4ecf6d7ba2604de466159f46f244059e8912c377..766c4d99a8f91f64598fc171fa87831b0f600d25 100644 (file)
@@ -47,7 +47,6 @@
 #include "llvm/Transforms/Utils/Local.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Compiler.h"
 #include "llvm/Target/TargetLowering.h"
 #include <csetjmp>
 #include <set>
@@ -61,7 +60,7 @@ static cl::opt<bool> ExpensiveEHSupport("enable-correct-eh-support",
  cl::desc("Make the -lowerinvoke pass insert expensive, but correct, EH code"));
 
 namespace {
-  class VISIBILITY_HIDDEN LowerInvoke : public FunctionPass {
+  class LowerInvoke : public FunctionPass {
     // Used for both models.
     Constant *WriteFn;
     Constant *AbortFn;
@@ -87,7 +86,6 @@ namespace {
       // This is a cluster of orthogonal Transforms
       AU.addPreservedID(PromoteMemoryToRegisterID);
       AU.addPreservedID(LowerSwitchID);
-      AU.addPreservedID(LowerAllocationsID);
     }
 
   private:
@@ -116,7 +114,7 @@ FunctionPass *llvm::createLowerInvokePass(const TargetLowering *TLI) {
 // current module.
 bool LowerInvoke::doInitialization(Module &M) {
   const Type *VoidPtrTy =
-          PointerType::getUnqual(Type::getInt8Ty(M.getContext()));
+          Type::getInt8PtrTy(M.getContext());
   AbortMessage = 0;
   if (ExpensiveEHSupport) {
     // Insert a type for the linked list of jump buffers.
@@ -257,7 +255,7 @@ bool LowerInvoke::insertCheapEHSupport(Function &F) {
       // Insert a return instruction.  This really should be a "barrier", as it
       // is unreachable.
       ReturnInst::Create(F.getContext(),
-                         F.getReturnType() == Type::getVoidTy(F.getContext()) ?
+                         F.getReturnType()->isVoidTy() ?
                           0 : Constant::getNullValue(F.getReturnType()), UI);
 
       // Remove the unwind instruction now.
@@ -530,7 +528,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
                                                  "TheJmpBuf",
                                                  EntryBB->getTerminator());
     JmpBufPtr = new BitCastInst(JmpBufPtr,
-                        PointerType::getUnqual(Type::getInt8Ty(F.getContext())),
+                        Type::getInt8PtrTy(F.getContext()),
                                 "tmp", EntryBB->getTerminator());
     Value *SJRet = CallInst::Create(SetJmpFn, JmpBufPtr, "sjret",
                                     EntryBB->getTerminator());
@@ -585,7 +583,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
   Idx[0] = GetElementPtrInst::Create(BufPtr, Idx.begin(), Idx.end(), "JmpBuf",
                                      UnwindBlock);
   Idx[0] = new BitCastInst(Idx[0],
-             PointerType::getUnqual(Type::getInt8Ty(F.getContext())),
+             Type::getInt8PtrTy(F.getContext()),
                            "tmp", UnwindBlock);
   Idx[1] = ConstantInt::get(Type::getInt32Ty(F.getContext()), 1);
   CallInst::Create(LongJmpFn, Idx.begin(), Idx.end(), "", UnwindBlock);