@@ -324,10 +324,8 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id,
324324 auto * string_arg = context.GetValue (string_inst_id);
325325
326326 // Check if this is a pointer to a String or a String value
327- // If it's a pointer (from a reference), load it first
328327 llvm::Value* string_value;
329328 if (string_arg->getType ()->isPointerTy ()) {
330- // Load the struct from the pointer
331329 auto string_type_id = context.GetTypeIdOfInst (string_inst_id);
332330 auto * string_type = context.GetType (string_type_id);
333331 string_value = context.builder ().CreateLoad (
@@ -338,7 +336,6 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id,
338336 }
339337
340338 // String is a struct with ptr and size fields
341- // Extract the pointer field (field 0)
342339 auto * string_ptr_field = context.builder ().CreateExtractValue (
343340 string_value, {0 }, " string.ptr" );
344341
@@ -350,12 +347,11 @@ static auto HandleBuiltinCall(FunctionContext& context, SemIR::InstId inst_id,
350347 llvm::Type::getInt8Ty (context.llvm_context ()),
351348 string_ptr_field, index_value, " string.char_ptr" );
352349
353- // Load the character
354350 auto * char_i8 = context.builder ().CreateLoad (
355351 llvm::Type::getInt8Ty (context.llvm_context ()),
356352 char_ptr, " string.char" );
357353
358- // Extend to i32 (Char type in Carbon)
354+ // Extend to i32
359355 context.SetLocal (inst_id, context.builder ().CreateZExt (
360356 char_i8, context.GetTypeOfInst (inst_id), " string.char.zext" ));
361357 return ;
0 commit comments