[LLVMdev] InstructionCombining.cpp inconsistency in whether it modifies the CFG?
Duncan Sands
baldrick at free.fr
Mon May 16 12:58:53 PDT 2011
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
More information about the llvm-dev
mailing list