Skip to content

Commit 83df3f5

Browse files
committed
[IRGen] TypeID is 0 when typed-malloc is disabled.
Produce a value of 0 when typed-malloc is disabled to avoid spurious materialization of type ids with more interesting values.
1 parent c9bcde4 commit 83df3f5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/IRGen/GenPointerAuth.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,12 @@ void ConstantAggregateBuilderBase::addSignedPointer(llvm::Constant *pointer,
772772
}
773773

774774
llvm::ConstantInt *IRGenModule::getMallocTypeId(llvm::Function *fn) {
775+
if (!getOptions().EmitTypeMallocForCoroFrame) {
776+
// Even when typed malloc isn't enabled, a type id may be required for ABI
777+
// reasons (e.g. as an argument to swift_coro_alloc). Use a cheaply
778+
// materialized value.
779+
return llvm::ConstantInt::get(Int64Ty, 0);
780+
}
775781
return getDiscriminatorForString(*this, fn->getName());
776782
}
777783

0 commit comments

Comments
 (0)