Resilient Gauff upsets Swiatek to reach semi-finals in Riyadh