Skip to content

Commit c01ea7e

Browse files
committed
fix(Writer): don't compile virtual/downcast if there are no uses
1 parent b15f598 commit c01ea7e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/lib/CheerpWriter/CheerpWriter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,11 +895,15 @@ CheerpWriter::COMPILE_INSTRUCTION_FEEDBACK CheerpWriter::handleBuiltinCall(const
895895
}
896896
else if(intrinsicId==Intrinsic::cheerp_virtualcast)
897897
{
898+
if(callV.use_empty())
899+
return COMPILE_EMPTY;
898900
compileVirtualcast( callV );
899901
return COMPILE_OK;
900902
}
901903
else if(intrinsicId==Intrinsic::cheerp_downcast)
902904
{
905+
if(callV.use_empty())
906+
return COMPILE_EMPTY;
903907
compileDowncast( callV );
904908
return COMPILE_OK;
905909
}

0 commit comments

Comments
 (0)