Zef interpreter after Optimization #12: Avoid std::optional
In Fil-C++, std::optional triggers a pathology in the compiler due to its use of unions.
Normally, LLVM plays fast and loose with the types of memory accesses used for unions, but this breaks invisicaps: pointers in unions will sometimes - quite unpredictably to the programmer - lose their capabilities. This leads to Fil-C panics saying that youโre dereferencing an object with a null capability even though the programmer did nothing wrong. To mitigate this, the Fil-C++ compiler inserts intrinsics that force LLVM to be conservative about handling local variables of union type. Later, the FilPizlonator pass performs its own escape analysis to try to allow union typed locals to be register allocated - however, this analysis is nowhere near as complete as the usual LLVM SROA analysis.
The result: passing around classes like std::optional that have a union in them often leads to memory allocations in Fil-C++!
So, this change avoids a code path that leads to std::optional on a hot path.
1.7% speed-up.