Skip to content

Commit

Permalink
fix(Writer): fix priority grouping in compileBitCastOffset
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri91 committed Oct 18, 2024
1 parent 5406f99 commit b16bb40
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion llvm/lib/CheerpWriter/Opcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,14 @@ void CheerpWriter::compileBitCastOffset(const llvm::User* bi, PARENT_PRIORITY pa
llvm::Type* pointedType = (isArray)?elementType->getArrayElementType():elementType;
if(TypeSupport::isTypedArrayType(pointedType, /* forceTypedArray*/ true))
{
compileByteLayoutOffset( bi->getOperand(0), BYTE_LAYOUT_OFFSET_FULL );
uint32_t size = targetData.getTypeAllocSize(pointedType);
if(size != 1 && parentPrio > SHIFT) stream << '(';
compileByteLayoutOffset( bi->getOperand(0), BYTE_LAYOUT_OFFSET_FULL );
if(size != 1)
{
stream << ">>" << Log2_32(size);
if(parentPrio > SHIFT) stream << ')';
}
return;
}
}
Expand Down

0 comments on commit b16bb40

Please sign in to comment.