Ensures LCSSA form for every instruction from the Worklist in the scope of innermost containing loop.

Synopsis

Declared in <llvm/Transforms/Utils/LoopUtils.h>

bool
formLCSSAForInstructions(
    SmallVectorImpl<Instruction*>& Worklist,
    DominatorTree const& DT,
    LoopInfo const& LI,
    ScalarEvolution* SE,
    SmallVectorImpl<PHINode*>* PHIsToRemove = nullptr,
    SmallVectorImpl<PHINode*>* InsertedPHIs = nullptr);

Description

For the given instruction which have uses outside of the loop, an LCSSA PHI node is inserted and the uses outside the loop are rewritten to use this node.

LoopInfo and DominatorTree are required and, since the routine makes no changes to CFG, preserved.

Returns true if any modifications are made.

This function may introduce unused PHI nodes. If PHIsToRemove is not nullptr, those are added to it (before removing, the caller has to check if they still do not have any uses). Otherwise the PHIs are directly removed.

If InsertedPHIs is not nullptr, inserted phis will be added to this vector.

Return Value

True if any modifications were made.

Parameters

Name

Description

Worklist

Instructions that may need LCSSA PHI nodes.

DT

Dominator tree for the function.

LI

Loop info for the function.

SE

Optional ScalarEvolution to preserve, or nullptr.

PHIsToRemove

Optional list to collect unused PHIs for the caller.

InsertedPHIs

Optional list to collect newly inserted PHIs.

Created with MrDocs