

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
CS6241 - 2025 - Santosh Pandey
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!
Please take the page limits seriously. We will not grade past the given page limits. Please use latex, word, or an equivalent software. Do not turn in handwritten assignments. The only exception is that you may hand draw any graphs and insert these photos into the assignment as long as they are clear. A better option is to use graphviz to create importable graphs or latex TikZ package.
IMPORTANT NOTE: If a problem asks you to make an improvement to an algorithm, you must make a theoretical improvement. Data structure improvements do not count and will be given a zero.
Consider the problem of detecting available expressions for CSE.
A very busy expression e is defined as the one that is anticipatable at a program point p, i.e., there is an evaluation of e on every path that begins at p before the end of the function or redefinition of its operands. It is proposed to hoist e at a program point p so that it eliminates original expressions maximally leading to code size reduction.
Dataflow analysis can be used to detect unsound programs that have uninitialized variables. A use of uninitial- ized variable occurs when a uninitialized variable serves as an operand. We call such uses as unsound uses; since garbage values can reside in uninitialized variables, such uses can have arbitrary values and it is desirable to detect them. An unsound use can propagate such values to other variables’ definitions that are derived from them and this can continue transitively. We call such a set of definitions derived from the unsound uses as unsound definitions. Devise dataflow analysis to detect and warn about all unsound uses and unsound definitions in a program. Please write dataflow equations first followed by an iterative algorithm. You must devise such an analysis from scratch without assuming any other analysis has been done prior to it. Then illustrate it on a CFG. Finally, discuss the complexity of the algorithm in terms of number of basic blocks and propose a way to make it faster on condition that the program has very sparse initialization points of the variables.
Next, consider a branch predicate p(a < b). Due to the unsound usage of a or b, the branch outcome might be wrongly affected here, sending the control flow in the wrong direction. However, even in this situation, not all basic blocks will be affected, i.e., some basic blocks will still execute just fine in terms of control flow (although the dataflow into them would get messed up due to some others not executing properly). Devise an algorithm to detect all such basic blocks whose execution in terms of control flow will not be affected due to unsound uses in the predicate, illustrating it on a sample CFG.
It is proposed to perform constant propagation only within the loops and for that matter we would like to write a demand driven analysis for all the uses within the loop. Note that we need to only find the definitions relevant to given uses (in this case uses inside the loop) and drive the analysis accordingly as against reaching definitions analysis in which we focus on all definitions and find where they reach. Assume that loop detection is done but any other analysis (including regular reaching definitions analysis) is NOT done. Please answer the following questions:
On the given CFG shown below, perform PRE showing all the steps. Does PRE framework discussed in the class (Drechler and Knoop’s papers) completely remove partial redundancy? Show an example where partial redundancy is not completely removed. Figure is on the next page.