





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






















Recap - Two Types of Analysis Y
Properties about the values thatpredicates can take on »^
Disjoint
= 2 predicates never
true at the same time »^
Superset
= 1 predicate true more
often »^
Subset
= 1 predicate true less
often »^
Predicate query system
Y
Calculate dataflow informationon predicated code »^
GEN/KILL now occur on acertain predicate (not always)
t = pclearx =p,q = cmpp.uc.un (a<b)t = cmpp.oc(a<b)x =
if p
x =
if q
r,s = cmpp.un.uc(c!=d)
if q
t = cmpp.on(c!=d)
if q
x =
if s
= y
if r
= x
if t
= x
Single-Target Sequential SSA Form t = pclear x = p,q = cmpp.uc.un (a<b) t = cmpp.oc(a<b) x =
if p
x =
if q
r,s = cmpp.un.uc(c!=d)
if q
t = cmpp.on(c!=d)
if q
x =
if s
= y
if r
= x
if t
= x
t1 = false x =
if true
p = !(a < b) * true q = (a < b) * true t2 = t1 + !(a<b) * true x =
if p
x =
if q
r = (c != d) * q s = !(c != d) * q t3 = t2 + (c != d) * q x =
if s
= y
if r
= x
if t
= x
if true
Note: t2 = p
Generating Partition Relations
symbol
string
source
Predicate computations reordered to follow the paper p = !(a < b) * true q = (a < b) * true t1 = false t2 = t1 + !(a<b) * true t3 = t2 + (c != d) * q s = !(c != d) * q r = (c != d) * q
symbol
string
source
false
false,t
true
true
!(a<b)*
p,t
(a<b)*
q^
!(c=d)*
r
(c=d)*
s^
t
Partition Graph Properties Y
Y
Y
Y
Y
Level(root) = 0
Y
p = (a<b) * trueq = !(a<b) * truer = (c>d) * ps = !(c>d) * pu = (e!=5) * truev = !(e!=5) * true
p^
q
r^
s
u^
v
Partition Graph of Earlier Example^ symbol
string
source
false
false,t
true
true
!(a<b)*
p,t
(a<b)*
q^
!(c=d)*
r
(c=d)*
s^
t
true p^
q r^
s
Class Problem – Create the Partition Graph^ r = pclear^ x =^ p,q = cmpp.un.uc (a == b)^ x =
if p
x =
if q
r,s = cmpp.on.uc(c < d)
if p
r,t = cmpp.on.uc(e > f)
if s
u,v = cmpp.un.uc
if r
x =
if s
x =
if v
= x
if r
x =
if t
= x
PQS – Basic Functions on Pred Expressions Y
Y
Used for GEN function »^
x live under E, after use under P, x used under E+P »^
Liveness = any path, over approximation of execution set isconservative, thus use lub_sum
Y
Y
Used for KILL function »^
x live under E, after a DEF of x under P, x now live under E-P »^
Again, lub_diff an over approximation for any path problem likeliveness
Representing Predicate Expressions
Code efficiency, complexity
Implementing PQS Functions in 1-dnf
1 p^
q r^
s
is_disjoint(p,q) = if there is a partition with p on 1 side, q on the other, then disjoint is_subset(p,q) = if q is an ancestor, then p is a subset lub_sum(p, E) = return p + qi for all qi in E. (Remove redundant/subsumed terms)
t
Examples:
Are p and s disjoint? Are t and p disjoint? Is r a subset of p? Is s a subset of q? s + {q} =? r + {s} =? p + {r,s} =?
Predicate-Sensitive Dataflow Analysis
Bitvector becomes vector of predicate expressions
Predicate-Sensitive Liveness
Destination operands
GEN’(x) = GEN(x) – Q KILL’(x) = KILL(x) + Q
Source (data) operands GEN’(y) = GEN(y) + Q KILL’(y) = KILL(y) - Q
Source (predicate) operands
backward analysis
GEN’(q) = GEN(q) + true = true KILL’(q) = KILL(q) – true = false
What About ON/OC CMPP’s?
Destination operands
GEN’(p) = GEN(p) – (a<1)Q KILL’(p) = KILL(p) + (a<1)Q
Source (data) operands GEN’(a) = GEN(a) + Q KILL’(a) = KILL(a) – Q
Source (predicate) operands
backward analysis
GEN’(q) = GEN(q) + true = true KILL’(q) = KILL(q) – true = false
Liveness Example
1 p^
q r^
s
t = pclear x = p,q = cmpp.uc.un (a<b) t = cmpp.oc(a<b) x =
if p
x =
if q
r,s = cmpp.un.uc(c!=d)
if q
t = cmpp.on(c!=d)
if q
x =
if s
= y
if r
= x
if t
t
backward analysis