 In spring 618, during an abortive campaign where Li Yuan sent his sons Li Jiancheng and Li Shimin with an army to the eastern capital Luoyang to try to get Sui officials there to submit, Xiao served on Li Shimin's staff.Also in spring 618, Emperor Yang was killed at Jiangdu (江都, in modern Yangzhou, Jiangsu) in a coup led by the general Yuwen Huaji.When the news reached Chang'an, Li Yuan had Yang You yield the throne to him, establishing Tang Dynasty as its Emperor Gaozu.