[IRGen] Consume all arguments when generating Builtin.ZeroInitializer.#32530
[IRGen] Consume all arguments when generating Builtin.ZeroInitializer.#32530zoecarver wants to merge 1 commit intoswiftlang:masterfrom
Conversation
Before this patch, the Explosion destructor would assert because the arguments weren't consumed. This patch simply consumes all arguments in the BuiltinValueKind::ZeroInitializer case.
|
I don't think this is correct. The explosion may contain further elements representing other values that are expected to be consumed after the zeroInitializer value. Why are we emitting a |
Sorry, I'm not sure I follow. How would the explosion contain further elements? After adding a nulled out element for each member in the type, the function will always return. I think the expectation is that all arguments are consumed when the function (
We want to do the latter, zero out the referenced memory. What do you mean by an address-only-type-specific implementation? Why doesn't it work to generate a null value for each member's type? |
There are places in IRGen where an Explosion contains elements related to multiple SILValues, particularly when working with arguments and returns, but possibly in other situations. Correct code should only consume the number of arguments it expects.
Until this point, zeroInitializer has only expected to be used with "loadable" types which can be represented in SIL and LLVM IR as direct values. As such, it's only implemented expecting to receive zero inputs and generate zero values as results. If you want it to work with address arguments, that will require a new implementation that takes an Address value, and memsets the referenced memory. |
OK. Good to know.
Also good to know. I'll close this patch and make another that creates a memset when creating the constructor body in the clang importer. |
|
(I'll also create patches to update the other constructors not to use |
Before this patch, the Explosion destructor would assert because the arguments weren't consumed. This patch simply consumes all arguments in the
BuiltinValueKind::ZeroInitializercase.Refs #32402.