[llvm] [BrainF] Remove use of getSizeOf() (PR #222590)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 03:28:04 PDT 2026
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/222590
getSizeOf() is incompatible with ptradd. Also entirely unnecessary
here.
>From b65ed8aa0f582e0607394ab91bd9c36bf8dfdf74 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Thu, 10 Sep 2026 12:25:57 +0200
Subject: [PATCH] [BrainF] Remove use of getSizeOf()
getSizeOf() is incompatible with ptradd. Also entirely unnecessary
here.
---
llvm/examples/BrainF/BrainF.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
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