Add another optimization from PR2330. Also catch some missing cases that are
[oota-llvm.git] / examples / BrainF / BrainFDriver.cpp
index 7d29fe6f72f790cacf07029580e157f7e50d8cbb..0a24d7b665f8919f61b762f011a296f6c192b824 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Sterling Stein and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===--------------------------------------------------------------------===//
 //
@@ -59,7 +59,7 @@ void addMainFunction(Module *mod) {
   //define i32 @main(i32 %argc, i8 **%argv)
   Function *main_func = cast<Function>(mod->
     getOrInsertFunction("main", IntegerType::Int32Ty, IntegerType::Int32Ty,
-                        PointerType::get(PointerType::get(
+                        PointerType::getUnqual(PointerType::getUnqual(
                           IntegerType::Int8Ty)), NULL));
   {
     Function::arg_iterator args = main_func->arg_begin();
@@ -70,17 +70,17 @@ void addMainFunction(Module *mod) {
   }
 
   //main.0:
-  BasicBlock *bb = new BasicBlock("main.0", main_func);
+  BasicBlock *bb = BasicBlock::Create("main.0", main_func);
 
   //call void @brainf()
   {
-    CallInst *brainf_call = new CallInst(mod->getFunction("brainf"),
-                                         "", bb);
+    CallInst *brainf_call = CallInst::Create(mod->getFunction("brainf"),
+                                             "", bb);
     brainf_call->setTailCall(false);
   }
 
   //ret i32 0
-  new ReturnInst(ConstantInt::get(APInt(32, 0)), bb);
+  ReturnInst::Create(ConstantInt::get(APInt(32, 0)), bb);
 }
 
 int main(int argc, char **argv) {