This is an archive of the discontinued LLVM Phabricator instance.

[Polly][WIP] Clear DependenceInfo after expansion
Needs ReviewPublic

Authored by niosega on Aug 19 2017, 9:46 AM.

Details

Summary

For expansion to have effect on the generated IR, the DependenceInfo need to be cleared after expansion.

To do that, I take inspiration from JSONImporter which basically do the same things as expansion : modifying scop.
Unfortunately, the generated IRs has no traces of any expansion.

To generate the optimised IR as I use the following command :

clang-5.0 -O3 -mllvm -polly -mllvm -polly-enable-mse -mllvm -debug-pass=Structure -Rpass-analysis="polly-mse" <c_file> -o <output_ll_file>-S -emit-llvm

where <c_file> is the input c file and <output_ll_file> is the optimised IR.
With clang, the generated IR does not take into account the expansion.

I also try with opt alone with the following command :

opt -pass-remarks-analysis="polly-*" -polly-process-unprofitable  -polly-remarks-minimal  -polly-use-llvm-names  -polly-import-jscop-dir=<local_path>  -polly-mse -S < <input_ll_file>

where <input_ll_file> is any working test case file.
With opt, I get exactly the same IR that is in the test case file.

Moreover, I tried to generate code after importing a jscop file (without doing expansion, only importing jscop file), and I didn't succeed to have any effect on the newly created IR.

In both cases (JSONImporter and MaximalStaticExpansion), the scop is modified because the printings are correct. But the generated IR does not take into account these modifications.

Anyone have an idea why my implementation of DependenceInfo clearing doesn't work ?

Diff Detail

Event Timeline

niosega created this revision.Aug 19 2017, 9:46 AM
Meinersbur edited edge metadata.

This patch adds support for -polly-mse to the new PassManager infrastructure.

Can we update DependenceInfo for the old PassManager as well?

philip.pfaffe edited edge metadata.Sep 9 2017, 9:29 AM

opt uses the legacy PM by default. To code-gen using the new PM, you have to run the passes explicitly. I'd be happy to review a patch for a -polly-experimental-new-passmanager commandline option that switches opt over, though :)

To answer your question, two options:

  • Port your patch over to the legacy PM
  • Run the codegen pipeline manually through opt (and file as many bugs as you hit, as this is not super-well tested, yet)
bollu removed a reviewer: bollu.Jan 15 2021, 8:48 PM