This is an archive of the discontinued LLVM Phabricator instance.

[Polly][Simplify] Remove unused instructions and accesses.
ClosedPublic

Authored by Meinersbur on Jul 19 2017, 5:48 PM.

Details

Summary

Use a mark-and-sweep algorithm to find and remove unused instructions and MemoryAccesses. This is useful in particular to remove scalar writes that are never used anywhere. A scalar write in a loop induces a write-after-write dependency that stops the loop iterations to be rescheduled. Such writes can be a result of previous transformations such as DeLICM and operand tree forwarding.

It adds a new class VirtualInstruction that represents an instruction in a particular statement. At the moment an instruction can only belong to the statement that represents a BasicBlock. In the future, instructions can be in one of multiple statements representing a BasicBlock (Nandini's work), in different statements than its BasicBlock would indicate, and even multiple statements at once (by forwarding operand trees). It also integrates nicely with the VirtualUse class.

ScopStmt::contains(Instruction*) currently uses the instruction's parent BasicBlock to check whether it contains the instruction. It will need to check the actual statement list when one of the aforementioned features become possible.

Diff Detail

Repository
rL LLVM

Event Timeline

Meinersbur created this revision.Jul 19 2017, 5:48 PM
grosser accepted this revision.Jul 19 2017, 9:37 PM
This revision is now accepted and ready to land.Jul 19 2017, 9:37 PM
This revision was automatically updated to reflect the committed changes.