It is well known that the secondary flow, including vortexes, boundary layer, and three-dimensional separation, is detrimental to the efficiency and stability in the axial compressor. As a passive secondary flow control technique, the endwall fence is considered to overcome the adverse pressure gradient by blocking the crossflow. On this paper, a steady computational study is carried out in a high-speed compressor cascade. Two categories of fence configurations, i.e., embedded in the front and the back of flow passage, have been investigated. For each category, the fence position is selected at 7 locations ranging from 20% to 80% pitch length away from the blade pressure surface, the interval between each case is 10% pitch length. In the comparison between the datum and the fenced cascade, the case of 50% pitch length away from the blade suction surface in the category of front fences is most effective in the improvement of the aerodynamic performance. At the design point, this case decreases the loss coefficient and the blockage coefficient by 6.3% and 6.5%, respectively. Meanwhile, it increases the absolute value of the flow turning angle by 0.9%. From the perspective of the vortex structure, both optimum fences in the front and back category can suppress the passage vortex by inducing the counter-rotating fence vortex, of which scale has a relationship with the contact area between fence surface and the crossflow. Last but not least, the fenced cascade with an optimum performance both in loss mechanism and vortex structure has been investigated under varying inlet incidences. The comparison analysis of the baseline and optimum fence and demonstrates that there is a reduction of the loss exists at negative incidences while an augment occurs at positive incidences. In summary, the optimum case of endwall fence can effectively weaken the endwall loss and thereby enlarge the cascade operating range under negative incidences.