This is an archive of the discontinued LLVM Phabricator instance.

[DAG] Teach findBaseOffset to interpret indexes of indexed memory operations
ClosedPublic

Authored by niravd on Dec 21 2017, 11:00 AM.

Details

Summary

Indexed outputs are addition / subtractions and can be interpreted as such.

Event Timeline

niravd created this revision.Dec 21 2017, 11:00 AM

There are two aspects to this patch:

  1. Correctness: are we correctly distinguishing indexed loads and stores from unindexed loads and stores?
  2. Performance: are we optimizing indexed loads and stores as aggressively as possible?

This patch looks like it's mixing up the two. Please separate it into two patches, so we can evaluate the two aspects separately.

niravd updated this revision to Diff 128038.Dec 22 2017, 9:31 AM

clang-format and fix missing check that we're using EA output in address calc.

CC llvm-commits in all llvm patches

niravd updated this revision to Diff 128524.Jan 3 2018, 7:53 AM
niravd retitled this revision from [DAG] Teach BaseIndexOffset to correctly deal with with indexed operations to [DAG] Teach findBaseOffset to interpret indexes of indexed memory operations.
niravd edited the summary of this revision. (Show Details)

Factored out the indexed memory operation correctness check into D417101.

RKSimon added inline comments.Jan 7 2018, 3:59 AM
llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
133

Maybe add a LLVM_FALLTHROUGH and default case here?

niravd added inline comments.Jan 8 2018, 8:40 AM
llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
133

We'd still need to have a trailing break after the switch (or a do-loop-again varaible) to drop out of the while loop because of the other 2 cases.

RKSimon added inline comments.Jan 11 2018, 3:08 AM
llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
133

You're right - my mistake.

I don't have any more comments anyone else @efriedma @jyknight @hfinkel ?

jyknight accepted this revision.Jan 26 2018, 8:18 AM

Looks reasonable to me, modulo style nit.

llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
127

This is a confusing way to write this. It gets the correct answer, but I'd prefer if the load/store result value numbers (0 for store, 1 for load) were just explicitly spelled out with a conditional.

This revision is now accepted and ready to land.Jan 26 2018, 8:18 AM
niravd closed this revision.Feb 1 2018, 10:48 AM

This was landed in rL323539.