[PATCH] D36073: [CGP] Extends the scope of optimizeMemoryInst optimization

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 7 00:18:09 PDT 2017

mkazantsev added inline comments.

Comment at: lib/CodeGen/CodeGenPrepare.cpp:2617
+  bool EqualsIgnoreBase(const ExtAddrMode &O) const {
+    return (ScaledReg == O.ScaledReg) && (BaseGV == O.BaseGV) &&
I think this can be merged separately as NFC. Also you could re-define the `operator==` avode like `return (BaseReg == O.BaseReg) && EqualsIgnoreBase(O)` to avoid code duplication.

Comment at: lib/CodeGen/CodeGenPrepare.cpp:4630
+    // we find common base later.
+    if (AddrMode.EqualsIgnoreBase(NewAddrMode))
+      // All bases must be of the same type.
Better use && instread of increased nesting.


More information about the llvm-commits mailing list