HW2example - new branch added to end of homeBB, that tests...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
r10 = SHIFT(variant) r1 = LD (r5) [invariant] r2 = ADD(r1, invariant) r3 = MPY(r2, invariant) r4 = SUB(r3, variant) if (r2 > 0) Conceptual LICM Transformation for HW2 ST(r7, r8) [aliases with LD] Initial code invariant load that cannot be removed due to aliasing store. Check the memory dependence profile and see that the alias count between LD and ST is small Hoist out the LD LICM will then take over and hoist out any instructions that become invariant after the LD is removed. In this case, the ADD and MPY will also be moved out homeBB:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
r10 = SHIFT(variant) if (flag) goto redoBB ST(r7, r8) [aliases with LD] flag = (r7 == r5) r1 = LD (r5) [invariant] r2 = ADD(r1, invariant) r3 = MPY(r2, invariant) flag = 0 r4 = SUB(r3, variant) if (r2 > 0) r1 = LD (r5) [invariant] r2 = ADD(r1, invariant) r3 = MPY(r2, invariant) flag = 0 redoBB: Result of speculative LICM restBB: homeBB: reheaderBB:
Background image of page 2
Notes on Transformation Split home BB of hoisted LD Everything above LD stays put in homeBB Everything after LD gets put in new BB called restBB
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: new branch added to end of homeBB, that tests if flag=1 and branches to redoBB if true, and restBB if false redoBB Place copy of hoisted LD, and copy of any other hoisted invariant instructions that directly or indirectly use the result of the LD. Note its important to populate this list correctly. Look at the set of instrs that are hoisted to identify those that became invariant because of the LD by examining the use lists Note - invariant uses of the LD will automatically get hoisted by LICM, you dont need to do anything to make this happen Note2 even if these uses that become invariant occur in other BBs, you can redo them all in redoBB (think about this one!) Clear flag at the end of redoBB Preheader Set all flags to 0 at end of preheader. Note, each LD that you hoist should have its own flag variable...
View Full Document

Page1 / 3

HW2example - new branch added to end of homeBB, that tests...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online