Git Product home page Git Product logo

loop-analysis-pass-llvm's Issues

Implement the Skeleton

This is what we'll use to perform develop further analysis. Use the LLVM LoopInfo API.

TODO:

  • Make sure to declare any dependency pass (ideally keep it at one)

Pass Implementation

This should be compatible with llvm-8.0. Follow here

  • Change the make/cmake files to ensure that we are using llvm-8.0

Tracking Edge Cases

  1. Multiple Loop Latches
  /// Returns true if \p BB is a loop-latch.
  /// A latch block is a block that contains a branch back to the header.
  /// This function is useful when there are multiple latches in a loop
  /// because \fn getLoopLatch will return nullptr in that case.
  bool isLoopLatch(const BlockT *BB) const {
    assert(!isInvalid() && "Loop not in a valid state!");
    assert(contains(BB) && "block does not belong to the loop");

    BlockT *Header = getHeader();
    auto PredBegin = GraphTraits<Inverse<BlockT *>>::child_begin(Header);
    auto PredEnd = GraphTraits<Inverse<BlockT *>>::child_end(Header);
    return std::find(PredBegin, PredEnd, BB) != PredEnd;
  }
  1. Single-level multiple loops
  2. Multiple-level loops

Detect IR instruction that generates the loop induction variable update used for loop termination check.

Find the instruction that generates the update

Initial guess:

  1. It should be in the loop header, make sure this applies to all the cases
  • for loop
  • while loop
  • do-while loop
  1. Any arithmatic op is a candidate, narrow down further
  2. Is the use of the instruction a comparison
  3. And is the comparison ends in exit block?

Perhaps a slightly better way would be:

  • consider only comparisons in the "suspect" block
  • find the operands, if it's not a constant, find the instruction
  • if the last instruction contains an induction variable, you have your result.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.