<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Mar 12, 2008, at 12:22 AM, ½Å°Çö wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div lang="KO" link="blue" vlink="purple"><div class="Section1"><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; text-align: justify; font-size: 10pt; font-family: '¸¼Àº °íµñ'; "><span lang="EN-US">Programmers</span>¡¯<span lang="EN-US"><span class="Apple-converted-space"> </span>manual says we can iterate over a use-def chain by op_iterator.<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; text-align: justify; font-size: 10pt; font-family: '¸¼Àº °íµñ'; "><span lang="EN-US">It works fine except for load and store instruction of stack variables.<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; text-align: justify; font-size: 10pt; font-family: '¸¼Àº °íµñ'; "><span lang="EN-US"><o:p> </o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; text-align: justify; font-size: 10pt; font-family: '¸¼Àº °íµñ'; "><span lang="EN-US">For example, a simple bitcode is like the below.<o:p></o:p></span></div><div style="text-indent: 10pt; margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; text-align: justify; font-size: 10pt; font-family: '¸¼Àº °íµñ'; "><span lang="EN-US">i = alloca i32<o:p></o:p></span></div><div style="text-indent: 10pt; margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; text-align: justify; font-size: 10pt; font-family: '¸¼Àº °íµñ'; "><span lang="EN-US">store i32 0, i32* %i, align 4<o:p></o:p></span></div><div style="text-indent: 10pt; margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; text-align: justify; font-size: 10pt; font-family: '¸¼Àº °íµñ'; "><span lang="EN-US">%tmp1 = load i32* %i, align 4<o:p></o:p></span></div><div style="text-indent: 10pt; margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; text-align: justify; font-size: 10pt; font-family: '¸¼Àº °íµñ'; "><span lang="EN-US"><o:p> </o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; text-align: justify; font-size: 10pt; font-family: '¸¼Àº °íµñ'; "><span lang="EN-US">If I apply a use-def chain to load instruction, I get alloca instruction.<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; text-align: justify; font-size: 10pt; font-family: '¸¼Àº °íµñ'; "><span lang="EN-US">I think store instruction is a correct use-def chain.<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; text-align: justify; font-size: 10pt; font-family: '¸¼Àº °íµñ'; "><span lang="EN-US">Am I right?<o:p></o:p></span></div><div style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; text-align: justify; font-size: 10pt; font-family: '¸¼Àº °íµñ'; "><span lang="EN-US">Is there any other method to iterate over a use-def chain in this case?</span></div></div></div></span></blockquote><br></div><div>You should try out Owen's MemDepAnalysis interface, which returns the load/store that another load/store depends on. Note that this is a fuzzy query: it depends on the precision of alias analysis.</div><div><br class="webkit-block-placeholder"></div><div>-Chris</div></body></html>