[LLVMdev] InstructionCombining.cpp inconsistency in whether it modifies the CFG?
Michael Ilseman
michael at lunarg.com
Mon May 16 13:09:46 PDT 2011
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.
Thanks!
On Mon, May 16, 2011 at 1:58 PM, Duncan Sands <baldrick at free.fr> wrote:
> Hi Michael,
>
> > InstCombine says in its getAnalysisUsage that it preserves the CFG,
> > but for the 4th argument in its INITIALIZE_PASS call, it says false,
> > which I believe corresponds to whether it preserves the CFG.
>
> that argument should be set to true if the pass only looks at the CFG, i.e.
> whatever it computes/does is only a function of the CFG, and doesn't
> otherwise
> depend on what particular instructions make up the function. Suppose an
> analysis pass A has this property, and a transform pass P announces (using
> setPreservesCFG()) that it does not change the CFG. Then A does not need
> to be recomputed after P has run.
>
> So I think it is correct for InstCombine to not set this flag.
>
> Ciao, Duncan.
>
> Is this a
> > mistake, or is there deeper meaning here?
> >
> > InstructionCombining.cpp:73-82
> >
> > char InstCombiner::ID = 0;
> > INITIALIZE_PASS(InstCombiner, "instcombine",
> > "Combine redundant instructions", false, false)
> >
> > void InstCombiner::getAnalysisUsage(AnalysisUsage&AU) const {
> > AU.addPreservedID(LCSSAID);
> > AU.setPreservesCFG();
> > }
> > _______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110516/89ac99af/attachment.html>
More information about the llvm-dev
mailing list