<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 7, 2017 at 3:09 AM, Elovikov, Andrei via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
During the last month we've faced two cases where some performance degradations were observed due to GlobalsAA not being preserved till the LICM:<br></blockquote><div><br></div><div>Do you mean "compile time" or "generated code performance"?<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  1) New pass pgo-memop-opt (fixed in <a href="http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20170403/443360.html" rel="noreferrer" target="_blank">http://lists.llvm.org/<wbr>pipermail/llvm-commits/Week-<wbr>of-Mon-20170403/443360.html</a>)<br>
  2) GVNHoist (when it was moved to the simplification part of the pipeline)<br>
So it would be good to guard against such issues. However, this highly depends on the particular structure of the optimization pipeline.<br>
LIT test like this seems to work:<br>
<br>
; RUN: opt < %s -O3 -debug-pass=Details -disable-output 2>&1 | FileCheck %s<br>
; CHECK-NOT: is not preserving 'Globals Alias Analysis'<br>
; CHECK: 'Loop Invariant Code Motion' is not preserving 'Rotate Loops'<br>
<some IR with simple loop><br>
<br>
but looks too hard-coded. Are there ways to do it in a cleaner manner?<br>
<br></blockquote><div>Yes. Add a flag explicitly to output the state of preserved analysis, for the specific goal of being used in tests, and use that.<br></div><div><br></div><div>But note: I'm not sure it's entirely reasonable to expect everything in between here and there to preserve something you want preserved.</div><div>These are tradeoffs, and adding a test so you can see when it's not true seems reasonable, but so would xfailing that test if we add something in between :)<br></div><div><br></div><div><br></div></div></div></div>