If we remove the MMOs from Load/Store instructions, they are treated as volatile. This makes other optimization passes unhappy.
eg. Load/Store Optimization
So, it looks better to merge, not remove.
Differential D14797
[BranchFolding] Merge MMOs during tail merge flyingforyou on Nov 18 2015, 5:20 PM. Authored by
Details If we remove the MMOs from Load/Store instructions, they are treated as volatile. This makes other optimization passes unhappy. So, it looks better to merge, not remove.
Diff Detail
Event TimelineComment Actions Hi Junmo, Instead of adding a field to every MachineInstr, it might be better to concatenate the two memref lists in the case that they are unequal when being merged. Comment Actions Thanks Geoff. Is that safe for other optimization passes? Actually, I am not sure that merging memref lists is safe. Comment Actions Checkout the commit message for r231799. Merging multiple MMO's onto a single MI should not cause any correctness issues. However, the MI scheduler doesn't know how to handle multiple MMOs, so it makes conservative assumptions in this case (see the FIXME comment in ScheduleDAGInstrs.cpp:MIsNeedChainEdge()). In r231799, Ana and I added the == operator for MMOs. When merging the MMO into the MI you could check for redundant MMOs and not merge them. I don't know if this is necessary for your use case, however. HTH, Chad Comment Actions I addressed Chad, Geoff comments. Thanks Chad. Your comment really helpful for me. Junmo.
Comment Actions Thanks Geoff. I accept several changes according to your opinion.
Comment Actions Do you have any information on the impact of this change on final code generation/performance?
Comment Actions Hi Geoff, thanks for comment. This optimization helps LDR/STR optimizations likes making load-pair or store-piar on AArch64. When I ran Single/Multi Source Benchmarks in LLVM test-suite, Geomean value of positive effect is 0.06%, negative effect is 0.04%. Especially, below benchmarks shows 0~1% improvement. MultiSource/Benchmarks/TSVC/GlobalDataFlow-flt/GlobalDataFlow-flt
Comment Actions Another suggestion.
Comment Actions Regarding an MMO compare function, I don't think this would be that much different from the existing MachineMemOperand::operator==. Comment Actions Thanks, Geoff, Chad. I will make an another patch. |