diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/effects.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/ir/effects.h b/src/ir/effects.h index f24f0ac3f..ced8e63cb 100644 --- a/src/ir/effects.h +++ b/src/ir/effects.h @@ -725,9 +725,15 @@ private: } void visitRefAs(RefAs* curr) { // traps when the arg is not valid - if (curr->value->type.isNullable()) { - parent.implicitTrap = true; - } + parent.implicitTrap = true; + // Note: We could be more precise here and report the lack of a possible + // trap if the input is non-nullable (and also of the right kind for + // RefAsFunc etc.). However, we have optimization passes that will + // remove a RefAs in such a case (in OptimizeInstructions, and also + // Vacuum in trapsNeverHappen mode), so duplicating that code here would + // only help until the next time those optimizations run. As a tradeoff, + // we keep the code here simpler, but it does mean another optimization + // cycle may be needed in some cases. } }; |