How llvm do Scalar Replacement Of Aggregates?

Hi, I am new to LLVM, I am now studying the source code of LLVM. Now I am interested in SROA and find the logic in SROA.cpp. But it seems a lot of logic there and I cannot figure out the most important. Could anyone give me some outline or pseudocode?