[PATCH] D72386: [ThinLTO] pass UnrollLoops/VectorizeLoop/VectorizeSLP in CGOpts down to pass builder in ltobackend

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 13:13:40 PST 2020


wmi added inline comments.


================
Comment at: clang/lib/CodeGen/BackendUtil.cpp:1446
+  // unrolling.
+  Conf.PTO.LoopInterleaving = CGOpts.UnrollLoops;
+  Conf.PTO.LoopVectorization = CGOpts.VectorizeLoop;
----------------
tejohnson wrote:
> Looks like this only affects the values passed to LoopVectorizePass. Is there a way to test that it is being enabled properly now?
For vectorization, given a function with vectorizable loop, I test it by specifying -force-vector-width=2 and -force-vector-interleave=1 and checking whether the IR will contain llvm.loop.isvectorized metadata at the end of the pipeline.

Similarly for interleaving, I test it by specifying -force-vector-width=1 and -force-vector-interleave=2 and checking whether the IR will contain llvm.loop.isvectorized metadata at the end of the pipeline.


================
Comment at: clang/lib/CodeGen/BackendUtil.cpp:1448
+  Conf.PTO.LoopVectorization = CGOpts.VectorizeLoop;
+  Conf.PTO.SLPVectorization = CGOpts.VectorizeSLP;
 
----------------
tejohnson wrote:
> Is this enabled by default at -O3? I looked at clang but couldn't tell where that would be happening. If so, then llvm/test/Other/new-pm-thinlto-defaults.ll should be fixed to check that it is added to the postlink pipeline at -O3 to make sure we don't regress here again.
Yes, -vectorize-slp will be added as cc1 option when O2/O3 is specified for clang.

I fixed llvm/test/Other/new-pm-thinlto-defaults.ll, but llvm/test/Other/new-pm-thinlto-defaults.ll depends on the setting in opt instead of clang, so I also enabled slp and loop vectorization in O2, O3 and Os in opt.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72386/new/

https://reviews.llvm.org/D72386





More information about the llvm-commits mailing list