Ah, I see, thanks for the clarification. I interpreted "Pass only looks at the CFG" as  didn't modify it, only looked at it, but I see now that it can also mean  "Pass looks only at the CFG", as in not the instructions.<br>

<br>Thanks!<br><br><div class="gmail_quote">On Mon, May 16, 2011 at 1:58 PM, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Hi Michael,<br>
<div class="im"><br>
> InstCombine says in its getAnalysisUsage that it preserves the CFG,<br>
> but for the 4th argument in its INITIALIZE_PASS call, it says false,<br>
> which I believe corresponds to whether it preserves the CFG.<br>
<br>
</div>that argument should be set to true if the pass only looks at the CFG, i.e.<br>
whatever it computes/does is only a function of the CFG, and doesn't otherwise<br>
depend on what particular instructions make up the function.  Suppose an<br>
analysis pass A has this property, and a transform pass P announces (using<br>
setPreservesCFG()) that it does not change the CFG.  Then A does not need<br>
to be recomputed after P has run.<br>
<br>
So I think it is correct for InstCombine to not set this flag.<br>
<br>
Ciao, Duncan.<br>
<div class="im"><br>
  Is this a<br>
> mistake, or is there deeper meaning here?<br>
><br>
> InstructionCombining.cpp:73-82<br>
><br>
> char InstCombiner::ID = 0;<br>
> INITIALIZE_PASS(InstCombiner, "instcombine",<br>
>                  "Combine redundant instructions", false, false)<br>
><br>
> void InstCombiner::getAnalysisUsage(AnalysisUsage&AU) const {<br>
>    AU.addPreservedID(LCSSAID);<br>
>    AU.setPreservesCFG();<br>
> }<br>
</div>> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br>