<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 11, 2013, at 2:58 PM, Tobias Grosser <<a href="mailto:tobias@grosser.es">tobias@grosser.es</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="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; display: inline !important; float: none; ">On 02/11/2013 10:31 PM, Nadav Rotem wrote:</span><br style="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; "><blockquote type="cite" style="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; ">Now that we have a better understanding of the proposal for using per-instruction metadata, I think that we need to revisit the "single metedata" approach (Pekka's original suggestion).<br></blockquote><br style="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; "><span style="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; display: inline !important; float: none; ">Following Andrew's comments we understood that Sebastian's proposal causes issues with inlining and unrolling. It seems we all agree that his proposal is not an option we can go with.</span></blockquote></div><br><div>Work is well on it's way now, and that's great. But just so people don't get the wrong impression from this thread. I'm not aware of any correctness issue with the "single metadata" approach. Inlining seems to work fine for me. Here's a hacky little example to see what I mean.</div><div><br></div><div><div><font face="Menlo">define void @wrapper(i32* %arg) {</font></div><div><font face="Menlo"> %1 = call i32 @loop(i32* %arg)</font></div><div><font face="Menlo"> ret void</font></div><div><font face="Menlo">}</font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo">define i32 @loop(i32* %a) {</font></div><div><font face="Menlo">entry:</font></div><div><font face="Menlo"> br label %loop</font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo">loop: ; preds = %loop, %entry</font></div><div><font face="Menlo"> %p = phi i32* [%a,%entry], [%p1, %loop]</font></div><div><font face="Menlo"> %p1 = getelementptr i32* %p, i64 1</font></div><div><font face="Menlo"> %v = load i32* %p</font></div><div><font face="Menlo"> %cond = icmp eq i32 %v, 0</font></div><div><font face="Menlo"> br i1 %cond, label %loop, label %exit, !metadata !{i32* %p, metadata !0}</font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo">exit: ; preds = %loop</font></div><div><font face="Menlo"> ret i32 %v</font></div><div><font face="Menlo">}</font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo">!0 = metadata !{metadata !"loop"}</font></div></div><div><font face="Menlo"><br></font></div><div><font face="Menlo">$ opt -inline -S < </font></div><div><font face="Menlo"><br></font></div><div><div><font face="Menlo">define void @wrapper(i32* %arg) {</font></div><div><font face="Menlo"> br label %loop.i</font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo">loop.i: ; preds = %loop.i, %0</font></div><div><font face="Menlo"> %p.i = phi i32* [ %arg, %0 ], [ %p1.i, %loop.i ]</font></div><div><font face="Menlo"> %p1.i = getelementptr i32* %p.i, i64 1</font></div><div><font face="Menlo"> %v.i = load i32* %p.i</font></div><div><font face="Menlo"> %cond.i = icmp eq i32 %v.i, 0</font></div><div><font face="Menlo"> br i1 %cond.i, label %loop.i, label %loop.exit, !metadata !{i32* %p.i, metadata !0}</font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo">loop.exit: ; preds = %loop.i</font></div><div><font face="Menlo"> ret void</font></div><div><font face="Menlo">}</font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo">!0 = metadata !{metadata !"loop"}</font></div></div><div><br></div><div>---</div><div>Unrolling OTOH should be aware of and preserve any loop metadata.</div><div><br></div><div>-Andy</div></body></html>