[PATCH] D60294: [DAGCombiner] [CodeGenPrepare] WIP/RFC Splitting large offsets from base addresses

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 12:02:36 PDT 2019


efriedma added a comment.

Should we care about the number of uses of N0 here?  It should generally be "safe" to reassociate in cases where it only has one use.

Given that we're splitting the GEPs before SelectionDAG, the only way to preserve the optimization is to avoid re-merging them... and I can't think of any reasonable approach for that other than something along the lines of this patch.  Well, I guess we could just completely disable folding without regard for whether the addressing mode is legal, but that probably interacts badly with type legalization.

The alternative, as you note, is to do something after isel.  Arguably that would be more effective.  At that point you have a better idea of what constants are actually necessary, and you could integrate it with other similar optimizations like optimizing related integer constants.  This is sort of along the lines of RISCVMergeBaseOffset.



================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:980
+  EVT VT = N0.getValueType();
+  Type *AccessTy = VT.getTypeForEVT(*DAG.getContext());
+
----------------
This computation of AccessTy is weird: it's supposed to be the type of the load, not the type of the pointer.

How you get the right access type is sort of awkward, of course... I guess you could traverse the use list.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60294/new/

https://reviews.llvm.org/D60294





More information about the llvm-commits mailing list