[llvm-commits] SSI patch
Owen Anderson
resistor at mac.com
Thu Jun 25 11:17:57 PDT 2009
On Jun 25, 2009, at 11:01 AM, Nick Lewycky wrote:
> // TODO: We do modify the programs code, but we do not know which
> // Passes we break.
> void SSI::getAnalysisUsage(AnalysisUsage &AU) const {
> AU.addRequired<DominanceFrontier> ();
> AU.addRequired<DominatorTree> ();
> AU.setPreservesAll();
> }
Actually, since he doesn't do anything in his runOnFunction(), he
does, in fact, preserves all passes. It's the client transformation's
responsibility to maintain other analyses. This might also be an
argument in favor of making this a utility function under lib/
Transforms/Utils rather than a separate pass.
Also, he needs to addRequiredTransitively() his dependencies, rather
than addRequired(). The former guarantees that they will be around
until his pass is destructed, while the latter only guarantees their
existence until the end of runOnFunction().
> /// Test if the BasicBlock BB dominates any use or definition of
> value.
> ///
> bool SSI::dominateAny(BasicBlock * BB, Instruction * value) {
> Value::use_iterator begin = value->use_begin();
> Value::use_iterator end = value->use_end();
> for (; begin != end; ++begin) {
> Instruction * I = dyn_cast<Instruction> (*begin);
This function can be much simpler. The only use of an instruction
that isn't dominated by the def is a phi-use. So you really only need
to check the def itself, and any uses that are also phis.
--Owen
More information about the llvm-commits
mailing list