This is an archive of the discontinued LLVM Phabricator instance.

Create constant GEP first to allow more LICM.
AbandonedPublic

Authored by hulx2000 on Jul 22 2015, 6:17 PM.

Details

Summary
This patch changes the order of GEPs generated by Split GEPs pass,
specially when one of the GEPs has constant and the base is loop
invariant, then we will generate the GEP with constant first when
beneficial, to expose more cases for LICM.

For no-loop cases, the original way of generating GEPs seems to
expose more CSE cases, so we don't change the logic for no-loop
cases, and only limit our change to the specific case we are
interested in.

Diff Detail

Repository
rL LLVM

Event Timeline

hulx2000 retitled this revision from to Create constant GEP first to allow more LICM..
hulx2000 updated this object.
hulx2000 set the repository for this revision to rL LLVM.
hulx2000 added a subscriber: llvm-commits.
hfinkel added inline comments.Jul 25 2015, 10:57 AM
lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
747

Please comment on why you're only doing this for NumOfCommonBaseGEPs[ResultPtr] == 1.

750

deoesn't -> doesn't

761

I'd rather you moved this to the bottom of the loop.

762

contain -> contains

763

So -> so

in original -> in the original

767

And just made this a 'continue'

780

Why does this not have Builder.getInt8Ty() as its first argument like the one below? Could you introduce a small lambda function to avoid repeating the logic twice?

1063

Seems like we:

  1. End up scanning loops we don't really care about at all (can't we do this lazily later?)
  2. Increment NumOfCommonBaseGEPs based on uses is separate loops; should the count be loop specific?

Hi, Hal:

Thanks for review.

This patch is the earlier version of http://reviews.llvm.org/D11051, do you prefer this version better?

Regards

Lawrence Hu

hfinkel edited edge metadata.Jul 25 2015, 11:41 AM

Hi, Hal:

Thanks for review.

This patch is the earlier version of http://reviews.llvm.org/D11051, do you prefer this version better?

Ah, yes, likely. I'll look at that one.

Regards

Lawrence Hu

hulx2000 abandoned this revision.Aug 1 2015, 2:41 PM

A better version is uploaded to http://reviews.llvm.org/D11051