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.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
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:
|
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
Please comment on why you're only doing this for NumOfCommonBaseGEPs[ResultPtr] == 1.