[llvm-dev] Completeness of -print-after-all

Matthias Braun via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 8 11:09:35 PST 2018


On a side note: The printing is also disabled when the runOnXXX() functions return false, as passes indicate that they did not do any changes that way.
I certainly have seen some passes getting this wrong and reporting false even though they did some small changes to the MIR, but because the return value only affects the debug printing it's no really an important bug and we may still have some around...

- Matthias

> On Nov 8, 2018, at 10:03 AM, Fedor Sergeev via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> чт, 8 нояб. 2018 г., 14:45 Markus Lavin markus.lavin at ericsson.com <mailto:markus.lavin at ericsson.com>:
> Fedor,
> 
>  
> 
> Yes that is what happens in my case that the loop is fully unrolled and hence ‘removed’.
> 
>  
> 
> My objection though is that there is still IR that could be dumped (i.e. the function containing the loop that was removed or the entire module) and that is what I want to have dumped after each pass when I specify -print-after-all. Of course there may be certain implementation details that could make this hard to achieve but ideally I would like to have a reliable option that dumps the entire IR (complete enough to import into opt and run additional passes on) after each individual pass (module, function, loop or whatever).
> 
>  
> 
> Doesn’t that make sense?
> 
> It does not agree with the semantics of plain - print-before-all, which intends to prints only the IRunit pass works on. 
> 
> It does however makes perfect sense for the combo with -print-module-scope.
> In fact I was going to try doing that for new-pass-manager implementation.
> 
> Legacy one is technically doable as well, though there is a catch that you can't get module out of invalidated Loop, so there needs to be some hackstery employed...
> 
> Patches welcome! :) 
> 
> regards,
>   Fedor. 
>  
> 
> Regards,
> 
> Markus
> 
>  
> 
>  
> 
> From: Fedor Sergeev <fedor.v.sergeev at gmail.com <mailto:fedor.v.sergeev at gmail.com>> 
> Sent: Thursday, November 8, 2018 11:06 AM
> To: Markus Lavin <markus.lavin at ericsson.com <mailto:markus.lavin at ericsson.com>>
> Cc: llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> Subject: Re: [llvm-dev] Completeness of -print-after-all
> 
>  
> 
> Markus,
> 
>  
> 
> Loop passes are kinda unique compared to func/module passes in that they could destroy the loop they worked on. And there might be no loop to print after that (btw, there is a known bug in new pass manager where it tries to print deleted loop in this situation - nothing good happens!).
> 
>  
> 
> In your case loop unroll can fully uroll the loop, essentially removing the Loop. 
> 
>  
> 
> If you have suggestions on how to improve behavior in such cases I would be happy to discuss this further. 
> 
>  
> 
> regards, 
> 
> Fedor 
> 
>  
> 
> 8 нояб. 2018 г. 12:38 пользователь "Markus Lavin via llvm-dev" <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> написал:
> 
> Hi,
> 
> I recently worked on an issue where I realized that -print-after-all does not
> cover all passes run by the pass manager. E.g. it seems that loop passes are
> not fully covered and I could find that loop transformations showed up in the
> dump of the next non-loop pass (which happened to be 'Combine redundant
> instructions' and that was rather confusing).
> 
> Specifying both -print-before-all and -print-after-all and doing some grepping
> gives me the following where we see two back-to-back 'Before' dumps which
> should not be possible.
> 
> *** IR Dump Before LCSSA Verifier ***
> *** IR Dump After LCSSA Verifier ***
> *** IR Dump Before Loop-Closed SSA Form Pass ***
> *** IR Dump After Loop-Closed SSA Form Pass ***
> *** IR Dump Before Unroll loops ***
> *** IR Dump Before Combine redundant instructions ***
> *** IR Dump After Combine redundant instructions ***
> 
> Maybe there are good reasons for making this hard to fix but to me it seems
> like a rather severe deficiency so I wonder if this is widely known and if there
> are any plans to improve it?
> 
> -Markus
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>_______________________________________________
> 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/20181108/add25858/attachment.html>


More information about the llvm-dev mailing list