@OleksandrR This is an expected behavior (at least I expected it). The thing is that, when you look at the FullForm of your compiled function, you will see `CompiledFunction[{8, 8., 5468}, {_Real},
{{3, 0, 0}, {3, 0, 0}}, {}, {0, 0, 1, 0, 0},
{{1}}, Function[{x}, x], Evaluate]`. This contains a type specification _Real, which happens to be a pattern. Therefore, your (memoized) pattern does not match,