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)
Implement like a regular pass
so it is testable without your framework/setup
Implement Branch Instruction Detection that's a Back Edge to the Loop
- Implement for a 1-level deep loop
- Implement nested loop
Edge Cases:
- 1
- 2
- 3... etc
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
- 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;
}
- Single-level multiple loops
- 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:
- It should be in the loop header, make sure this applies to all the cases
- for loop
- while loop
- do-while loop
- Any arithmatic op is a candidate, narrow down further
- Is the use of the instruction a comparison
- 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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.