[llvm] dd3d679 - [NFC] Fixes BrainF example build failure caused by c143b77b30fc23f70aac94be66e412651771c0fc

Vasileios Porpodas via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 14:25:49 PST 2022


Author: Vasileios Porpodas
Date: 2022-12-14T14:16:04-08:00
New Revision: dd3d679179f78d39ae8dba7af77a7b0b96fa53aa

URL: https://github.com/llvm/llvm-project/commit/dd3d679179f78d39ae8dba7af77a7b0b96fa53aa
DIFF: https://github.com/llvm/llvm-project/commit/dd3d679179f78d39ae8dba7af77a7b0b96fa53aa.diff

LOG: [NFC] Fixes BrainF example build failure caused by c143b77b30fc23f70aac94be66e412651771c0fc

Added: 
    

Modified: 
    llvm/examples/BrainF/BrainF.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/examples/BrainF/BrainF.cpp b/llvm/examples/BrainF/BrainF.cpp
index 6075c85d06d1..5d0cbd8d8f87 100644
--- a/llvm/examples/BrainF/BrainF.cpp
+++ b/llvm/examples/BrainF/BrainF.cpp
@@ -96,7 +96,7 @@ void BrainF::header(LLVMContext& C) {
   allocsize = ConstantExpr::getTruncOrBitCast(allocsize, IntPtrTy);
   ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, Int8Ty, allocsize, val_mem, 
                                    nullptr, "arr");
-  BB->getInstList().push_back(cast<Instruction>(ptr_arr));
+  cast<Instruction>(ptr_arr)->insertAt(BB, BB->end());
 
   //call void @llvm.memset.p0i8.i32(i8 *%arr, i8 0, i32 %d, i1 0)
   {
@@ -128,7 +128,7 @@ void BrainF::header(LLVMContext& C) {
   endbb = BasicBlock::Create(C, label, brainf_func);
 
   //call free(i8 *%arr)
-  endbb->getInstList().push_back(CallInst::CreateFree(ptr_arr, endbb));
+  CallInst::CreateFree(ptr_arr, endbb)->insertAt(endbb, endbb->end());
 
   //ret void
   ReturnInst::Create(C, endbb);


        


More information about the llvm-commits mailing list