[PATCH] D41701: [DAG] Teach BaseIndexOffset to correctly handle with indexed operations

Nirav Dave via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 10:51:44 PST 2018


niravd added a comment.

In https://reviews.llvm.org/D41701#966881, @efriedma wrote:

> I would prefer to have a regression test, but it's okay if you can't come up with a way to write one.






================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp:90
+    else // If unknown, give up now.
+      return BaseIndexOffset(Base, Index, Offset, IsIndexSignExt);
+  } else if (N->getAddressingMode() == ISD::PRE_DEC) {
----------------
efriedma wrote:
> Does this need to be something like "BaseIndexOffset(Base, N->getOffset(), 0, false);"?  Currently, it looks like this code is discarding the increment.
Good catch. This won't work on pre-decrement though as we'd need the negated index. I've changed it to mark such cases as returning no information and modifying other uses to check for a null base. 


https://reviews.llvm.org/D41701





More information about the llvm-commits mailing list