<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Oh, that’s true the pass is not run where it was running.<div>Thanks Jim.</div><div><br><div>I’ll have to check if we can reproduce the old behavior since the pass may rely on running before the doInitialization of another pass.</div><div><br></div><div>Regarding the test cases, the debug information have changed.</div><div>MergedGlobals is no more referenced in the debug information. I’m fine with that since it was not in the program initially (we give insight on something the developer never wrote!), but it seems to be the expected behavior.</div><div><div><br><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">-Quentin</div>

</div>
<br><div><div>On Apr 16, 2013, at 5:31 PM, Jim Grosbach <<a href="mailto:grosbach@apple.com">grosbach@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Quentin,<div><br></div><div>Hmmmm…. Perhaps we should consider whether to move the pass to where it was actually really running before. We’ll want to consider whether the old behavior was a bug, though, and it really belongs where it’s actually running now (later). A quick glance suggests that the test case may just need to be updated (i.e., the new order is fine, just different). We should understand a bit more of what’s going on before assuming that, though.</div><div><br></div><div>-Jim</div><div><br><div><div>On Apr 16, 2013, at 4:27 PM, Quentin Colombet <<a href="mailto:qcolombet@apple.com">qcolombet@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hi,</div><div><br></div><div>I’ve noticed that all the work performed by the GlobalMerge pass is done within the doInitialization method.</div><div>It’s unclear to me if it is a valid design or not, because according to<span class="Apple-converted-space"> </span><a href="http://llvm.org/docs/WritingAnLLVMPass.html#the-functionpass-class:">http://llvm.org/docs/WritingAnLLVMPass.html#the-functionpass-class:</a></div><div>- On one hand:</div><div>FunctionPass subclasses are not allowed to:</div><div>[…]</div><div>3. Add or remove global variables from the current Module.</div><div>- On the other hand:</div><div>The doInitialization method is allowed to do most of the things that FunctionPasses are not allowed to do.</div><div><br></div><div>What is clear however is: This design prevents other passes to take advantage of this pass. Let’s say I write a pass A that creates some global variables and I’d like to see these variables merged. Thus, I’ll add GlobalMerge pass after A. This does not work unless I push all the work of pass A into doInitialization…</div><div><br></div><div>The proposed patch turns GlobalMerge into a ModulePass and move all its work in runOnModule method.</div><div>Although this patch does not intend to make any functionality change it seems that the phase ordering implied by this design was expected!</div><div><br></div><div>Indeed, with this patch I have two make check failures related to debug info:</div><div><font face="Courier New">test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll:26:14: error: expected string not found in input</font></div><div><font face="Courier New">;CHECK-NEXT: .long __MergedGlobals</font></div><div><font face="Courier New">             ^</font></div><div><font face="Courier New"><stdin>:233:2: note: scanning from here</font></div><div><font face="Courier New"> .long _x2</font></div><div><font face="Courier New"> ^</font></div><div><font face="Courier New">--</font></div><div>and</div><div><font face="Courier New">test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll:17:14: error: expected string not found in input</font></div><div><font face="Courier New">;CHECK-NEXT: .long __MergedGlobals</font></div><div><font face="Courier New">             ^</font></div><div><font face="Courier New"><stdin>:205:2: note: scanning from here</font></div><div><font face="Courier New"> .long _x2</font></div><div><font face="Courier New"> ^</font></div><div><font face="Courier New">—</font></div><div><br></div><div>Any ideas on how I can fix those?</div><div><br></div><div>-Quentin</div><div></div><span><GlobalMergeToModulePass.patch></span><div></div>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></div></blockquote></div></div></div></blockquote></div><br></div></div></div></body></html>