Wei Yan and Changshi Yangyi themselves had many contradictions. When others saw Wei Yan, they all avoided his sharp edge, but Yang Yi confronted him. When Zhuge Liang was alive, he could also mediate the contradictions between the two, and after Zhuge Liang's death, Fei Yi and others alone could not suppress Wei Yan. These things had also been anticipated by Zhuge Liang, and before his death, the crowd gathered to discuss the matter of the class teacher, and decided to let Wei Yan cut off. But Wei Yan understood that without Zhuge Liang's balancing effect, he would definitely be picked up by Yang Yi and others after he returned. So he sent troops to block the route of the large army squad, and there was a great posture of fighting for your life. Yang Yi and Wei Yan both went to the imperial court one after another to say that they were plotting rebellion, and there were almost no people in the imperial court who spoke for Wei Yan. This political situation was very unfavorable to Wei Yan, and Wei Yan's generals knew that Wei Yan was at fault first, and in order to protect themselves, they all defected and fled. In the end, Wei Yan was left alone, and Yang Yi sent Tai Ma Dai to kill him.

Speaking of which, this was a struggle within the Shu Han regime. It did not hurt the Shu Han regime in itself.
Second, if Wei Yan did not die, he would either continue to fight, or Wei Yan would command the three armies, but this would not change the outcome of the final demise of Shu Han.
Zhuge Liang was originally the needle of the god of the sea within the Shu Han regime, and after his death, the emergence of various forces competing with each other was in line with political logic. If Wei Yan had not been killed, the infighting in the Shu Han regime would have continued. Wei Yan's prestige in the army was very high, but his popularity in the dprk was not very good, if Wei Yan was not reused, his position and survival would be threatened, and eventually the fish would die and the net would be broken, and the possibility of a mutiny was also there.
Even in an extreme way, Wei Yan took over Zhuge Liang's command of the army, and I am afraid that it would accelerate the demise of Shu Han. Wei Yan was a general, but not a handsome man. He had commanded the town to guard Hanzhong for more than ten years, especially the Great Wall, and refused to allow the Wei army to go south outside the Pass. In the eyes of Liu Bei and Zhuge Liang, Wei Yan was a rare tiger general, but leading troops and using troops were two different things. Wei Yan often didn't look at things, otherwise he wouldn't be killed by Yang Yi so easily. If he had become commander-in-chief, it is estimated that he would devote all his national strength to the Seventh and Eighth Northern Expeditions. The national strength of the Shu Han Dynasty could not support such a war at all.
During the Three Kingdoms period, the population of the State of Wei was four times that of shu and Han, and the economy was at least five times greater, and the comparison of comprehensive national strength was not an order of magnitude. In the late Three Kingdoms period, the State of Wei had become a monopoly, breaking the situation of three legs. No matter who the Shu Han commanded, it could not change the final result.