Handle creating a new constant failing gracefully (#2848)

Fixes #2847
This commit is contained in:
Ryan Harrison 2019-09-10 12:51:19 -04:00 committed by GitHub
parent e2e95172df
commit c0e9807094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,6 +59,8 @@ Pass::Status GenerateWebGPUInitializersPass::Process() {
changed = true;
auto* constant_inst = GetNullConstantForVariable(inst);
if (!constant_inst) return Status::Failure;
if (seen_null_constants_.find(constant_inst) ==
seen_null_constants_.end()) {
constant_inst->InsertBefore(inst);