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

Marianne Mailhot-Sarrasin via llvm-dev llvm-dev at lists.llvm.org
Fri May 13 12:21:07 PDT 2016


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160513/5a5ad2fc/attachment.html>


More information about the llvm-dev mailing list