CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Consider the basic block B :
q = 3
r = 10
s = q +r
t=2∗r+s
t = q
u = q +r
w = 3 +x

Now consider the following basic block B2.
q = 3
r = 10
s = q +r
t1=s
t=2∗r+s
t = q
u=t1
w=3+x

State which optimaization was performed on the basic block B to get B2 :

A
Common sub-expression elimination
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
B
Constant propagation /folding
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
Dead code elimination
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
Copy propagation
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is A Common sub-expression elimination
Option (c)

Common sub-expression elimination (CSE) is a compiler optimization that searches for instances of Identical expressions (I.e.; they all evaluate to the same value), and analyzes whether it is worthwhile replacing them with a single variable holding the computed value. In basic block B, the common sub-expression q+ r at 6 is eliminated with a single variable t1.

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Adaptive Q1
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon