[PATCH] D38278: [CGP] Make optimizeMemoryInst capable of handling multiple AddrModes
Serguei Katkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 27 02:14:50 PDT 2017
skatkov added inline comments.
================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4394
+ bool DifferentScale = false;
+ bool TrivialAddrMode = true;
+
----------------
Can we move this to utility class with operation like diff? It will reduce the size of this method which is already big one.
================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4462
+ // Figure out how different this is from the other address modes.
+ for (ExtAddrMode &AM : AddrModes) {
+ if (AM.BaseReg != NewAddrMode.BaseReg)
----------------
In reality you do not need iteration over found AddrModes. What you need here is just whether at least two AddrModes has different element.
So if Different* is true you do not need to compare this element more.
It actually means that you can always compare NewAddrMode against the first element of an array AddrMode.
Also I would put this functionality into utility class.
================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4546
+ // TODO: Handle multiple AddrModes by inserting a select or phi for each
+ // field in which the AddrModes differ.
----------------
I think it is not good that this bailout goes after debug message (three lines above) is printed.
Repository:
rL LLVM
https://reviews.llvm.org/D38278
More information about the llvm-commits
mailing list