[llvm-dev] [RFC] Disabling DAG combines in /O0

Michael Kuperstein via llvm-dev llvm-dev at lists.llvm.org
Fri May 13 12:47:00 PDT 2016


Hi Marianne,

This has been tried before. The problem is that although, ideally,
DAGCombine should only be used for optimization, in practice there exist
some combines that are required for correctness. So making this work
properly may require a fairly large clean-up job and a lot of testing.
I suggest you look at PR22346, http://reviews.llvm.org/D8614 and
http://reviews.llvm.org/D9992 for context.

Michael

On Fri, May 13, 2016 at 12:21 PM, Marianne Mailhot-Sarrasin via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi all,
>
>
>
> The DAGCombiner pass actually runs even if the optimize level is set to
> None. This can result in incorrect debug information or unexpected
> stepping/debugging experience. Not to mention that having good
> stepping/debugging experience is the major reason to compile at /O0.
>
>
>
> I recently suggested a patch to disable one specific DAG combine at /O0
> that broke stepping on a particular case (http://reviews.llvm.org/D19268),
> but other similar cases could appear. In the same way, another patch was
> submitted last year for a similar reason (http://reviews.llvm.org/D7181).
>
>
>
> So, since the DAGCombiner is in fact an optimization pass, could it be
> disabled completely (or partially?) in /O0? And how should it be done?
>
>
>
> For example, would this patch be too aggressive?
>
>
> Index: DAGCombiner.cpp
>
> ===================================================================
>
> --- DAGCombiner.cpp        (revision 269301)
>
> +++ DAGCombiner.cpp     (working copy)
>
> @@ -1251,6 +1251,10 @@
>
>
> //===----------------------------------------------------------------------===//
>
>
>
>  void DAGCombiner::Run(CombineLevel AtLevel) {
>
> +
>
> +  if (OptLevel == CodeGenOpt::None)
>
> +    return;
>
> +
>
>    // set the instance variables, so that the various visit routines may
> use it.
>
>    Level = AtLevel;
>
>    LegalOperations = Level >= AfterLegalizeVectorOps;
>
>
>
> It would most likely break some CodeGen tests since it would have an
> impact on the code produced at /O0. In fact, I tried to run the CodeGen lit
> tests with this patch and got 25 new test failures on different targets.
> These tests would probably need to be updated.
>
>
>
> Thanks,
>
> Marianne
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160513/13027cf7/attachment.html>


More information about the llvm-dev mailing list