A rotorcraft main-rotor blade experiences a broad range of the Mach number in high-speed forward flights or rapid maneuvers. Near the boundary of the flight envelope, the rotor blade often encounters severe dynamic stall which limits the overall aerodynamic performance. The effects of the flow compressibility on dynamic stall due to the variation of the freestream Mach number are studied here. A rotor airfoil, VR-12, is computationally investigated for both static and dynamic stall conditions in the relevant range of the Mach number, 0.2 to 0.4. For the small enough Mach number such as 0.2, both static and dynamic stalls are significantly influenced by flow separation due to adverse pressure gradient with little compressibility effect. For the highest Mach number 0.4, compressibility near the leading edge is no longer negligible, forming a local supersonic pocket there. The shock-induced separation occurs near the leading edge, which dominates both the static and dynamic stall at the high Mach number. At the intermediate Mach number 0.3, it is observed that both adverse pressure gradient and weak shock affect the stall. Unsteady compressible Reynolds-averaged Navier-Stokes equations are numerically solved with the Spalart-Allmaras turbulence model in the current study. Numerical results are compared to relevant wind-tunnel test data.