[llvm] eb3aad0 - [BrainF] Remove use of getSizeOf() (#222590)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 03:28:11 PDT 2026


Author: Nikita Popov
Date: 2026-09-10T12:28:06+02:00
New Revision: eb3aad0e4c85c8ce083648297950aa11c46b27e4

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

LOG: [BrainF] Remove use of getSizeOf() (#222590)

getSizeOf() is incompatible with ptradd. Also entirely unnecessary
here.

Added: 
    

Modified: 
    llvm/examples/BrainF/BrainF.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/examples/BrainF/BrainF.cpp b/llvm/examples/BrainF/BrainF.cpp
index 2a3c76021b17b..14e135eb464c8 100644
--- a/llvm/examples/BrainF/BrainF.cpp
+++ b/llvm/examples/BrainF/BrainF.cpp
@@ -90,8 +90,7 @@ void BrainF::header(LLVMContext& C) {
   ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal));
   Type* IntPtrTy = IntegerType::getInt32Ty(C);
   Type* Int8Ty = IntegerType::getInt8Ty(C);
-  Constant* allocsize = ConstantExpr::getSizeOf(Int8Ty);
-  allocsize = ConstantExpr::getTruncOrBitCast(allocsize, IntPtrTy);
+  Constant* allocsize = ConstantInt::get(IntPtrTy, 1);
   ptr_arr = builder->CreateMalloc(IntPtrTy, Int8Ty, allocsize, val_mem, nullptr,
                                   "arr");
 


        


More information about the llvm-commits mailing list