[PATCH] D38278: [CGP] Make optimizeMemoryInst capable of handling multiple AddrModes

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 2 21:07:59 PDT 2017


skatkov added inline comments.


================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:2720
+  bool isTrivial() {
+    return (BaseGV && BaseGV == OriginalValue) ||
+      (BaseReg && BaseReg == OriginalValue);
----------------
reames wrote:
> Don't you also need to check that the offset and scale are zero?  If not, then I'm still confused by what you mean by "trivial".
OriginalValue = gv + base + scale * Index + offset.

If OriginalValue == base => scale == 0, offset == 0, gv == 0

the same if OriginalValue == gv


Repository:
  rL LLVM

https://reviews.llvm.org/D38278





More information about the llvm-commits mailing list