Apparently yes. See Lars Blackmore's chapter in the 2016 "Frontiers of Engineering" (National Academy Press) (free registration required)
https://www.nap.edu/read/23659/chapter/10
https://www.nap.edu/download/23659
"SpaceX uses CVXGEN (Mattingley and Boyd 2012) to generate customized flight code, which enables very high-speed onboard convex optimization."
This is actually a great example of a true NASA spinoff, btw. Lars Blackmore was at JPL before moving to SpaceX. Landing on Mars and landing a first stage back on Earth aren't the same problem, but they're close enough for the work to transfer.
I believe that the biggest obstacle in SpaceX's "hover slam" landing isn't calculating and controlling the burn but getting sufficiently precise input in time for those calculations. It must be a miracle of sensor fusion.
Is this level of optimisation really needed? I thought most of the landing was having enough fuel margin and then running a PID control algorithm during the landing burn.