This is an archive of the discontinued LLVM Phabricator instance.

[Polly] [WIP] [PPCGCodeGeneration] teach PPCG to codegen with variable bounds + invariant load hoisting.
ClosedPublic

Authored by bollu on Jul 7 2017, 5:47 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

bollu created this revision.Jul 7 2017, 5:47 AM
bollu retitled this revision from [Polly] [WIP] [PPCGCodeGeneration] teach PPCG to codegen with simple variable bounds - For some reason, upper bound being a variable works, lower bound does not. - Teach PPCGCodeGeneration to codegen even when lower bound is variable. added the... to [Polly] [WIP] [PPCGCodeGeneration] teach PPCG to codegen with simple variable bounds.Jul 7 2017, 7:18 AM
bollu edited the summary of this revision. (Show Details)
bollu retitled this revision from [Polly] [WIP] [PPCGCodeGeneration] teach PPCG to codegen with simple variable bounds to [Polly] [WIP] [PPCGCodeGeneration] teach PPCG to codegen with variable bounds + invariant load hoisting..
bollu edited the summary of this revision. (Show Details)
bollu updated this revision to Diff 105641.Jul 7 2017, 7:20 AM
  • Remove a testcase that trivially worked (merged into master).
  • Add a testcase that has both lower and upper bounds.
bollu updated this revision to Diff 105992.Jul 11 2017, 3:43 AM
  • Hoist out values from the SubtreeValue because it appears like the value is used in two different "branches" of the code. So, find the closest dominator between where the value is and where it is used by PPCGCodeGeneration and put this instruction there.
  • This is crazy, I see no reason as to why this is "correct". However, it seems to generate reasonable code for the testcases I have in mind.
  • However, other test cases fail due to the change in hasScalarDepsInsideRegion, because of the change in SCEVInRegionDependences::follow.
bollu updated this revision to Diff 106186.Jul 12 2017, 5:34 AM
  • Teach PPCGCodeGeneration to pick up values from ValueMap when it generates

loads and stores.

  • No invalid code generated anymore.
  • Some test cases fail due to change in generated IR / dependences.
bollu updated this revision to Diff 106191.Jul 12 2017, 6:01 AM
  • Simplify replacement logic in PPCGCodeGeneration. [NFC wrt patch]
bollu updated this revision to Diff 106390.Jul 13 2017, 4:01 AM
  • Fix all test cases to work with this patch. I'm not sure about two test cases, have written them down here:
  • test/ScopInfo/invariant-loads-leave-read-only-statements
  • invariant_load_scalar_escape_alloca_sharing.ll
bollu updated this revision to Diff 106396.Jul 13 2017, 4:14 AM
  • [NFC wrt patch] General Style & code fixes.
bollu added inline comments.Jul 13 2017, 4:15 AM
test/DeLICM/reduction_looprotate_hoisted.ll
67 ↗(On Diff #106396)

@Meinersbur: Does this change fix the FIXME you had added?

grosser accepted this revision.Jul 13 2017, 4:35 AM

LGTM.

This revision is now accepted and ready to land.Jul 13 2017, 4:35 AM
This revision was automatically updated to reflect the committed changes.