Skip to content

Commit 5623782

Browse files
author
Dwight Guth
authored
set noreturn attribute on finish-rewriting call site (#1087)
This is one of a sequence of PRs designed to make progress towards generating stack maps so that we can trigger the GC during allocation rather than in between rewrite steps only. The first few PRs will be preliminaries that add small features that will be used by future PRs. In this PR we simply add the `noreturn` attribute to the call site of the `finish_rewriting` function so that llvm is able to statically understand that the `unreachable` instruction after the call site is in fact unreachable.
1 parent b29dae5 commit 5623782

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/codegen/Decision.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -863,11 +863,12 @@ void abort_when_stuck(
863863
}
864864
ptr = new llvm::BitCastInst(block, block_ptr, "", current_block);
865865
}
866+
auto *func = get_or_insert_function(
867+
module, "finish_rewriting", llvm::Type::getVoidTy(ctx), block_ptr,
868+
llvm::Type::getInt1Ty(ctx));
869+
func->setDoesNotReturn();
866870
llvm::CallInst::Create(
867-
get_or_insert_function(
868-
module, "finish_rewriting", llvm::Type::getVoidTy(ctx), block_ptr,
869-
llvm::Type::getInt1Ty(ctx)),
870-
{ptr, llvm::ConstantInt::getTrue(ctx)}, "", current_block);
871+
func, {ptr, llvm::ConstantInt::getTrue(ctx)}, "", current_block);
871872
new llvm::UnreachableInst(ctx, current_block);
872873
}
873874

0 commit comments

Comments
 (0)