Sometimes the right-hand argument of fillEmpty is a complex expression:
$ mongod --setParameter featureFlagSbeFull=1
...
$ mongo
> db.c.find({$expr: {$eq: ["$a", 42]}}).explain().queryPlanner.winningPlan.slotBasedPlan.stages
...
fillEmpty(((l1.0 <=> l1.1) == 0), ((exists(l1.0) && typeMatch(l1.0, -65)) == (exists(l1.1) && typeMatch(l1.1, -65))))
Ideally when the left argument is non-Nothing, we shouldn't evaluate the right argument.
But currently, fillEmpty is represented as an EFunction, and all EFunctions are expected to be strict. (EFunctions cannot short circuit.) We should introduce an EPrimBinary for fillEmpty, and then compile it similarly to logicOr to jump over the compiled right-hand side.
We can also have special cases when the rhs is EConstant or EVariable (use the existing fillEmpty and fillEmptyImm instructions) and remove the EFunction fillEmpty.